ToHelper { public Class<?> getDomainClass(Class<?> toClass) { Class<?> declaredClass = getDeclaredDomainClass(toClass); return classReplacer.replaceClass(declaredClass); }  void setClassReplacer(ClassReplacer classReplacer); boolean isTo(Object object); boolean isToClass(Class<?> toClass); Class<?> getDomainClass(Class<?> toClass); Class<?> getToSubType(Class<?> toType, Object domainObject);  }
@Test public void testGetDomainClass() throws Exception { assertThat(toHelper.getDomainClass(SimpleClassNameTo.class)).isEqualTo(SimpleClassDomain.class); assertThat(toHelper.getDomainClass(SimpleClassTypeTo.class)).isEqualTo(SimpleClassDomain.class); }
@Test public void testGetNoDomainClass() throws Exception { exception.expect(JTransfoException.class); exception.expectMessage(" not annotated with DomainClass."); assertThat(toHelper.getDomainClass(NoDomain.class)).isNull(); }
@Test public void noClassDomainClassAnnotationTest() throws Exception { exception.expect(JTransfoException.class); exception.expectMessage(" DomainClass annotation does not specify class."); assertThat(toHelper.getDomainClass(NoClassTo.class)).isNull(); }
@Test public void unknownClassDomainClassAnnotationTest() throws Exception { exception.expect(JTransfoException.class); exception.expectMessage(" DomainClass org.jtransfo.UnknownClass not found."); assertThat(toHelper.getDomainClass(UnknownClassTo.class)).isNull(); }