@Test public void testFindEntityWithBeginDate(){ String request = "/educationOrganizations/id/sessions"; EntityDefinition definition = mock(EntityDefinition.class); ClassType sessionClassType = mock(ClassType.class); Attribute attribute = mock(Attribute.class); Mockito.when(entityDefinitionStore.lookupByResourceName(anyString())).thenReturn(definition); Mockito.when(definition.getType()).thenReturn(SESSION); Mockito.when(modelProvider.getClassType(anyString())).thenReturn(sessionClassType); Mockito.when(sessionClassType.getBeginDateAttribute()).thenReturn(attribute); Mockito.when(attribute.getName()).thenReturn("beginDate"); EntityFilterInfo entityFilterInfo = entityIdentifier.findEntity(request); assertFalse(entityFilterInfo.getBeginDateAttribute().isEmpty()); }
public EntityFilterInfo findEntity(String request) { this.request = request; EntityFilterInfo entityFilterInfo = new EntityFilterInfo(); List<String> resources = Arrays.asList(request.split("/")); String resource = resources.get(resources.size() - 1); EntityDefinition definition = entityDefinitionStore.lookupByResourceName(resource); if(definition != null) { ClassType entityType = modelProvider.getClassType(StringUtils.capitalize(definition.getType())); populatePath(entityFilterInfo, entityType, resource); } return entityFilterInfo; }
EntityIdentifier { public EntityFilterInfo findEntity(String request) { this.request = request; EntityFilterInfo entityFilterInfo = new EntityFilterInfo(); List<String> resources = Arrays.asList(request.split("/")); String resource = resources.get(resources.size() - 1); EntityDefinition definition = entityDefinitionStore.lookupByResourceName(resource); if(definition != null) { ClassType entityType = modelProvider.getClassType(StringUtils.capitalize(definition.getType())); populatePath(entityFilterInfo, entityType, resource); } return entityFilterInfo; } }
EntityIdentifier { public EntityFilterInfo findEntity(String request) { this.request = request; EntityFilterInfo entityFilterInfo = new EntityFilterInfo(); List<String> resources = Arrays.asList(request.split("/")); String resource = resources.get(resources.size() - 1); EntityDefinition definition = entityDefinitionStore.lookupByResourceName(resource); if(definition != null) { ClassType entityType = modelProvider.getClassType(StringUtils.capitalize(definition.getType())); populatePath(entityFilterInfo, entityType, resource); } return entityFilterInfo; }  }
EntityIdentifier { public EntityFilterInfo findEntity(String request) { this.request = request; EntityFilterInfo entityFilterInfo = new EntityFilterInfo(); List<String> resources = Arrays.asList(request.split("/")); String resource = resources.get(resources.size() - 1); EntityDefinition definition = entityDefinitionStore.lookupByResourceName(resource); if(definition != null) { ClassType entityType = modelProvider.getClassType(StringUtils.capitalize(definition.getType())); populatePath(entityFilterInfo, entityType, resource); } return entityFilterInfo; }  EntityFilterInfo findEntity(String request); }
EntityIdentifier { public EntityFilterInfo findEntity(String request) { this.request = request; EntityFilterInfo entityFilterInfo = new EntityFilterInfo(); List<String> resources = Arrays.asList(request.split("/")); String resource = resources.get(resources.size() - 1); EntityDefinition definition = entityDefinitionStore.lookupByResourceName(resource); if(definition != null) { ClassType entityType = modelProvider.getClassType(StringUtils.capitalize(definition.getType())); populatePath(entityFilterInfo, entityType, resource); } return entityFilterInfo; }  EntityFilterInfo findEntity(String request);  }