Skip to content

Commit

Permalink
#405 fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vjohnslhm committed Sep 13, 2024
1 parent 7512eff commit 7f1b6e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ void accessDeniedWhenServiceAuthorityIsMissing() {
}

@Test
void fachlicheWlsExceptionWhenRepoAuthorityIsMissing() {
void technischeWlsExceptionWhenRepoAuthorityIsMissing() {
SecurityUtils.runWith(Authorities.SERVICE_POST_WAHLEN);
val wahltagID = "wahltagID";
List<WahlModel> mockedListOfModels = createWahlModels();
val wahlenToWrite = new WahlenWriteModel(wahltagID, mockedListOfModels);

Assertions.assertThatThrownBy(() -> wahlenService.postWahlen(wahlenToWrite)).isInstanceOf(
FachlicheWlsException.class);
TechnischeWlsException.class);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import de.muenchen.oss.wahllokalsystem.basisdatenservice.exception.ExceptionConstants;
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltagModel;
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltageService;
import de.muenchen.oss.wahllokalsystem.wls.common.exception.FachlicheWlsException;
import de.muenchen.oss.wahllokalsystem.wls.common.exception.TechnischeWlsException;
import de.muenchen.oss.wahllokalsystem.wls.common.exception.util.ExceptionFactory;
import java.time.LocalDate;
import java.util.ArrayList;
Expand Down Expand Up @@ -116,11 +116,11 @@ void wlsExceptionWhenSavingFailed() {
val wahlenToWrite = new WahlenWriteModel(wahltagID, mockedListOfModels);

val mockedRepoSaveException = new RuntimeException("saving failed");
val mockedWlsException = FachlicheWlsException.withCode("").buildWithMessage("");
val mockedWlsException = TechnischeWlsException.withCode("").buildWithMessage("");

Mockito.when(wahlModelMapper.fromListOfWahlModeltoListOfWahlEntities(mockedListOfModels)).thenReturn(mockedListOfEntities);
Mockito.doThrow(mockedRepoSaveException).when(wahlRepository).saveAll(mockedListOfEntities);
Mockito.when(exceptionFactory.createFachlicheWlsException(ExceptionConstants.POSTWAHLEN_UNSAVEABLE))
Mockito.when(exceptionFactory.createTechnischeWlsException(ExceptionConstants.POSTWAHLEN_UNSAVEABLE))
.thenReturn(mockedWlsException);

Assertions.assertThatThrownBy(() -> unitUnderTest.postWahlen(wahlenToWrite)).isSameAs(mockedWlsException);
Expand Down

0 comments on commit 7f1b6e8

Please sign in to comment.