这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@maenolis
Copy link
Contributor

No description provided.

@maenolis maenolis changed the title minor Testing with Mapstruct Mappers Jun 12, 2025
Comment on lines 22 to 24
MediaService testee = new MediaService(mockMediaMapper);
MediaDto mediaDto = new MediaDto(1L, "title 1");
Media persisted = testee.persistMedia(mediaDto);
Copy link
Collaborator

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.

Comment on lines 26 to 27
assertEquals(persisted.getId(), mockedMedia.getId());
assertEquals(persisted.getTitle(), mockedMedia.getTitle());
Copy link
Collaborator

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)

Comment on lines 26 to 27
assertEquals(persisted.getId(), mediaDto.getId());
assertEquals(persisted.getTitle(), mediaDto.getTitle());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swap arg order

Comment on lines 36 to 37
assertEquals(persisted.getId(), mockedMedia.getId());
assertEquals(persisted.getTitle(), mockedMedia.getTitle());
Copy link
Collaborator

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));
Copy link
Collaborator

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.

@davidmartinezbarua davidmartinezbarua merged commit 2961038 into eugenp:master Jul 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants