Skip to content

Commit

Permalink
Doing some formatting for ReflectTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
dkayiwa committed Jan 7, 2014
1 parent 85fa223 commit 4d9b5f4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions api/src/test/java/org/openmrs/util/ReflectTest.java
Expand Up @@ -43,7 +43,7 @@ public class ReflectTest {
public void xhasField_shouldReturnTrueIfGivenFieldIsDeclaredInParameterizedClassOrSubClass() throws Exception {
Reflect reflect = new Reflect(OpenmrsObject.class);
List<Field> allFields = Reflect.getAllFields(OpenmrsObjectImp.class);

Field genericCollectionField = findFieldByName(allFields, "genericCollectionField");
Assert.assertTrue(reflect.hasField(genericCollectionField));
}
Expand All @@ -56,14 +56,14 @@ public void xhasField_shouldReturnTrueIfGivenFieldIsDeclaredInParameterizedClass
public void xhasField_shouldReturnFalseIfGivenFieldIsNotDeclaredInParameterizedClassOrItsSubClass() throws Exception {
Reflect reflect = new Reflect(OpenmrsObject.class);
List<Field> allFields = Reflect.getAllFields(OpenmrsObjectImp.class);

Field normalClassField = findFieldByName(allFields, "normalClassField");

Assert.assertFalse(reflect.hasField(normalClassField));
}

private Field findFieldByName(List<Field> fields, String name) {
for (Field field: fields) {
for (Field field : fields) {
if (name.equals(field.getName())) {
return field;
}
Expand All @@ -78,7 +78,7 @@ private Field findFieldByName(List<Field> fields, String name) {
@Verifies(value = "should return all fields include private and super classes", method = "getAllFields(Class<*>)")
public void getAllFields_shouldReturnAllFieldsIncludePrivateAndSuperClasses() throws Exception {
List<Field> allFields = Reflect.getAllFields(OpenmrsObjectImp.class);

findFieldByName(allFields, "subClassField");
findFieldByName(allFields, "normalClassField");
findFieldByName(allFields, "nonCollectionField");
Expand All @@ -93,7 +93,7 @@ public void getAllFields_shouldReturnAllFieldsIncludePrivateAndSuperClasses() th
public void isCollection_shouldReturnFalseIfGivenFieldClassIsNotACollectionClass() throws Exception {
Reflect reflect = new Reflect(OpenmrsObject.class);
List<Field> allFields = Reflect.getAllFields(OpenmrsObjectImp.class);

Field nonCollectionField = findFieldByName(allFields, "nonCollectionField");
Assert.assertFalse(reflect.isCollectionField(nonCollectionField));
}
Expand Down Expand Up @@ -144,11 +144,11 @@ public void getInheritedFields_shouldReturnOnlyTheSubClassFieldsOfGivenParameter
List<Field> fields = reflect.getInheritedFields(OpenmrsObjectImp.class);

List<Field> allFields = Reflect.getAllFields(OpenmrsObjectImp.class);

findFieldByName(fields, "subClassField");
findFieldByName(fields, "nonCollectionField");
findFieldByName(fields, "genericCollectionField");

Field normalClassField = findFieldByName(allFields, "normalClassField");
Assert.assertFalse(fields.contains(normalClassField));
}
Expand Down

0 comments on commit 4d9b5f4

Please sign in to comment.