de.smartics.testdoc.annotations
Annotation Type Uut


@Documented
@Inherited
@Target(value={TYPE,FIELD,METHOD,LOCAL_VARIABLE})
@Retention(value=RUNTIME)
public @interface Uut

Tags the unit-under-test (UUT) within a test case. Usually there is only one unit-under-test within a test case.

These are the uses cases of the annotation:

 
   
   

Annotate the field in a test case class

@Uut
private MyClass uut;

This is the simplest and most often used test case. There is a field in the test case class that points to the unit-under-test.

 
   
   

Annotate the field in a test case class, stating the method being tested

@Uut(method="doX(String, int)")
private MyClass uut;

In case that the test cases only deal with a certain method of the unit under test, the method attribute allows to point to this method.

 
   
   

Annotate the test case class

@Uut(type=de.smartics.text.MyClass.class)
public class MyClassTest {
...
}

If the unit-under-test is not declared by a field in the test class, this example shows how to annotate the test case class and specify which class is being tested. You may also add the method being tested by the test cases to the annotation:

 
   
   

Annotate the test case class, specifying the method

@Uut(type=de.smartics.text.MyClass.class method="doX(String, int)")
public class MyClassTest {
...
}

And you may also add this annotation to a method:

 
   
   

Annotate the test case method

@Uut(type=de.smartics.text.MyClass.class)
public void shouldRejectInvalidInputOfSomeSort{
...
}

Author:
Robert Reiner

Optional Element Summary
 String method
          The method being tested by the unit test.
 Class<?> type
          The type of the unit-under-test.
 

type

public abstract Class<?> type
The type of the unit-under-test.

This property is only required if the annotation is given at the test case class or test case method. If it is given at field level, the type of the field is the default value.

Returns:
the type of the unit-under-test.
Default:
java.lang.Object.class

method

public abstract String method
The method being tested by the unit test.

This property allows to show that the tests only deal with a certain facet of the unit-under-test.

Returns:
the method of the unit-under-test being tested.
Default:
""


Copyright © 2010-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.