### Question:
LinkOperationsService { public List<Isl> updateLinkUnderMaintenanceFlag(SwitchId srcSwitchId, Integer srcPort, SwitchId dstSwitchId, Integer dstPort, boolean underMaintenance) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { Optional<Isl> foundIsl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, dstPort); Optional<Isl> foundReverceIsl = islRepository.findByEndpoints(dstSwitchId, dstPort, srcSwitchId, srcPort); if (!(foundIsl.isPresent() && foundReverceIsl.isPresent())) { return Optional.<List<Isl>>empty(); } Isl isl = foundIsl.get(); Isl reverceIsl = foundReverceIsl.get(); if (isl.isUnderMaintenance() == underMaintenance) { return Optional.of(Arrays.asList(isl, reverceIsl)); } isl.setUnderMaintenance(underMaintenance); reverceIsl.setUnderMaintenance(underMaintenance); return Optional.of(Arrays.asList(isl, reverceIsl)); }).orElseThrow(() -> new IslNotFoundException(srcSwitchId, srcPort, dstSwitchId, dstPort)); } LinkOperationsService(ILinkOperationsServiceCarrier carrier,
                                 RepositoryFactory repositoryFactory,
                                 TransactionManager transactionManager); List<Isl> updateLinkUnderMaintenanceFlag(SwitchId srcSwitchId, Integer srcPort,
                                                    SwitchId dstSwitchId, Integer dstPort,
                                                    boolean underMaintenance); Collection<Isl> getAllIsls(SwitchId srcSwitch, Integer srcPort,
                                      SwitchId dstSwitch, Integer dstPort); Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch,
                                     int destinationPort, boolean force); Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue);  }### Answer:
@Test public void shouldUpdateLinkUnderMaintenanceFlag() throws IslNotFoundException { createIsl(IslStatus.ACTIVE); for (int i = 0; i < 2; i++) { List<Isl> link = linkOperationsService .updateLinkUnderMaintenanceFlag(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT, TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT, true); assertEquals(2, link.size()); assertTrue(link.get(0).isUnderMaintenance()); assertTrue(link.get(1).isUnderMaintenance()); } for (int i = 0; i < 2; i++) { List<Isl> link = linkOperationsService .updateLinkUnderMaintenanceFlag(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT, TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT, false); assertEquals(2, link.size()); assertFalse(link.get(0).isUnderMaintenance()); assertFalse(link.get(1).isUnderMaintenance()); } }