Skip to content

Commit

Permalink
Legger til validering for tomme strenger i historikktekstlinje builder
Browse files Browse the repository at this point in the history
  • Loading branch information
palfi committed Jan 9, 2025
1 parent b78b3e8 commit 021821f
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ private static HistorikkinnslagLinjeBuilder linjeskift() {

public HistorikkinnslagLinjeBuilder bold(String b) {
Objects.requireNonNull(b);
if (b.isEmpty()) {
throw new IllegalArgumentException("Tekst kan ikke være tom");
}
stringBuilder.append(" ").append(BOLD_MARKØR).append(b).append(BOLD_MARKØR);
return this;
}
Expand All @@ -42,6 +45,9 @@ public HistorikkinnslagLinjeBuilder bold(LocalDate dato) {

public HistorikkinnslagLinjeBuilder tekst(String t) {
Objects.requireNonNull(t);
if (t.isEmpty()) {
throw new IllegalArgumentException("Tekst kan ikke være tom");
}
stringBuilder.append(" ").append(t);
return this;
}
Expand Down

0 comments on commit 021821f

Please sign in to comment.