Modified:
trunk/build.xml
trunk/src/atunit/AtUnit.java
trunk/src/atunit/Container.java
trunk/src/atunit/ContainerClass.java
trunk/src/atunit/Mock.java
trunk/src/atunit/MockFramework.java
trunk/src/atunit/MockFrameworkClass.java
trunk/src/atunit/Stub.java
trunk/src/atunit/Unit.java
trunk/src/atunit/core/MockFramework.java
trunk/test/atunit/guice/GuiceContainerTests.java
Log:
- first wave of javadoc improvements, covering most of the API used by
test authors.
Modified: trunk/build.xml
==============================================================================
--- trunk/build.xml (original)
+++ trunk/build.xml Sun Nov 11 18:27:28 2007
@@ -79,7 +79,7 @@
<target name="test" depends="compile" description="execute unit tests">
<delete dir="${build.dir}/testoutput"/>
<mkdir dir="${build.dir}/testoutput"/>
- <junit printsummary="withOutAndErr">
+ <junit printsummary="withOutAndErr" haltonfailure="true">
<formatter type="plain"/>
<classpath>
<path refid="compile.classpath"/>
Modified: trunk/src/atunit/AtUnit.java
==============================================================================
--- trunk/src/atunit/AtUnit.java (original)
+++ trunk/src/atunit/AtUnit.java Sun Nov 11 18:27:28 2007
@@ -18,7 +18,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
-import java.util.HashMap;
import java.util.Map;
import org.junit.internal.runners.InitializationError;
@@ -34,6 +33,16 @@
import atunit.jmock.JMockFramework;
import atunit.spring.SpringContainer;
+/**
+ * This is the JUnit test runner used for AtUnit tests. It delegates
to the
+ * configured {@link atunit.core.MockFramework} for mock and stub object
+ * creation and to the configured {@link atunit.core.Container} for dependency
+ * injection.
+ *
+ * @author Logan Johnson <logan....@gmail.com>
+ *
+ * @see <a href="example/ExampleAtUnitTest.java.xhtml"/>ExampleAtUnitTest.java</a>
+ */
public class AtUnit extends JUnit4ClassRunner {
public AtUnit(Class<?> testClass) throws InitializationError {
Modified: trunk/src/atunit/Container.java
==============================================================================
--- trunk/src/atunit/Container.java (original)
+++ trunk/src/atunit/Container.java Sun Nov 11 18:27:28 2007
@@ -16,12 +16,19 @@
package atunit;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
+/**
+ * Tells AtUnit to use a supported dependency injection (inversion of
control) container.
+ *
+ * A parameter of type {@link Option} is required.
+ *
+ * @author Logan Johnson <logan....@gmail.com>
+ *
+ * @see <a href="example/ExampleGuiceTest.java.xhtml">ExampleGuiceTest.java</a>
+ * @see <a href="example/ExampleSpringTest.java.xhtml">ExampleSpringTest.java</a>
+ *
+ */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Inherited
Modified: trunk/src/atunit/ContainerClass.java
==============================================================================
--- trunk/src/atunit/ContainerClass.java (original)
+++ trunk/src/atunit/ContainerClass.java Sun Nov 11 18:27:28 2007
@@ -16,14 +16,22 @@
package atunit;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
import atunit.core.Container;
+/**
+ * Specifies a {@link Container} implementation to use as the dependency
+ * injection container for the test.
+ * <p>
+ * This annotation is used to plug in an unsupported or custom
container. To use
+ * a supported container, use the {@link atunit.Container} annotation instead.
+ *
+ * @author Logan Johnson <logan....@gmail.com>
+ *
+ * @see Container
+ *
+ */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Inherited
Modified: trunk/src/atunit/Mock.java
==============================================================================
--- trunk/src/atunit/Mock.java (original)
+++ trunk/src/atunit/Mock.java Sun Nov 11 18:27:28 2007
@@ -16,11 +16,20 @@
package atunit;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
+/**
+ * Fields with this annotation are populated with mock objects created
using the configured framework.
+ *
+ * A framework is chosen via the {@link MockFramework} or {@link
MockFrameworkClass} annotation on the test class.
+ *
+ * @author Logan Johnson <logan....@gmail.com>
+ *
+ * @see MockFramework
+ * @see MockFrameworkClass
+ * @see <a href="example/ExampleJMockTest.java.xhtml">ExampleJMockTest.java</a>
+ * @see <a href="example/ExampleJMockTest.java.xhtml">ExampleEasyMockTest.java</a>
+ */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface Mock {
Modified: trunk/src/atunit/MockFramework.java
==============================================================================
--- trunk/src/atunit/MockFramework.java (original)
+++ trunk/src/atunit/MockFramework.java Sun Nov 11 18:27:28 2007
@@ -16,12 +16,24 @@
package atunit;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
+
+
+/**
+ * Tells AtUnit to use a supported mock objects framework. The specified
+ * framework will be used to populate fields in the test annotated with
+ * {@link Mock} or {@link Stub}.
+ *
+ * A parameter of type {@link Option} is required.
+ *
+ * @author Logan Johnson <logan....@gmail.com>
+ *
+ * @see Mock
+ * @see Stub
+ * @see <a href="example/ExampleJMockTest.java.xhtml">ExampleJMockTest.java</a>
+ * @see <a href="example/ExampleJMockTest.java.xhtml">ExampleEasyMockTest.java</a>
+ */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Inherited
Modified: trunk/src/atunit/MockFrameworkClass.java
==============================================================================
--- trunk/src/atunit/MockFrameworkClass.java (original)
+++ trunk/src/atunit/MockFrameworkClass.java Sun Nov 11 18:27:28 2007
@@ -16,14 +16,21 @@
package atunit;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
import atunit.core.MockFramework;
+/**
+ * Specifies a {@link MockFramework} implementation to use as the mock
objects framework for the test.
+ * <p>
+ * This annotation is used to plug in an unsupported or custom mock
objects framework. To use
+ * a supported framework, use the {@link atunit.MockFramework}
annotation instead.
+ *
+ * @author Logan Johnson <logan....@gmail.com>
+ *
+ * @see MockFramework
+ *
+ */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Inherited
Modified: trunk/src/atunit/Stub.java
==============================================================================
--- trunk/src/atunit/Stub.java (original)
+++ trunk/src/atunit/Stub.java Sun Nov 11 18:27:28 2007
@@ -21,6 +21,18 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * This annotation is like {@link Mock}, except that the object
provided by
+ * AtUnit is a dummy and is ignored by the mock objects framework.
+ * <p>
+ * The specific meaning of this annotation depends on the selected
mock objects
+ * framework, but in general it should be used to fulfill dependencies
which are
+ * irrelevant to the test.
+ *
+ * @author Logan Johnson <logan....@gmail.com>
+ *
+ * @see Mock
+ */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface Stub {}
Modified: trunk/src/atunit/Unit.java
==============================================================================
--- trunk/src/atunit/Unit.java (original)
+++ trunk/src/atunit/Unit.java Sun Nov 11 18:27:28 2007
@@ -16,13 +16,17 @@
package atunit;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
+/**
+ * Indicates the subject of the test. Every AtUnit test must have
exactly one
+ * field which carries this annotation.
+ *
+ * @author Logan Johnson <logan....@gmail.com>
+ *
+ * @see <a href="example/ExampleAtUnitTest.java.xhtml">ExampleAtUnitTest.java</a>
+ */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface Unit {
- boolean ignored() default false;
}
Modified: trunk/src/atunit/core/MockFramework.java
==============================================================================
--- trunk/src/atunit/core/MockFramework.java (original)
+++ trunk/src/atunit/core/MockFramework.java Sun Nov 11 18:27:28 2007
@@ -24,7 +24,6 @@
/**
*
* @param fields contains fields which the mock framework may populate.
- * @return
*/
Map<Field,Object> getValues(Field[] fields) throws Exception;
Modified: trunk/test/atunit/guice/GuiceContainerTests.java
==============================================================================
--- trunk/test/atunit/guice/GuiceContainerTests.java (original)
+++ trunk/test/atunit/guice/GuiceContainerTests.java Sun Nov 11
18:27:28 2007
@@ -24,6 +24,6 @@
public void tExample() {
Result result = junit.run(ExampleGuiceTest.class);
assertTrue(result.wasSuccessful());
- assertEquals(1, result.getRunCount());
+ assertEquals(2, result.getRunCount());
}
}