### Question:
DefaultLogicalEntity implements LogicalEntity { @Override public List<EntityBody> getEntities(final ApiQuery apiQuery, final String resourceName) { if (apiQuery == null) { throw new IllegalArgumentException("apiQuery"); } if (apiQuery.getSelector() == null) { throw new UnsupportedSelectorException("No selector to parse"); } final EntityDefinition typeDef = resourceHelper.getEntityDefinition(resourceName); final ClassType entityType = provider.getClassType(StringUtils.capitalize(typeDef.getType())); if (UNSUPPORTED_RESOURCE_LIST.contains(resourceName)) { throw new UnsupportedSelectorException("Selector is not supported yet for this resource"); } final SemanticSelector semanticSelector = selectorSemanticModel.parse(apiQuery.getSelector(), entityType); final SelectorQuery selectorQuery = selectorQueryEngine.assembleQueryPlan(semanticSelector); return selectorDocument.aggregate(selectorQuery, apiQuery); }  @Override List<EntityBody> getEntities(final ApiQuery apiQuery, final String resourceName);  }### Answer:
@Test public void testCreateEntities() { final EntityDefinition mockEntityDefinition = mock(EntityDefinition.class); when(mockEntityDefinition.getType()).thenReturn("TEST"); when(resourceHelper.getEntityDefinition(anyString())).thenReturn(mockEntityDefinition); @SuppressWarnings("unchecked") final SelectorQuery mockPlan = mock(SelectorQuery.class); when(selectorQueryEngine.assembleQueryPlan(any(SemanticSelector.class))).thenReturn(mockPlan); final ApiQuery apiQuery = mock(ApiQuery.class); when(apiQuery.getSelector()).thenReturn(new HashMap<String, Object>()); @SuppressWarnings("unchecked") final List<EntityBody> mockEntityList = mock(List.class); when(selectorDocument.aggregate(mockPlan, apiQuery)).thenReturn(mockEntityList); final List<EntityBody> entityList = logicalEntity.getEntities(apiQuery, "TEST"); assertEquals(mockEntityList, entityList); }