### Question:
PojoEntityCompiler implements AgEntityCompiler { @Override public <T> AgEntity<T> compile(Class<T> type, AgDataMap dataMap) { return new LazyAgEntity<>(type, () -> doCompile(type, dataMap)); } PojoEntityCompiler(@Inject Map<String, AgEntityOverlay> entityOverlays); @Override AgEntity<T> compile(Class<T> type, AgDataMap dataMap);  }### Answer:
@Test public void testCompile() { AgEntity<Entity> entity = new PojoEntityCompiler(Collections.emptyMap()) .compile(Entity.class, new LazyAgDataMap(compilers)); assertNotNull(entity); assertEquals(1, entity.getIds().size()); assertEquals(1, entity.getAttributes().size()); assertEquals(0, entity.getRelationships().size()); }
@Test public void testCompile_CollectionAttributes() { AgEntity<P8> entity = new PojoEntityCompiler(Collections.emptyMap()) .compile(P8.class, new LazyAgDataMap(compilers)); assertNotNull(entity); assertEquals(0, entity.getIds().size()); assertEquals(7, entity.getAttributes().size()); assertEquals(Collection.class, entity.getAttribute(P8.BOOLEANS).getType()); assertEquals(Collection.class, entity.getAttribute(P8.DOUBLES).getType()); assertEquals(Collection.class, entity.getAttribute(P8.CHARACTERS).getType()); assertEquals(Collection.class, entity.getAttribute(P8.WILDCARD_COLLECTION).getType()); assertEquals(Collection.class, entity.getAttribute(P8.GENERIC_COLLECTION).getType()); assertEquals(List.class, entity.getAttribute(P8.NUMBER_LIST).getType()); assertEquals(Set.class, entity.getAttribute(P8.STRING_SET).getType()); assertEquals(0, entity.getRelationships().size()); }
@Test public void testCompile_NotAnEntity() { AgEntity<NotAnEntity> entity = new PojoEntityCompiler(Collections.emptyMap()) .compile(NotAnEntity.class, new LazyAgDataMap(compilers)); assertNotNull(entity); try { entity.getAttributes(); fail("Exception expected"); } catch (AgException e) { assertTrue(e.getMessage().startsWith("Invalid entity '"), e.getMessage()); } }