Skip to content

Commit

Permalink
Fix tests (mock) for SupervisionControllerTest.java
Browse files Browse the repository at this point in the history
Signed-off-by: Slimane AMAR <[email protected]>
  • Loading branch information
Slimane AMAR committed Feb 26, 2025
1 parent 2ee4bed commit 524fe29
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SupervisionControllerTest {
private static final UUID STUDY_UUID = UUID.randomUUID();
private static final UUID NODE_UUID = UUID.randomUUID();

@MockBean
@Autowired
private NetworkModificationTreeService networkModificationTreeService;

@MockBean
Expand All @@ -87,9 +87,6 @@ class SupervisionControllerTest {
@SpyBean
private RootNetworkService rootNetworkService;

@Autowired
private StudyService studyService;

@Autowired
private RestClient restClient;

Expand Down Expand Up @@ -125,15 +122,13 @@ void setup() {
Network network = new XMLImporter().importData(dataSource, new NetworkFactoryImpl(), null);
network.getIdentifiables().forEach(idable -> equipmentInfosService.addEquipmentInfos(toEquipmentInfos(idable)));

//TODO: removing it still works, check if it's normal
// when(networkModificationTreeService.getVariantId(NODE_UUID, any())).thenReturn(VariantManagerConstants.INITIAL_VARIANT_ID);
when(networkModificationTreeService.getStudyTree(STUDY_UUID, null)).thenReturn(RootNode.builder().studyId(STUDY_UUID).id(NODE_UUID).build());
when(networkConversionService.checkStudyIndexationStatus(NETWORK_UUID)).thenReturn(true);
}

@AfterEach
void tearDown() {
equipmentInfosService.deleteAllByNetworkUuid(NETWORK_UUID);
studyRepository.findAll().forEach(s -> networkModificationTreeService.doDeleteTree(s.getId()));
studyRepository.deleteAll();
}

Expand Down

0 comments on commit 524fe29

Please sign in to comment.