* generated code is valid and works.
*/
@Test
public void fields_with_annotations()
{
ClassTransformation ct = mockClassTransformation();
MutableComponentModel model = mockMutableComponentModel();
Inject fredAnnotation = mockInject();
Inject barneyAnnotation = mockInject();
Id barneyId = newId();
String barneyFieldName = "_barneyBlock";
String fredFieldName = "fred";
train_findFieldsOfType(
ct,
InjectBlockWorker.BLOCK_TYPE_NAME,
fredFieldName,
barneyFieldName);
train_getResourcesFieldName(ct, "rez");
train_getFieldAnnotation(ct, fredFieldName, Inject.class, fredAnnotation);
train_getFieldAnnotation(ct, fredFieldName, Id.class, null);
ct.makeReadOnly(fredFieldName);
ct.claimField(fredFieldName, fredAnnotation);
train_getFieldAnnotation(ct, barneyFieldName, Inject.class, barneyAnnotation);
train_getFieldAnnotation(ct, barneyFieldName, Id.class, barneyId);
train_value(barneyId, "barney");
ct.makeReadOnly(barneyFieldName);
ct.claimField(barneyFieldName, barneyAnnotation);
train_extendMethod(
ct,
TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE,
"{",