FossologyHostKeyHandler { public List<FossologyHostFingerPrint> getFingerPrints() throws TException { final List<FossologyHostFingerPrint> fingerPrints = fossologyHostKeyConnector.getAll(); return nullToEmptyList(fingerPrints); } @Autowired  FossologyHostKeyHandler(FossologyFingerPrintRepository fossologyHostKeyConnector); List<FossologyHostFingerPrint> getFingerPrints(); RequestStatus setFingerPrints(List<FossologyHostFingerPrint> fingerPrints);  }
@Test public void testGetFingerPrints() throws Exception { List<FossologyHostFingerPrint> fingerPrints = Collections.emptyList(); when(fossologyHostKeyConnector.getAll()).thenReturn(fingerPrints); assertThat(fossologyHostKeyHandler.getFingerPrints(), sameInstance(fingerPrints)); verify(fossologyHostKeyConnector).getAll(); }
@Test public void testGetFingerPrintsReturnEmptyOnFailure() throws Exception { when(fossologyHostKeyConnector.getAll()).thenReturn(null); assertThat(fossologyHostKeyHandler.getFingerPrints(), is(emptyCollectionOf(FossologyHostFingerPrint.class))); verify(fossologyHostKeyConnector).getAll(); }