Skip to content

Commit

Permalink
enrich test
Browse files Browse the repository at this point in the history
Signed-off-by: Thang PHAM <[email protected]>
  • Loading branch information
thangqp committed Nov 12, 2024
1 parent 184fd12 commit c66775e
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package org.gridsuite.dynamicsecurityanalysis.server.service;

import org.gridsuite.dynamicsecurityanalysis.server.DynamicSecurityAnalysisException;
import org.gridsuite.dynamicsecurityanalysis.server.dto.DynamicSecurityAnalysisStatus;
import org.gridsuite.dynamicsecurityanalysis.server.entities.DynamicSecurityAnalysisResultEntity;
import org.gridsuite.dynamicsecurityanalysis.server.repositories.DynamicSecurityAnalysisResultRepository;
Expand All @@ -22,6 +23,8 @@
import java.util.UUID;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowableOfType;
import static org.gridsuite.dynamicsecurityanalysis.server.DynamicSecurityAnalysisException.Type.RESULT_UUID_NOT_FOUND;

/**
* @author Thang PHAM <quyet-thang.pham at rte-france.com>
Expand Down Expand Up @@ -82,6 +85,10 @@ void testCrud() {
Optional<DynamicSecurityAnalysisResultEntity> foundResultEntity = resultRepository.findById(resultUuid);
assertThat(foundResultEntity).isNotPresent();

// --- get status of a deleted entity --- //
DynamicSecurityAnalysisException exception = catchThrowableOfType(() -> dynamicSecurityAnalysisResultService.findStatus(resultUuid), DynamicSecurityAnalysisException.class);
assertThat(exception.getType()).isEqualTo(RESULT_UUID_NOT_FOUND);

// --- delete all --- //
LOGGER.info("Test delete all results");
resultRepository.saveAllAndFlush(List.of(
Expand Down

0 comments on commit c66775e

Please sign in to comment.