Java Code Examples for com.openpojo.reflection.PojoClass#getInterfaces()

The following examples show how to use com.openpojo.reflection.PojoClass#getInterfaces() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EqualsAndHashCodeMatchRuleTest.java    From openpojo with Apache License 2.0 5 votes vote down vote up
@Test
public void mustImplementRule() {
  PojoClass equalsAndHashcodeMatchRule = PojoClassFactory.getPojoClass(EqualsAndHashCodeMatchRule.class);
  List<PojoClass> interfaces = equalsAndHashcodeMatchRule.getInterfaces();
  Assert.assertTrue("Expected interface=[Rule] to be implemented, but was not", interfaces.contains(PojoClassFactory
      .getPojoClass(Rule.class)));
}
 
Example 2
Source File: PojoClassImplTest.java    From openpojo with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldGetInterfaces() {
  final PojoClass pojoClass = getPojoClassImplForClass(AClassWithInterfaces.class);
  Affirm.affirmEquals(String.format("Interfaces added/removed from [%s]?", pojoClass), 2, pojoClass.getInterfaces().size());

  final List<Class<?>> expectedInterfaces = new LinkedList<Class<?>>();
  expectedInterfaces.add(FirstInterfaceForAClassWithInterfaces.class);
  expectedInterfaces.add(SecondInterfaceForAClassWithInterfaces.class);
  for (final PojoClass pojoInterface : pojoClass.getInterfaces()) {
    Affirm.affirmTrue(String.format("Expected interfaces [%s] not found, instead found [%s]", expectedInterfaces,
        pojoInterface.getClazz()), expectedInterfaces.contains(pojoInterface.getClazz()));
  }
}