/** Tetea el metodo {@link EntityReflection#getCollaboratorsType(Class)} */ @Test public void getEnumCollaborators() { Map<String, List<String>> types = EntityReflection.getEnumCollaborators(EntityMock.class); Assert.assertEquals("No se listo el enum Sexo", 1, types.size()); }
/** Tetea el metodo {@link EntityReflection#getCollaboratorsType(Class)} */ @Test public void getCollaboratorsType() { Map<String, Class<?>> types = EntityReflection.getCollaboratorsType(EntitySubclassMock.class); Assert.assertEquals("Se seleccionaron tipos que no son Entity", 2, types.size()); Assert.assertEquals("No se listo una clase Entity", OtherEntityMock.class, types.get("other")); Assert.assertEquals( "No se listo una clase Entity", EntityCollaboratorMock.class, types.get("collaborator")); }
/** Tetea el metodo {@link EntityReflection#updateEntity(Object, Object)} */ @Test public void updateEntityRecursively() { SubclassSimpleMock source = new SubclassSimpleMock(); source.setId(new Long(1)); source.setTexto("Superclass"); source.setOtherText("Subclass"); SubclassSimpleMock target = new SubclassSimpleMock(); target.setId(new Long(2)); target.setTexto("Test"); target.setOtherText("Test"); target.setNumber(new Long(3)); EntityReflection.updateEntity(source, target); Assert.assertNotNull("Se asigno null a una propiedad", target.getNumber()); Assert.assertEquals("Subclass", target.getOtherText()); Assert.assertEquals(new Long(1), target.getId()); Assert.assertEquals("Superclass", target.getTexto()); }