JR Utily

remove Spring from implementations names

......@@ -19,7 +19,7 @@ import java.util.Set;
*/
@Stateless
public class PublisherServiceSpring implements PublisherService {
public class PublisherServiceDefault implements PublisherService {
Logger logger = LoggerFactory.getLogger(getClass());
PublisherRepository publisherRepository;
......@@ -29,11 +29,11 @@ public class PublisherServiceSpring implements PublisherService {
SharedService sharedService;
@Inject
public PublisherServiceSpring(PublisherRepository publisherRepository,
PublisherVersionRepository publisherVersionRepository,
PublisherActionRepository publisherActionRepository,
PublisherSearchRepository publisherSearchRepository,
SharedService sharedService) {
public PublisherServiceDefault(PublisherRepository publisherRepository,
PublisherVersionRepository publisherVersionRepository,
PublisherActionRepository publisherActionRepository,
PublisherSearchRepository publisherSearchRepository,
SharedService sharedService) {
this.publisherRepository = publisherRepository;
this.publisherVersionRepository = publisherVersionRepository;
this.publisherActionRepository = publisherActionRepository;
......@@ -42,7 +42,7 @@ public class PublisherServiceSpring implements PublisherService {
}
//no args constructor to make it proxyable
PublisherServiceSpring() {
PublisherServiceDefault() {
}
public PublisherVersion addNewPublisher(PublisherVersion publisherVersion) {
......
......@@ -8,7 +8,7 @@ import javax.inject.Inject;
import java.util.List;
@Stateless
public class UserServiceSpring implements UserService {
public class UserServiceDefault implements UserService {
@Inject
AccountRepository accountRepository;
......
......@@ -12,7 +12,7 @@ import java.util.Random;
import java.util.Vector;
@Stateless
public class SharedServiceSpring implements SharedService {
public class SharedServiceDefault implements SharedService {
CountryRepository countryRepository;
AccountRoleRepository accountRoleRepository;
......@@ -20,8 +20,8 @@ public class SharedServiceSpring implements SharedService {
UserService userService;
@Inject
public SharedServiceSpring(CountryRepository countryRepository, AccountRoleRepository accountRoleRepository,
AccountPropertyRepository accountPropertyRepository, UserService userService) {
public SharedServiceDefault(CountryRepository countryRepository, AccountRoleRepository accountRoleRepository,
AccountPropertyRepository accountPropertyRepository, UserService userService) {
this.countryRepository = countryRepository;
this.accountRoleRepository = accountRoleRepository;
this.accountPropertyRepository = accountPropertyRepository;
......
......@@ -14,24 +14,21 @@ import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.Mockito;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.*;
/**
* Classe testant PublisherServiceSpring.
* Classe testant PublisherServiceDefault.
*/
@RunWith(JUnitPlatform.class)
@ExtendWith(MockitoExtension.class)
@DisplayName("Service layer for all publisher-related data")
public class PublisherServiceSpringTest {
public class PublisherServiceDefaultTest {
PublisherServiceSpring publisherServiceSpring;
PublisherServiceDefault publisherServiceDefault;
PublisherVersion publisherVersion;
PublisherVersion publisherVersion1;
Publisher publisher;
......@@ -50,7 +47,7 @@ public class PublisherServiceSpringTest {
@Mock PublisherActionRepository publisherActionRepository,
@Mock PublisherSearchRepository publisherSearchRepository,
@Mock SharedService sharedService) throws Exception {
publisherServiceSpring = new PublisherServiceSpring(publisherRepository,
publisherServiceDefault = new PublisherServiceDefault(publisherRepository,
publisherVersionRepository, publisherActionRepository, publisherSearchRepository, sharedService);
publisherVersion = new PublisherVersion();
publisherVersion1 = new PublisherVersion();
......@@ -60,7 +57,7 @@ public class PublisherServiceSpringTest {
@DisplayName("When a new publisher is added, both Publisher and PublisherVersion should be saved in the right state")
@Test
public void testAddNewPublisher(@Mock PublisherVersionRepository publisherVersionRepository) {
publisherServiceSpring.addNewPublisher(publisherVersion);
publisherServiceDefault.addNewPublisher(publisherVersion);
publisher = publisherVersion.getPublisher();
assertThat(publisher.getVersions()).containsExactly(publisherVersion);
assertThat(publisherVersion.getPublisher()).isEqualTo(publisher);
......@@ -72,9 +69,9 @@ public class PublisherServiceSpringTest {
@Test
public void testAddVersionToPublisher(@Mock PublisherRepository publisherRepository,
@Mock PublisherVersionRepository publisherVersionRepository) {
publisherServiceSpring.addNewPublisher(publisherVersion);
publisherServiceDefault.addNewPublisher(publisherVersion);
publisher = publisherVersion.getPublisher();
publisherServiceSpring.addVersionToPublisher(publisher, publisherVersion1);
publisherServiceDefault.addVersionToPublisher(publisher, publisherVersion1);
assertThat(publisherVersion1.getPublisher()).isEqualTo(publisher);
assertThat(publisher.getVersions()).contains(publisherVersion, publisherVersion1);
verify(publisherRepository, times(2)).save(publisher);
......@@ -94,7 +91,7 @@ public class PublisherServiceSpringTest {
publisher.setVersions(publisherVersions);
when(publisherVersionMock.getPublisher()).thenReturn(publisher);
publisherServiceSpring.validatePublisherVersion(publisherVersionMock);
publisherServiceDefault.validatePublisherVersion(publisherVersionMock);
assertThat(publisher.getValidatedVersion()).isEqualTo(publisherVersionMock);
}
......@@ -108,7 +105,7 @@ public class PublisherServiceSpringTest {
when(publisherVersionMock.getPublisher()).thenReturn(publisher);
when(publisherVersionMock.getPublisherName()).thenReturn("nom");
when(publisherVersionMock.getPublisherHistory()).thenReturn("histoire");
publisherServiceSpring.validatePublisherVersion(publisherVersionMock);
publisherServiceDefault.validatePublisherVersion(publisherVersionMock);
try {
Mockito.verify(publisherSearchRepository).save(indexedPublisherArgumentCaptor.capture());
} catch (IndexingException e) {
......@@ -129,7 +126,7 @@ public class PublisherServiceSpringTest {
publisher = new Publisher();
when(publisherVersionMock.getPublisher()).thenReturn(publisher);
publisherAction = publisherServiceSpring.validatePublisherVersion(publisherVersionMock);
publisherAction = publisherServiceDefault.validatePublisherVersion(publisherVersionMock);
verify(publisherActionRepository).save(publisherAction);
assertThat(publisherAction.getPublisherVersion()).isEqualTo(publisherVersionMock);
assertThat(publisherAction.getPublisher()).isEqualTo(publisher);
......