SimpleContingencyDbFacade implements ContingencyDbFacade { @Override public synchronized List<Contingency> getContingencies() { LOGGER.info("Network {}: getting contingencies", network.getId()); return contingenciesActionsDbClient.getContingencies(network); } SimpleContingencyDbFacade(ContingenciesAndActionsDatabaseClient contingenciesActionsDbClient, Network network); @Override synchronized List<Contingency> getContingencies(); @Override synchronized List<List<Action>> getCurativeActions(Contingency contingency, List<LimitViolation> limitViolations); @Override synchronized List<List<Action>> getPreventiveActions(LimitViolation limitViolation);  }
@Test public void testGetContingencies() throws Exception { Network mockNetwork = NetworkFactory.create("mockNetwork", "test"); Contingency mockContingency = new Contingency("mockContingency", new BranchContingency("mockLine")); List<Contingency> mockContingencies = Arrays.asList(mockContingency); ContingenciesAndActionsDatabaseClient mockContingenciesActionsDbClient = Mockito.mock(ContingenciesAndActionsDatabaseClient.class); Mockito.when(mockContingenciesActionsDbClient.getContingencies(mockNetwork)).thenReturn(mockContingencies); ContingencyDbFacade contingencyDbFacade = new SimpleContingencyDbFacade(mockContingenciesActionsDbClient, mockNetwork); assertEquals(mockContingencies, contingencyDbFacade.getContingencies()); }