### Question:
Cache { public String getAliadaEventTypeClassFrom(final String crmClass) { String uri = crm2AliadaEventTypes.get(crmClass); if (uri == null) { uri = rdfStore.crm2AliadaClass(crmClass); } return uri; }  String getAliadaClassFrom(final String crmClass); Pattern getStartPattern(final String regex); Pattern getEndPattern(final String regex); String getAliadaEventTypeClassFrom(final String crmClass); JobInstance getJobInstance(final Integer id); void removeJobInstance(final Integer jobId);  }### Answer:
@Test public void crmEventTypeFoundInCache() { final String anEventTypeThatIsInCache = cut.crm2AliadaEventTypes.keySet().iterator().next(); final String expectedResult = cut.crm2AliadaEventTypes.get(anEventTypeThatIsInCache); assertEquals( expectedResult, cut.getAliadaEventTypeClassFrom(anEventTypeThatIsInCache)); verifyZeroInteractions(dao); }
@Test public void crmEventTypeNotFoundInCacheButFoundInRDFStore() { final String anEventTypeThatIsNotInCache = randomString(); final String expectedResult = randomString(); when(dao.crm2AliadaClass(anEventTypeThatIsNotInCache)).thenReturn(expectedResult); assertEquals( expectedResult, cut.getAliadaEventTypeClassFrom(anEventTypeThatIsNotInCache)); verify(dao).crm2AliadaClass(anEventTypeThatIsNotInCache); }
@Test public void crmEventTypeNotFound() { final String anEventTypeThatIsNotInCache = randomString(); when(dao.crm2AliadaClass(anEventTypeThatIsNotInCache)).thenReturn(null); assertNull(cut.getAliadaEventTypeClassFrom(anEventTypeThatIsNotInCache)); verify(dao).crm2AliadaClass(anEventTypeThatIsNotInCache); }