Skip to content

Commit

Permalink
Merge pull request #220 from navikt/dev
Browse files Browse the repository at this point in the history
Add support for barn under 18 aar
  • Loading branch information
dragutin-nav authored Jun 26, 2023
2 parents 6a5cfb9 + e5d7209 commit c8769d6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>9.17.0</version>
<version>9.18.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-provider-jdbc-template</artifactId>
<version>5.2.0</version>
<version>5.3.0</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
Expand All @@ -217,7 +217,7 @@
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.10.6</version>
<version>1.11.0</version>
</dependency>

<!--TEST-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ public class PortefoljeFilter {

@JsonSetter(nulls = Nulls.AS_EMPTY)
private List<String> ensligeForsorgere = emptyList();

@JsonSetter(nulls = Nulls.AS_EMPTY)
private List<String> barnUnder18Aar = emptyList();

@JsonSetter(nulls = Nulls.AS_EMPTY)
private List<String> barnUnder18AarAlder = emptyList();

@JsonIgnore
public Boolean isNotEmpty() {
return (kjonn != null && !kjonn.isEmpty()) ||
Expand Down Expand Up @@ -145,6 +152,8 @@ public Boolean isNotEmpty() {
(visGeografiskBosted != null && !visGeografiskBosted.isEmpty()) ||
(geografiskBosted != null && !geografiskBosted.isEmpty()) ||
(avvik14aVedtak != null && !avvik14aVedtak.isEmpty()) ||
(ensligeForsorgere != null && !ensligeForsorgere.isEmpty());
(ensligeForsorgere != null && !ensligeForsorgere.isEmpty()) ||
(barnUnder18Aar != null && !barnUnder18Aar.isEmpty() ||
(barnUnder18AarAlder != null && !barnUnder18AarAlder.isEmpty()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void testDeserializationAndSettingDefaultValue() throws JsonProcessingExc
@Test
public void testSerializationOfEmptyFilter() throws JsonProcessingException {
String correctOutput = """
{"aktiviteter":null,"aktiviteterForenklet":[],"alder":[],"arbeidslisteKategori":[],"avvik14aVedtak":[],"cvJobbprofil":"","ensligeForsorgere":[],"ferdigfilterListe":[],"fodselsdagIMnd":[],"foedeland":[],"formidlingsgruppe":[],"geografiskBosted":[],"hovedmal":[],"innsatsgruppe":[],"kjonn":"","landgruppe":[],"manuellBrukerStatus":[],"navnEllerFnrQuery":"","registreringstype":[],"rettighetsgruppe":[],"servicegruppe":[],"sisteEndringKategori":[],"stillingFraNavFilter":[],"tiltakstyper":[],"tolkBehovSpraak":[],"tolkebehov":[],"ulesteEndringer":"","utdanning":[],"utdanningBestatt":[],"utdanningGodkjent":[],"veilederNavnQuery":"","veiledere":[],"visGeografiskBosted":[],"ytelse":""}""";
{"aktiviteter":null,"aktiviteterForenklet":[],"alder":[],"arbeidslisteKategori":[],"avvik14aVedtak":[],"barnUnder18Aar":[],"barnUnder18AarAlder":[],"cvJobbprofil":"","ensligeForsorgere":[],"ferdigfilterListe":[],"fodselsdagIMnd":[],"foedeland":[],"formidlingsgruppe":[],"geografiskBosted":[],"hovedmal":[],"innsatsgruppe":[],"kjonn":"","landgruppe":[],"manuellBrukerStatus":[],"navnEllerFnrQuery":"","registreringstype":[],"rettighetsgruppe":[],"servicegruppe":[],"sisteEndringKategori":[],"stillingFraNavFilter":[],"tiltakstyper":[],"tolkBehovSpraak":[],"tolkebehov":[],"ulesteEndringer":"","utdanning":[],"utdanningBestatt":[],"utdanningGodkjent":[],"veilederNavnQuery":"","veiledere":[],"visGeografiskBosted":[],"ytelse":""}""";
PortefoljeFilter portefoljeFilter = new PortefoljeFilter();
String jsonString = objectMapper.writeValueAsString(portefoljeFilter);
Assertions.assertEquals(jsonString, correctOutput);
Expand All @@ -108,10 +108,10 @@ public void testSerializationOfEmptyFilter() throws JsonProcessingException {
@Test
public void testSerializationOfVeiledere() throws JsonProcessingException {
String correctOutput = """
{"aktiviteter":null,"aktiviteterForenklet":null,"alder":null,"arbeidslisteKategori":null,"avvik14aVedtak":null,"cvJobbprofil":null,"ensligeForsorgere":null,"ferdigfilterListe":null,"fodselsdagIMnd":null,"foedeland":null,"formidlingsgruppe":null,"geografiskBosted":null,"hovedmal":null,"innsatsgruppe":null,"kjonn":null,"landgruppe":null,"manuellBrukerStatus":null,"navnEllerFnrQuery":null,"registreringstype":null,"rettighetsgruppe":null,"servicegruppe":null,"sisteEndringKategori":null,"stillingFraNavFilter":null,"tiltakstyper":null,"tolkBehovSpraak":null,"tolkebehov":null,"ulesteEndringer":null,"utdanning":null,"utdanningBestatt":null,"utdanningGodkjent":null,"veilederNavnQuery":null,"veiledere":["A123","B123"],"visGeografiskBosted":null,"ytelse":null}""";
{"aktiviteter":null,"aktiviteterForenklet":null,"alder":null,"arbeidslisteKategori":null,"avvik14aVedtak":null,"barnUnder18Aar":null,"barnUnder18AarAlder":null,"cvJobbprofil":null,"ensligeForsorgere":null,"ferdigfilterListe":null,"fodselsdagIMnd":null,"foedeland":null,"formidlingsgruppe":null,"geografiskBosted":null,"hovedmal":null,"innsatsgruppe":null,"kjonn":null,"landgruppe":null,"manuellBrukerStatus":null,"navnEllerFnrQuery":null,"registreringstype":null,"rettighetsgruppe":null,"servicegruppe":null,"sisteEndringKategori":null,"stillingFraNavFilter":null,"tiltakstyper":null,"tolkBehovSpraak":null,"tolkebehov":null,"ulesteEndringer":null,"utdanning":null,"utdanningBestatt":null,"utdanningGodkjent":null,"veilederNavnQuery":null,"veiledere":["A123","B123"],"visGeografiskBosted":null,"ytelse":null}""";
PortefoljeFilter portefoljeFilter = new PortefoljeFilter(null, null, null, null, null, null, null, null, null, null,
null, null, null, null, List.of("A123", "B123"), null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null,null, null, null, null);
null, null, null, null, null,null, null, null, null, null, null);
String jsonString = objectMapper.writeValueAsString(portefoljeFilter);
Assertions.assertEquals(jsonString, correctOutput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public PortefoljeFilter getRandomPortefoljeFilter() {
emptyList(), emptyList(), emptyList(), emptyList(), kjonnVelg.get(random.nextInt(1)), emptyList(),
String.valueOf(rndChar()), emptyList(), emptyList(), emptyList(), "", emptyList(), "", emptyList(), "",
emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), "", emptyList(), emptyList(), emptyList(),
emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList());
emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList());
}

private static char rndChar() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,6 @@ private NyttFilterModel getRandomNyttFilter(List<String> veiledersList) {
public PortefoljeFilter getRandomPortefoljeFilter(List<String> veiledersList) {
return new PortefoljeFilter(null, emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), "",
emptyList(), "", emptyList(), emptyList(), emptyList(), "", veiledersList, "", emptyList(), "", emptyList(),
emptyList(), emptyList(), emptyList(), emptyList(), "", emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList());
emptyList(), emptyList(), emptyList(), emptyList(), "", emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList());
}
}

0 comments on commit c8769d6

Please sign in to comment.