@Test void testTypedReferenceIsNotFileMeta() { Entity entity = mock(Entity.class); PretendingEntity pretendingEntity = new PretendingEntity(entity, new HashMap<>()); Exception exception = assertThrows( UnsupportedOperationException.class, () -> pretendingEntity.getEntity("ref", Plugin.class)); assertThat(exception.getMessage()).containsPattern("Can't return typed pretending entities"); }
@Override public Entity getEntity(String attributeName) { Entity entity = delegate().getEntity(attributeName); return entity != null ? newPretendingEntity(entity) : null; }
PretendingEntity extends AbstractEntityDecorator { @Override public Entity getEntity(String attributeName) { Entity entity = delegate().getEntity(attributeName); return entity != null ? newPretendingEntity(entity) : null; } }
PretendingEntity extends AbstractEntityDecorator { @Override public Entity getEntity(String attributeName) { Entity entity = delegate().getEntity(attributeName); return entity != null ? newPretendingEntity(entity) : null; } PretendingEntity(Entity entity, Map<String, EntityType> copiedEntityTypes); }
PretendingEntity extends AbstractEntityDecorator { @Override public Entity getEntity(String attributeName) { Entity entity = delegate().getEntity(attributeName); return entity != null ? newPretendingEntity(entity) : null; } PretendingEntity(Entity entity, Map<String, EntityType> copiedEntityTypes); @Override EntityType getEntityType(); @Override Entity getEntity(String attributeName); @Override @SuppressWarnings("unchecked") E getEntity(String attributeName, Class<E> clazz); @Override Iterable<Entity> getEntities(String attributeName); @Override @SuppressWarnings("unchecked") Iterable<E> getEntities(String attributeName, Class<E> clazz); }
PretendingEntity extends AbstractEntityDecorator { @Override public Entity getEntity(String attributeName) { Entity entity = delegate().getEntity(attributeName); return entity != null ? newPretendingEntity(entity) : null; } PretendingEntity(Entity entity, Map<String, EntityType> copiedEntityTypes); @Override EntityType getEntityType(); @Override Entity getEntity(String attributeName); @Override @SuppressWarnings("unchecked") E getEntity(String attributeName, Class<E> clazz); @Override Iterable<Entity> getEntities(String attributeName); @Override @SuppressWarnings("unchecked") Iterable<E> getEntities(String attributeName, Class<E> clazz);  }