ConceptpowerConnector implements IConceptpowerConnector { @Override @Cacheable(value = "concepts", key = "#id") public ConceptpowerReply getById(String id) { Map<String, String> vars = new HashMap<String, String>(); String url = conceptURL + idUrl + id.trim(); try { return restTemplate.getForObject(url, ConceptpowerReply.class, vars); } catch (RestClientException ex) { logger.error("Offending id: " + id); logger.error("Could not get concept", ex); return null; } }  @Override @Cacheable(value = "concepts") ConceptpowerReply search(String item, String pos); @Override @Cacheable(value = "concepts") ConceptpowerReply search(String searchTerm); @Override @Cacheable(value = "concepts", key = "#id") ConceptpowerReply getById(String id);  }
@Test public void testGetById() { ConceptpowerReply reply = connectorUnderTest.getById("id"); assertNotNull(reply); assertEquals(1, reply.getConceptEntry().size()); assertEquals("dog", reply.getConceptEntry().get(0).getLemma()); assertEquals("noun", reply.getConceptEntry().get(0).getPos()); }
@Test public void testGetByIdNoResult() { ConceptpowerReply reply = connectorUnderTest.getById("id2"); assertNotNull(reply); assertEquals(0, reply.getConceptEntry().size()); }