Skip to content

Commit

Permalink
add property for unauffaellige tage cron to unittest yml
Browse files Browse the repository at this point in the history
  • Loading branch information
boal committed Feb 25, 2025
1 parent 39ed2b3 commit 0cf3ba0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public interface UnauffaelligeTageRepository extends JpaRepository<Unauffaellige

List<UnauffaelligerTag> findByMstId(final Integer mstId);

Optional<UnauffaelligerTag> findTopByOrderByDatumDesc();
Optional<UnauffaelligerTag> findTopByOrderByKalendertagDatumDesc();
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void loadMessstellenCron() {
* unauffälligen Tag gefunden wurde.
*/
protected List<UnauffaelligerTag> loadUnauffaelligeTageForEachMessstelle() {
final var unaufaelligerTag = unauffaelligeTageRepository.findTopByOrderByDatumDesc();
final var unaufaelligerTag = unauffaelligeTageRepository.findTopByOrderByKalendertagDatumDesc();
final var lastUnauffaelligerTag = unaufaelligerTag
.map(unauffaelligerTag -> unauffaelligerTag.getKalendertag().getDatum().plusDays(1))
.orElse(EARLIEST_DAY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void loadUnauffaelligeTageForEachMessstelleWithDataInDatabase() {
youngestSavedUnauffaelligerTag.setKalendertag(kalenderTagForYoungestSavedUnauffaelligerTag);
youngestSavedUnauffaelligerTag.setMstId(1234);

Mockito.when(unauffaelligeTageRepository.findTopByOrderByDatumDesc()).thenReturn(Optional.of(youngestSavedUnauffaelligerTag));
Mockito.when(unauffaelligeTageRepository.findTopByOrderByKalendertagDatumDesc()).thenReturn(Optional.of(youngestSavedUnauffaelligerTag));

final var unauffaelligeTage = new ArrayList<UnauffaelligerTagDto>();
var unauffaelligerTagDto = new UnauffaelligerTagDto();
Expand Down Expand Up @@ -157,7 +157,7 @@ void loadUnauffaelligeTageForEachMessstelleWithDataInDatabase() {

@Test
void loadUnauffaelligeTageForEachMessstelleWithoutDataInDatabase() {
Mockito.when(unauffaelligeTageRepository.findTopByOrderByDatumDesc()).thenReturn(Optional.empty());
Mockito.when(unauffaelligeTageRepository.findTopByOrderByKalendertagDatumDesc()).thenReturn(Optional.empty());

final var unauffaelligeTage = new ArrayList<UnauffaelligerTagDto>();
var unauffaelligerTagDto = new UnauffaelligerTagDto();
Expand Down
4 changes: 4 additions & 0 deletions src/test/resources/application-unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,8 @@ dave:
# disabled
cron: "-"
shedlock: 1m
unauffaellige-tage:
# disabled
cron: "-"
shedlock: 1m
stadtbezirk-mapping-config-url: ${STADTBEZIRK_MAPPING_CONFIG_URL:classpath:/config/stadtbezirke.properties}

0 comments on commit 0cf3ba0

Please sign in to comment.