Skip to content

Commit

Permalink
#137 🎨
Browse files Browse the repository at this point in the history
  • Loading branch information
vjohnslhm committed Sep 13, 2024
1 parent 2115c8e commit f47b1f3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ void should_return_list_of_ereignis_entities_when_given_valid_wahlbezirkid() {
val result = unitUnderTest.findByWahlbezirkID(wahlbezirkID);

Assertions.assertThat(result.size()).isEqualTo(2);
Assertions.assertThat(result).filteredOn(ereignis -> ereignis.getWahlbezirkID().equals(wahlbezirkID));
Assertions.assertThat(result).noneMatch(ereignis -> ereignis.getWahlbezirkID().equals(wahlbezirkID2));
Assertions.assertThat(result).filteredOn(ereignis -> ereignis.getWahlbezirkID().equals(wahlbezirkID))
.noneMatch(ereignis -> ereignis.getWahlbezirkID().equals(wahlbezirkID2));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ void should_return_list_of_ereignis_entities_when_new_data_successfully_saved()
expectedSavedEreignisse.add(ereignis);
}
Assertions.assertThat(savedEreignisse.size()).isEqualTo(expectedSavedEreignisse.size());
Assertions.assertThat(savedEreignisse).filteredOn(ereignis -> ereignis.getClass().equals(Ereignis.class));
Assertions.assertThat(savedEreignisse).filteredOn(ereignis -> ereignis.getWahlbezirkID().equals(wahlbezirkID));
Assertions.assertThat(savedEreignisse).filteredOn(ereignis -> ereignis.getClass().equals(Ereignis.class))
.filteredOn(ereignis -> ereignis.getWahlbezirkID().equals(wahlbezirkID));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class EreignisDTOMapperTest {
private final EreignisDTOMapper unitUnderTest = Mappers.getMapper(EreignisDTOMapper.class);

@Test
void nullInNullOut() {
void should_return_null_when_given_null() {
Assertions.assertThat(unitUnderTest.toDTO(null)).isNull();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.util.ArrayList;
import java.util.List;
import lombok.val;
import org.apache.commons.collections.ArrayStack;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -62,14 +61,12 @@ void should_return_EreignisEntity_when_given_wahlbezirkID_and_EreignisModel() {
void should_return_list_of_EreignisEntities_when_given_EreignisseWriteModel() {
val wahlbezirkID = "wahlbezirkID";
List<EreignisModel> listOfEreignisModel = new ArrayList<>();
val model1 = TestdataFactory.createEreignisModelWithData("beschreibung", LocalDateTime.now(), Ereignisart.VORFALL);
val model2 = TestdataFactory.createEreignisModelWithData("beschreibung2", LocalDateTime.now(), Ereignisart.VORKOMMNIS);
val model1 = TestdataFactory.createEreignisModelWithData();
val model2 = TestdataFactory.createEreignisModelWithData();
listOfEreignisModel.add(model1);
listOfEreignisModel.add(model2);
val ereignisseWriteModel = TestdataFactory.createEreignisseWriteModelWithData(wahlbezirkID, listOfEreignisModel);
List<Ereignis> listOfEreignis = new ArrayStack();
List<Ereignis> listOfEreignis = new ArrayList<>();
listOfEreignis.add(TestdataFactory.createEreignisEntityFromModel(model1, wahlbezirkID));
listOfEreignis.add(TestdataFactory.createEreignisEntityFromModel(model2, wahlbezirkID));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import de.muenchen.oss.wahllokalsystem.wls.common.exception.TechnischeWlsException;
import de.muenchen.oss.wahllokalsystem.wls.common.security.BezirkIDPermissionEvaluator;
import de.muenchen.oss.wahllokalsystem.wls.common.testing.SecurityUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import lombok.val;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -27,11 +30,6 @@
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.context.ActiveProfiles;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

@SpringBootTest(classes = MicroServiceApplication.class)
@ActiveProfiles(TestConstants.SPRING_TEST_PROFILE)
public class EreignisServiceSecurityTest {
Expand Down

0 comments on commit f47b1f3

Please sign in to comment.