Skip to content

Commit

Permalink
Increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
salander85 committed Nov 29, 2023
1 parent 07908ac commit 68a4953
Showing 1 changed file with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,27 @@ void mapToStateDrafts_WithMissingRequiredFields_ShouldNotFailAndReturnEmptyDraft
final State mockState = mock(State.class);
when(mockState.getTransitions()).thenReturn(null);

// test
final List<StateDraft> referenceReplacedDrafts =
StateReferenceResolutionUtils.mapToStateDrafts(List.of(mockState), referenceIdToKeyCache);

assertThat(referenceReplacedDrafts.get(0)).isEqualTo(StateDraft.of());
// asserts
assertThat(
StateReferenceResolutionUtils.mapToStateDrafts(
List.of(mockState), referenceIdToKeyCache)
.get(0))
.isEqualTo(StateDraft.of());

when(mockState.getKey()).thenReturn("Any key");
assertThat(
StateReferenceResolutionUtils.mapToStateDrafts(
List.of(mockState), referenceIdToKeyCache)
.get(0))
.isEqualTo(StateDraft.of());

when(mockState.getKey()).thenReturn(null);
when(mockState.getType()).thenReturn(StateTypeEnum.LINE_ITEM_STATE);
assertThat(
StateReferenceResolutionUtils.mapToStateDrafts(
List.of(mockState), referenceIdToKeyCache)
.get(0))
.isEqualTo(StateDraft.of());
}

@Nonnull
Expand Down

0 comments on commit 68a4953

Please sign in to comment.