-
Notifications
You must be signed in to change notification settings - Fork 54k
Testing with Mapstruct Mappers #18625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| MediaService testee = new MediaService(mockMediaMapper); | ||
| MediaDto mediaDto = new MediaDto(1L, "title 1"); | ||
| Media persisted = testee.persistMedia(mediaDto); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's put a blank line before and after this group of lines.
| assertEquals(persisted.getId(), mockedMedia.getId()); | ||
| assertEquals(persisted.getTitle(), mockedMedia.getTitle()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverse order of arguments - should be assertEquals(expected, actual)
| assertEquals(persisted.getId(), mediaDto.getId()); | ||
| assertEquals(persisted.getTitle(), mediaDto.getTitle()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swap arg order
| assertEquals(persisted.getId(), mockedMedia.getId()); | ||
| assertEquals(persisted.getTitle(), mockedMedia.getTitle()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swap args
|
|
||
| @Test | ||
| public void whenGeneratedMapperIsUsed_thenActualValuesAreMapped() { | ||
| MediaService testee = new MediaService(Mappers.getMapper(MediaMapper.class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just call it mediaService (not testee). Same for other tests.
No description provided.