示例#1
0
 @Test
 public void isAnInterface() {
   exists();
   assertTrue(
       "Class " + AIRCRAFT_REPOSITORY_CLASSNAME + " should be an interface.",
       Modifier.isInterface(Reflex.reflect(AIRCRAFT_REPOSITORY_CLASSNAME).cls().getModifiers()));
   assertTrue(
       "Class " + AIRPORT_REPOSITORY_CLASSNAME + " should be an interface.",
       Modifier.isInterface(Reflex.reflect(AIRPORT_REPOSITORY_CLASSNAME).cls().getModifiers()));
 }
示例#2
0
 @Test
 public void extendsCrudRepository() {
   isAnInterface();
   assertTrue(
       "Class "
           + AIRCRAFT_REPOSITORY_CLASSNAME
           + " should extend interface "
           + CrudRepository.class.getName()
           + ".",
       CrudRepository.class.isAssignableFrom(Reflex.reflect(AIRCRAFT_REPOSITORY_CLASSNAME).cls()));
   assertTrue(
       "Class "
           + AIRPORT_REPOSITORY_CLASSNAME
           + " should extend interface "
           + CrudRepository.class.getName()
           + ".",
       CrudRepository.class.isAssignableFrom(Reflex.reflect(AIRPORT_REPOSITORY_CLASSNAME).cls()));
 }
示例#3
0
  private void extendsCrudRepositoryWithCorrectTypeParameters(
      String clazzName, String typeOneClass) {
    Class clazz = Reflex.reflect(clazzName).cls();
    Type[] typeArguments = null;
    try {
      Type[] types = clazz.getGenericInterfaces();
      ParameterizedType type = (ParameterizedType) types[0];
      typeArguments = type.getActualTypeArguments();
    } catch (Exception e) {
      fail(
          "When class "
              + clazzName
              + " extends CrudRepository, it should provide classes "
              + typeOneClass
              + " and "
              + Long.class.getName()
              + " as type parameters.");
    }

    assertTrue(
        "When class "
            + clazzName
            + " extends CrudRepository, it should provide classes "
            + typeOneClass
            + " and "
            + Long.class.getName()
            + " as type parameters.",
        typeArguments[0].equals(Reflex.reflect(typeOneClass).cls()));
    assertTrue(
        "When class "
            + clazzName
            + " extends CrudRepository, it should provide classes "
            + typeOneClass
            + " and "
            + Long.class.getName()
            + " as type parameters.",
        typeArguments[1].equals(Long.class));
  }
 @Before
 public void haeLuokka() {
   klass = Reflex.reflect(klassName);
 }
示例#5
0
 @Test
 public void exists() {
   Reflex.reflect(AIRCRAFT_REPOSITORY_CLASSNAME);
   Reflex.reflect(AIRPORT_REPOSITORY_CLASSNAME);
 }