protected Object createTest() throws Exception {
Class<?> c = getTestClass().getJavaClass();
Set<Field> testFields = getFields(c);
Container container = getContainerFor(c);
MockFramework mockFramework = getMockFrameworkFor(c);
// make sure we have one (and only one) @Unit field
Field unitField = getUnitField(testFields);
if ( unitField.getAnnotation(Mock.class) != null ) {
throw new IncompatibleAnnotationException(Unit.class, Mock.class);
}
final Map<Field,Object> fieldValues = mockFramework.getValues(testFields.toArray(new Field[0]));
if ( fieldValues.containsKey(unitField)) {
throw new IncompatibleAnnotationException(Unit.class, unitField.getType());
}
Object test = container.createTest(c, fieldValues);