@Test public void checkGetPackage() { Name name = mock(Name.class); when(name.toString()).thenReturn("Test"); Name qualifiedName = mock(Name.class); when(qualifiedName.toString()).thenReturn("com.example.Test"); TypeElement element = mock(TypeElement.class); when(element.getSimpleName()).thenReturn(name); when(element.getQualifiedName()).thenReturn(qualifiedName); EntityModel entity = new EntityModel(element); ASSERT.that("com.example").isEqualTo(entity.getPackage()); }
@Override public String getPackage() { final String simpleName = element.getSimpleName().toString(); final String qualifiedName = element.getQualifiedName().toString(); return qualifiedName.substring(0, qualifiedName.length() - simpleName.length() - 1); }
EntityModel implements EntityData { @Override public String getPackage() { final String simpleName = element.getSimpleName().toString(); final String qualifiedName = element.getQualifiedName().toString(); return qualifiedName.substring(0, qualifiedName.length() - simpleName.length() - 1); } }
EntityModel implements EntityData { @Override public String getPackage() { final String simpleName = element.getSimpleName().toString(); final String qualifiedName = element.getQualifiedName().toString(); return qualifiedName.substring(0, qualifiedName.length() - simpleName.length() - 1); } EntityModel(TypeElement element); }
EntityModel implements EntityData { @Override public String getPackage() { final String simpleName = element.getSimpleName().toString(); final String qualifiedName = element.getQualifiedName().toString(); return qualifiedName.substring(0, qualifiedName.length() - simpleName.length() - 1); } EntityModel(TypeElement element); void fillFieldsList(Helper helper, List<EntityModel> models); Element getElement(); @Override String getName(); @Override String getFullQualifiedName(); @Override String getPackage(); @Override String getVariable(); MapperModel getMapper(); boolean hasAnnotationValue(); String getAnnotationValue(); List<FieldModel> getFields(); List<EntityModel> getDependencies(); }
EntityModel implements EntityData { @Override public String getPackage() { final String simpleName = element.getSimpleName().toString(); final String qualifiedName = element.getQualifiedName().toString(); return qualifiedName.substring(0, qualifiedName.length() - simpleName.length() - 1); } EntityModel(TypeElement element); void fillFieldsList(Helper helper, List<EntityModel> models); Element getElement(); @Override String getName(); @Override String getFullQualifiedName(); @Override String getPackage(); @Override String getVariable(); MapperModel getMapper(); boolean hasAnnotationValue(); String getAnnotationValue(); List<FieldModel> getFields(); List<EntityModel> getDependencies();  }