Jean-Francois Leveque

Correction minimale du test avec l'ActionType.

......@@ -80,24 +80,27 @@ public class PublisherServiceSpringTest {
@DisplayName("Test validation version éditeur")
@Test
public void testValidateVersion(@Mock PublisherActionRepository publisherActionRepository) {
public void testValidateVersion(@Mock PublisherActionRepository publisherActionRepository,
@Mock ActionTypeRepository actionTypeRepository) {
Set<PublisherVersion> publisherVersions;
ActionType actionType = new ActionType();
publisher = new Publisher();
publisherVersion = new PublisherVersion();
publisherVersions = new HashSet<PublisherVersion>();
publisherVersions.add(publisherVersion);
publisherVersions.add(publisherVersionMock);
when(publisherVersionMock.getPublisher()).thenReturn(publisher);
when(actionTypeRepository.findByActionTypeName("Validate")).thenReturn(actionType);
PublisherAction publisherAction;
publisherAction = publisherServiceSpring.validatePublisherVersion(publisherVersionMock);
verify(publisherActionRepository).save(publisherAction);
assertThat(publisherAction.getPublisherVersion()).isEqualTo(publisherVersionMock);
assertThat(publisherAction.getPublisher()).isEqualTo(publisher);
assertThat(publisherAction.getPublisher().getValidatedVersion()).isEqualTo(publisherVersionMock);
// TODO Régler ce problème de NPE
// assertThat(publisherAction.getActionType()).isEqualTo(actionTypeRepository.findByActionTypeName("Validate"));
assertThat(publisherAction.getActionType()).isEqualTo(actionType);
}
}
......