Skip to content
Snippets Groups Projects
Commit ef9612eb authored by Krzysztof Witukiewicz's avatar Krzysztof Witukiewicz
Browse files

OZG-7262 OZG-7584 Do not test individual fields

parent 07454fa4
Branches
Tags
1 merge request!6Ozg 7262 attarchments not null
...@@ -150,62 +150,8 @@ class KommentarMapperTest { ...@@ -150,62 +150,8 @@ class KommentarMapperTest {
@BeforeEach @BeforeEach
void init() { void init() {
doReturn(KommentarTestFactory.ID).when(mapper).mapObjectToString(KommentarTestFactory.ID); when(timeMapper.parseString(any())).thenReturn(KommentarTestFactory.CREATED_AT);
doReturn(KommentarTestFactory.TEXT).when(mapper).mapObjectToString(KommentarTestFactory.TEXT); when(attachmentMapper.mapAttachments(anyList())).thenReturn(KommentarTestFactory.ATTACHMENTS);
doReturn(KommentarTestFactory.CREATED_BY).when(mapper).mapObjectToString(KommentarTestFactory.CREATED_BY);
doReturn(KommentarTestFactory.CREATED_AT_STR).when(mapper).mapObjectToString(KommentarTestFactory.CREATED_AT_STR);
when(timeMapper.parseString(KommentarTestFactory.CREATED_AT_STR)).thenReturn(KommentarTestFactory.CREATED_AT);
when(attachmentMapper.mapAttachments(argThat(this::isCollectionOfAttachmentIds))).thenReturn(KommentarTestFactory.ATTACHMENTS);
}
@Test
void shouldMapIdToString() {
callMapper();
verify(mapper).mapObjectToString(KommentarTestFactory.ID);
}
@Test
void shouldMapId() {
var kommentar = callMapper();
assertThat(kommentar.getId()).isEqualTo(KommentarTestFactory.ID);
}
@Test
void shouldMapTextToString() {
callMapper();
verify(mapper).mapObjectToString(KommentarTestFactory.TEXT);
}
@Test
void shouldMapText() {
var kommentar = callMapper();
assertThat(kommentar.getText()).isEqualTo(KommentarTestFactory.TEXT);
}
@Test
void shouldMapCreatedByToString() {
callMapper();
verify(mapper).mapObjectToString(KommentarTestFactory.CREATED_BY);
}
@Test
void shouldMapCreatedBy() {
var kommentar = callMapper();
assertThat(kommentar.getCreatedBy()).isEqualTo(KommentarTestFactory.CREATED_BY);
}
@Test
void shouldMapCreatedAtToString() {
callMapper();
verify(mapper).mapObjectToString(KommentarTestFactory.CREATED_AT_STR);
} }
@Test @Test
...@@ -215,13 +161,6 @@ class KommentarMapperTest { ...@@ -215,13 +161,6 @@ class KommentarMapperTest {
verify(timeMapper).parseString(KommentarTestFactory.CREATED_AT_STR); verify(timeMapper).parseString(KommentarTestFactory.CREATED_AT_STR);
} }
@Test
void shouldMapCreatedAt() {
var kommentar = callMapper();
assertThat(kommentar.getCreatedAt()).isEqualTo(KommentarTestFactory.CREATED_AT);
}
@Test @Test
void shouldCallAttachmentMapper() { void shouldCallAttachmentMapper() {
callMapper(); callMapper();
...@@ -230,10 +169,10 @@ class KommentarMapperTest { ...@@ -230,10 +169,10 @@ class KommentarMapperTest {
} }
@Test @Test
void shouldMapAttachments() { void shouldMapAllFields() {
var kommentar = callMapper(); var kommentar = mapper.mapItemMapToKommentar(GrpcKommentarTestFactory.createItemAsMap());
assertThat(kommentar.getAttachments()).containsExactlyElementsOf(KommentarTestFactory.ATTACHMENTS); assertThat(kommentar).usingRecursiveComparison().isEqualTo(KommentarTestFactory.create());
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment