diff options
Diffstat (limited to 'common/src/test/java/org/onap/so/BeansTest.java')
-rw-r--r-- | common/src/test/java/org/onap/so/BeansTest.java | 76 |
1 files changed, 35 insertions, 41 deletions
diff --git a/common/src/test/java/org/onap/so/BeansTest.java b/common/src/test/java/org/onap/so/BeansTest.java index 54cbced563..8bde3c4eb7 100644 --- a/common/src/test/java/org/onap/so/BeansTest.java +++ b/common/src/test/java/org/onap/so/BeansTest.java @@ -24,17 +24,14 @@ import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.equalTo; import static org.onap.so.openpojo.rules.HasAnnotationMatcher.hasAnnotation; import static org.onap.so.openpojo.rules.HasAnnotationPropertyWithValueMatcher.hasAnnotationPropertyWithValue; - import javax.persistence.Column; import javax.persistence.Temporal; - import org.junit.Test; import org.onap.so.openpojo.rules.CustomSetterMustExistRule; import org.onap.so.openpojo.rules.EqualsAndHashCodeTester; import org.onap.so.openpojo.rules.HasEqualsAndHashCodeRule; import org.onap.so.openpojo.rules.HasToStringRule; import org.onap.so.openpojo.rules.ToStringTester; - import com.openpojo.reflection.PojoClass; import com.openpojo.reflection.PojoClassFilter; import com.openpojo.reflection.filters.FilterEnum; @@ -55,42 +52,39 @@ import com.openpojo.validation.test.impl.SetterTester; public class BeansTest { - private PojoClassFilter filterTestClasses = new FilterTestClasses(); - - private PojoClassFilter enumFilter = new FilterEnum(); - - - - @Test - public void pojoStructure() { - test("org.onap.so.client.policy.entities"); - test("org.onap.so.client.grm.beans"); - test("org.onap.so.client.ruby.beans"); - test("org.onap.so.client.sdno.beans"); - test("org.onap.so.entity"); - test("org.onap.so.serviceinstancebeans"); - } - - private void test(String pojoPackage) { - Validator validator = ValidatorBuilder.create() - .with(new GetterMustExistRule()) - .with(new NoNestedClassRule()) - .with(new NoStaticExceptFinalRule()) - .with(new SerializableMustHaveSerialVersionUIDRule()) - .with(new NoPublicFieldsExceptStaticFinalRule()) - .with(new SetterTester()) - .with(new GetterTester()) - - - - .build(); - - - validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete()); - } - private static class FilterTestClasses implements PojoClassFilter { - public boolean include(PojoClass pojoClass) { - return !pojoClass.getSourcePath().contains("/test-classes/"); - } - } + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + private PojoClassFilter enumFilter = new FilterEnum(); + + + + @Test + public void pojoStructure() { + test("org.onap.so.client.policy.entities"); + test("org.onap.so.client.grm.beans"); + test("org.onap.so.client.ruby.beans"); + test("org.onap.so.client.sdno.beans"); + test("org.onap.so.entity"); + test("org.onap.so.serviceinstancebeans"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new NoNestedClassRule()) + .with(new NoStaticExceptFinalRule()).with(new SerializableMustHaveSerialVersionUIDRule()) + .with(new NoPublicFieldsExceptStaticFinalRule()).with(new SetterTester()).with(new GetterTester()) + + + + .build(); + + + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, enumFilter, + new FilterNonConcrete()); + } + + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } } |