From 3e83d949830081b65a952e728e93598e26cb4e1b Mon Sep 17 00:00:00 2001 From: Dennis Labordus Date: Tue, 15 Nov 2022 07:55:38 +0100 Subject: [PATCH] Remove code (times(1)) that is not needed in test files. Signed-off-by: Dennis Labordus --- .../v1/CompasSclDataResourceAsEditorTest.java | 16 +++---- .../v1/CompasSclDataResourceAsReaderTest.java | 8 ++-- .../event/CompasSclDataEventHandlerTest.java | 35 ++++++++-------- ...asSclCreateServerEndpointAsEditorTest.java | 5 ++- ...ompasSclGetServerEndpointAsEditorTest.java | 5 ++- ...ompasSclGetServerEndpointAsReaderTest.java | 5 ++- ...lGetVersionServerEndpointAsEditorTest.java | 5 ++- ...lGetVersionServerEndpointAsReaderTest.java | 5 ++- ...asSclUpdateServerEndpointAsEditorTest.java | 5 ++- .../service/CompasSclDataServiceTest.java | 42 +++++++++---------- 10 files changed, 69 insertions(+), 62 deletions(-) diff --git a/app/src/test/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResourceAsEditorTest.java b/app/src/test/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResourceAsEditorTest.java index ecf8a151..34dc5252 100644 --- a/app/src/test/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResourceAsEditorTest.java +++ b/app/src/test/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResourceAsEditorTest.java @@ -69,7 +69,7 @@ void list_WhenCalled_ThenItemResponseRetrieved() { assertEquals(name, xmlPath.get("ListResponse.Item[0].Name")); assertEquals(version, xmlPath.get("ListResponse.Item[0].Version")); assertEquals(labels.get(0), xmlPath.get("ListResponse.Item[0].Label")); - verify(compasSclDataService, times(1)).list(type); + verify(compasSclDataService).list(type); } @Test @@ -95,7 +95,7 @@ void listVersionsByUUID_WhenCalled_ThenItemResponseRetrieved() { assertEquals(uuid.toString(), xmlPath.get("VersionsResponse.HistoryItem[0].Id")); assertEquals(name, xmlPath.get("VersionsResponse.HistoryItem[0].Name")); assertEquals(version, xmlPath.get("VersionsResponse.HistoryItem[0].Version")); - verify(compasSclDataService, times(1)).listVersionsByUUID(type, uuid); + verify(compasSclDataService).listVersionsByUUID(type, uuid); } @Test @@ -118,7 +118,7 @@ void findByUUID_WhenCalled_ThenSCLResponseRetrieved() throws IOException { var xmlPath = response.xmlPath() .using(xmlPathConfig().declaredNamespace("scl", SCL_NS_URI)); assertEquals(scl, xmlPath.get("GetWsResponse.SclData")); - verify(compasSclDataService, times(1)).findByUUID(type, uuid); + verify(compasSclDataService).findByUUID(type, uuid); } @Test @@ -143,7 +143,7 @@ void findByUUIDAndVersion_WhenCalled_ThenSCLResponseRetrieved() throws IOExcepti var xmlPath = response.xmlPath() .using(xmlPathConfig().declaredNamespace("scl", SCL_NS_URI)); assertEquals(scl, xmlPath.get("GetWsResponse.SclData")); - verify(compasSclDataService, times(1)).findByUUID(type, uuid, version); + verify(compasSclDataService).findByUUID(type, uuid, version); } @Test @@ -171,7 +171,7 @@ void create_WhenCalled_ThenServiceCalledAndUUIDRetrieved() throws IOException { .response(); assertEquals(scl, response.xmlPath().getString("CreateWsResponse.SclData")); - verify(compasSclDataService, times(1)).create(type, name, USERNAME, comment, scl); + verify(compasSclDataService).create(type, name, USERNAME, comment, scl); } @Test @@ -228,7 +228,7 @@ void update_WhenCalled_ThenServiceCalledAndNewUUIDRetrieved() throws IOException .response(); assertEquals(scl, response.xmlPath().getString("CreateWsResponse.SclData")); - verify(compasSclDataService, times(1)).update(type, uuid, changeSetType, USERNAME, comment, scl); + verify(compasSclDataService).update(type, uuid, changeSetType, USERNAME, comment, scl); } @Test @@ -245,7 +245,7 @@ void deleteAll_WhenCalled_ThenServiceCalled() { .then() .statusCode(204); - verify(compasSclDataService, times(1)).delete(type, uuid); + verify(compasSclDataService).delete(type, uuid); } @Test @@ -264,7 +264,7 @@ void deleteVersion_WhenCalled_ThenServiceCalled() { .then() .statusCode(204); - verify(compasSclDataService, times(1)).delete(type, uuid, version); + verify(compasSclDataService).delete(type, uuid, version); } private String readSCL() throws IOException { diff --git a/app/src/test/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResourceAsReaderTest.java b/app/src/test/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResourceAsReaderTest.java index 0b400983..3a4a86b4 100644 --- a/app/src/test/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResourceAsReaderTest.java +++ b/app/src/test/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResourceAsReaderTest.java @@ -61,7 +61,7 @@ void list_WhenCalled_ThenItemResponseRetrieved() { assertEquals(name, xmlPath.get("ListResponse.Item[0].Name")); assertEquals(version, xmlPath.get("ListResponse.Item[0].Version")); assertEquals(labels.get(0), xmlPath.get("ListResponse.Item[0].Label")); - verify(compasSclDataService, times(1)).list(type); + verify(compasSclDataService).list(type); } @Test @@ -87,7 +87,7 @@ void listVersionsByUUID_WhenCalled_ThenItemResponseRetrieved() { assertEquals(uuid.toString(), xmlPath.get("VersionsResponse.HistoryItem[0].Id")); assertEquals(name, xmlPath.get("VersionsResponse.HistoryItem[0].Name")); assertEquals(version, xmlPath.get("VersionsResponse.HistoryItem[0].Version")); - verify(compasSclDataService, times(1)).listVersionsByUUID(type, uuid); + verify(compasSclDataService).listVersionsByUUID(type, uuid); } @Test @@ -110,7 +110,7 @@ void findByUUID_WhenCalled_ThenSCLResponseRetrieved() throws IOException { var xmlPath = response.xmlPath() .using(xmlPathConfig().declaredNamespace("scl", SCL_NS_URI)); assertEquals(scl, xmlPath.get("GetWsResponse.SclData")); - verify(compasSclDataService, times(1)).findByUUID(type, uuid); + verify(compasSclDataService).findByUUID(type, uuid); } @Test @@ -135,7 +135,7 @@ void findByUUIDAndVersion_WhenCalled_ThenSCLResponseRetrieved() throws IOExcepti var xmlPath = response.xmlPath() .using(xmlPathConfig().declaredNamespace("scl", SCL_NS_URI)); assertEquals(scl, xmlPath.get("GetWsResponse.SclData")); - verify(compasSclDataService, times(1)).findByUUID(type, uuid, version); + verify(compasSclDataService).findByUUID(type, uuid, version); } @Test diff --git a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/event/CompasSclDataEventHandlerTest.java b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/event/CompasSclDataEventHandlerTest.java index bebcec22..39f9192d 100644 --- a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/event/CompasSclDataEventHandlerTest.java +++ b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/event/CompasSclDataEventHandlerTest.java @@ -31,7 +31,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.lfenergy.compas.core.commons.exception.CompasErrorCode.WEBSOCKET_GENERAL_ERROR_CODE; import static org.lfenergy.compas.scl.data.exception.CompasSclDataServiceErrorCode.DUPLICATE_SCL_NAME_ERROR_CODE; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) class CompasSclDataEventHandlerTest { @@ -57,7 +58,7 @@ void createWebsocketsEvent_WhenCalled_ThenCreateResponseReturned() { var response = verifyResponse(session, CreateWsResponse.class); assertEquals(sclData, response.getSclData()); - verify(service, times(1)).create(type, name, who, comment, sclData); + verify(service).create(type, name, who, comment, sclData); } @Test @@ -77,7 +78,7 @@ void createWebsocketsEvent_WhenCalledAndCompasExceptionThrownByService_ThenError eventHandler.createWebsocketsEvent(request); verifyErrorResponse(session, DUPLICATE_SCL_NAME_ERROR_CODE, errorMessage); - verify(service, times(1)).create(type, name, who, comment, sclData); + verify(service).create(type, name, who, comment, sclData); } @Test @@ -96,7 +97,7 @@ void createWebsocketsEvent_WhenCalledAndRuntimeExceptionThrownByService_ThenErro eventHandler.createWebsocketsEvent(request); verifyErrorResponse(session, WEBSOCKET_GENERAL_ERROR_CODE, errorMessage); - verify(service, times(1)).create(type, name, who, comment, sclData); + verify(service).create(type, name, who, comment, sclData); } @Test @@ -113,7 +114,7 @@ void getWebsocketsEvent_WhenCalled_ThenGetResponseReturned() { var response = verifyResponse(session, GetWsResponse.class); assertEquals(sclData, response.getSclData()); - verify(service, times(1)).findByUUID(type, id); + verify(service).findByUUID(type, id); } @Test @@ -130,7 +131,7 @@ void getWebsocketsEvent_WhenCalledAndCompasExceptionThrownByService_ThenErrorRes eventHandler.getWebsocketsEvent(request); verifyErrorResponse(session, DUPLICATE_SCL_NAME_ERROR_CODE, errorMessage); - verify(service, times(1)).findByUUID(type, id); + verify(service).findByUUID(type, id); } @Test @@ -146,7 +147,7 @@ void getWebsocketsEvent_WhenCalledAndRuntimeExceptionThrownByService_ThenErrorRe eventHandler.getWebsocketsEvent(request); verifyErrorResponse(session, WEBSOCKET_GENERAL_ERROR_CODE, errorMessage); - verify(service, times(1)).findByUUID(type, id); + verify(service).findByUUID(type, id); } @Test @@ -164,7 +165,7 @@ void getVersionWebsocketsEvent_WhenCalled_ThenGetResponseReturned() { var response = verifyResponse(session, GetWsResponse.class); assertEquals(sclData, response.getSclData()); - verify(service, times(1)).findByUUID(type, id, version); + verify(service).findByUUID(type, id, version); } @Test @@ -182,7 +183,7 @@ void getVersionWebsocketsEvent_WhenCalledAndCompasExceptionThrownByService_ThenE eventHandler.getVersionWebsocketsEvent(request); verifyErrorResponse(session, DUPLICATE_SCL_NAME_ERROR_CODE, errorMessage); - verify(service, times(1)).findByUUID(type, id, version); + verify(service).findByUUID(type, id, version); } @Test @@ -199,7 +200,7 @@ void getVersionWebsocketsEvent_WhenCalledAndRuntimeExceptionThrownByService_Then eventHandler.getVersionWebsocketsEvent(request); verifyErrorResponse(session, WEBSOCKET_GENERAL_ERROR_CODE, errorMessage); - verify(service, times(1)).findByUUID(type, id, version); + verify(service).findByUUID(type, id, version); } @Test @@ -219,7 +220,7 @@ void updateWebsocketsEvent_WhenCalled_ThenUpdateResponseReturned() { var response = verifyResponse(session, UpdateWsResponse.class); assertEquals(sclData, response.getSclData()); - verify(service, times(1)).update(type, id, cst, who, comment, sclData); + verify(service).update(type, id, cst, who, comment, sclData); } @Test @@ -240,7 +241,7 @@ void updateWebsocketsEvent_WhenCalledAndCompasExceptionThrownByService_ThenError eventHandler.updateWebsocketsEvent(request); verifyErrorResponse(session, DUPLICATE_SCL_NAME_ERROR_CODE, errorMessage); - verify(service, times(1)).update(type, id, cst, who, comment, sclData); + verify(service).update(type, id, cst, who, comment, sclData); } @Test @@ -260,7 +261,7 @@ void updateWebsocketsEvent_WhenCalledAndRuntimeExceptionThrownByService_ThenErro eventHandler.updateWebsocketsEvent(request); verifyErrorResponse(session, WEBSOCKET_GENERAL_ERROR_CODE, errorMessage); - verify(service, times(1)).update(type, id, cst, who, comment, sclData); + verify(service).update(type, id, cst, who, comment, sclData); } private Session mockSession() { @@ -271,16 +272,16 @@ private Session mockSession() { } private T verifyResponse(Session session, Class responseClass) { - verify(session, times(1)).getAsyncRemote(); + verify(session).getAsyncRemote(); ArgumentCaptor captor = ArgumentCaptor.forClass(responseClass); - verify(session.getAsyncRemote(), times(1)).sendObject(captor.capture()); + verify(session.getAsyncRemote()).sendObject(captor.capture()); return captor.getValue(); } private void verifyErrorResponse(Session session, String errorCode, String errorMessage) { - verify(session, times(1)).getAsyncRemote(); + verify(session).getAsyncRemote(); ArgumentCaptor captor = ArgumentCaptor.forClass(ErrorResponse.class); - verify(session.getAsyncRemote(), times(1)).sendObject(captor.capture()); + verify(session.getAsyncRemote()).sendObject(captor.capture()); var response = captor.getValue(); assertEquals(1, response.getErrorMessages().size()); var message = response.getErrorMessages().get(0); diff --git a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclCreateServerEndpointAsEditorTest.java b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclCreateServerEndpointAsEditorTest.java index 51c786c2..eabfa8e1 100644 --- a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclCreateServerEndpointAsEditorTest.java +++ b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclCreateServerEndpointAsEditorTest.java @@ -20,7 +20,8 @@ import javax.websocket.Session; import java.net.URI; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @QuarkusTest class CompasSclCreateServerEndpointAsEditorTest extends AbstractServerEndpointAsEditorTestSupport { @@ -50,7 +51,7 @@ void createSCL_WhenCalled_ThenExpectedResponseIsRetrieved() throws Exception { session.getAsyncRemote().sendText(encoder.encode(request)); assertSclData(sclData); - verify(service, times(1)).create(sclFileTye, name, USERNAME, comment, sclData); + verify(service).create(sclFileTye, name, USERNAME, comment, sclData); } } diff --git a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpointAsEditorTest.java b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpointAsEditorTest.java index d194512b..101d3ff1 100644 --- a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpointAsEditorTest.java +++ b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpointAsEditorTest.java @@ -21,7 +21,8 @@ import java.net.URI; import java.util.UUID; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @QuarkusTest class CompasSclGetServerEndpointAsEditorTest extends AbstractServerEndpointAsEditorTestSupport { @@ -47,7 +48,7 @@ void getSCL_WhenCalled_ThenExpectedResponseIsRetrieved() throws Exception { session.getAsyncRemote().sendText(encoder.encode(request)); assertSclData(sclData); - verify(service, times(1)).findByUUID(sclFileTye, id); + verify(service).findByUUID(sclFileTye, id); } } diff --git a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpointAsReaderTest.java b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpointAsReaderTest.java index f4fdf135..fa63b88a 100644 --- a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpointAsReaderTest.java +++ b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpointAsReaderTest.java @@ -21,7 +21,8 @@ import java.net.URI; import java.util.UUID; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @QuarkusTest class CompasSclGetServerEndpointAsReaderTest extends AbstractServerEndpointAsReaderTestSupport { @@ -47,7 +48,7 @@ void getSCL_WhenCalled_ThenExpectedResponseIsRetrieved() throws Exception { session.getAsyncRemote().sendText(encoder.encode(request)); assertSclData(sclData); - verify(service, times(1)).findByUUID(sclFileTye, id); + verify(service).findByUUID(sclFileTye, id); } } diff --git a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpointAsEditorTest.java b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpointAsEditorTest.java index abfeb596..41da1179 100644 --- a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpointAsEditorTest.java +++ b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpointAsEditorTest.java @@ -22,7 +22,8 @@ import java.net.URI; import java.util.UUID; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @QuarkusTest class CompasSclGetVersionServerEndpointAsEditorTest extends AbstractServerEndpointAsEditorTestSupport { @@ -50,7 +51,7 @@ void getVersionSCL_WhenCalled_ThenExpectedResponseIsRetrieved() throws Exception session.getAsyncRemote().sendText(encoder.encode(request)); assertSclData(sclData); - verify(service, times(1)).findByUUID(sclFileTye, id, version); + verify(service).findByUUID(sclFileTye, id, version); } } diff --git a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpointAsReaderTest.java b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpointAsReaderTest.java index 5a599212..23037003 100644 --- a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpointAsReaderTest.java +++ b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpointAsReaderTest.java @@ -22,7 +22,8 @@ import java.net.URI; import java.util.UUID; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @QuarkusTest class CompasSclGetVersionServerEndpointAsReaderTest extends AbstractServerEndpointAsReaderTestSupport { @@ -50,7 +51,7 @@ void getVersionSCL_WhenCalled_ThenExpectedResponseIsRetrieved() throws Exception session.getAsyncRemote().sendText(encoder.encode(request)); assertSclData(sclData); - verify(service, times(1)).findByUUID(sclFileTye, id, version); + verify(service).findByUUID(sclFileTye, id, version); } } diff --git a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclUpdateServerEndpointAsEditorTest.java b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclUpdateServerEndpointAsEditorTest.java index addce908..04c397f1 100644 --- a/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclUpdateServerEndpointAsEditorTest.java +++ b/app/src/test/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclUpdateServerEndpointAsEditorTest.java @@ -22,7 +22,8 @@ import java.net.URI; import java.util.UUID; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @QuarkusTest class CompasSclUpdateServerEndpointAsEditorTest extends AbstractServerEndpointAsEditorTestSupport { @@ -54,7 +55,7 @@ void updateSCL_WhenCalled_ThenExpectedResponseIsRetrieved() throws Exception { session.getAsyncRemote().sendText(encoder.encode(request)); assertSclData(sclData); - verify(service, times(1)).update(sclFileTye, id, cst, USERNAME, comment, sclData); + verify(service).update(sclFileTye, id, cst, USERNAME, comment, sclData); } } diff --git a/service/src/test/java/org/lfenergy/compas/scl/data/service/CompasSclDataServiceTest.java b/service/src/test/java/org/lfenergy/compas/scl/data/service/CompasSclDataServiceTest.java index 926d487d..919bc92b 100644 --- a/service/src/test/java/org/lfenergy/compas/scl/data/service/CompasSclDataServiceTest.java +++ b/service/src/test/java/org/lfenergy/compas/scl/data/service/CompasSclDataServiceTest.java @@ -60,7 +60,7 @@ void list_WhenCalled_ThenRepositoryIsCalled() { var result = compasSclDataService.list(SCL_TYPE); assertNotNull(result); - verify(compasSclDataRepository, times(1)).list(SCL_TYPE); + verify(compasSclDataRepository).list(SCL_TYPE); } @Test @@ -74,7 +74,7 @@ void listVersionsByUUID_WhenCalledAndRepositoryReturnItemList_ThenListIsReturned assertNotNull(result); assertEquals(expectedResult.size(), result.size()); assertEquals(expectedResult.get(0), result.get(0)); - verify(compasSclDataRepository, times(1)).listVersionsByUUID(SCL_TYPE, uuid); + verify(compasSclDataRepository).listVersionsByUUID(SCL_TYPE, uuid); } @Test @@ -86,7 +86,7 @@ void listVersionsByUUID_WhenCalledAndRepositoryReturnsEmptyList_ThenExceptionIsT compasSclDataService.listVersionsByUUID(SCL_TYPE, uuid); }); assertEquals(NO_DATA_FOUND_ERROR_CODE, exception.getErrorCode()); - verify(compasSclDataRepository, times(1)).listVersionsByUUID(SCL_TYPE, uuid); + verify(compasSclDataRepository).listVersionsByUUID(SCL_TYPE, uuid); } @Test @@ -97,7 +97,7 @@ void findByUUID_WhenCalledWithoutVersion_ThenRepositoryIsCalled() throws IOExcep var result = compasSclDataService.findByUUID(SCL_TYPE, uuid); assertNotNull(result); - verify(compasSclDataRepository, times(1)).findByUUID(SCL_TYPE, uuid); + verify(compasSclDataRepository).findByUUID(SCL_TYPE, uuid); } @Test @@ -109,7 +109,7 @@ void findByUUID_WhenCalledWithVersion_ThenRepositoryIsCalled() throws IOExceptio var result = compasSclDataService.findByUUID(SCL_TYPE, uuid, version); assertNotNull(result); - verify(compasSclDataRepository, times(1)).findByUUID(SCL_TYPE, uuid, version); + verify(compasSclDataRepository).findByUUID(SCL_TYPE, uuid, version); } @Test @@ -128,8 +128,8 @@ void create_WhenCalledWithOutCompasExtension_ThenSCLReturnedWithCorrectCompasExt assertNotNull(scl); assertCompasExtension(scl, name); assertHistoryItem(scl, 2, INITIAL_VERSION, comment); - verify(compasSclDataRepository, times(1)).create(eq(SCL_TYPE), any(UUID.class), eq(name), anyString(), eq(INITIAL_VERSION), eq(who), eq(emptyList())); - verify(compasSclDataRepository, times(1)).hasDuplicateSclName(SCL_TYPE, name); + verify(compasSclDataRepository).create(eq(SCL_TYPE), any(UUID.class), eq(name), anyString(), eq(INITIAL_VERSION), eq(who), eq(emptyList())); + verify(compasSclDataRepository).hasDuplicateSclName(SCL_TYPE, name); } @Test @@ -149,8 +149,8 @@ void create_WhenCalledWithCompasExtension_ThenSCLReturnedWithCorrectCompasExtens assertNotNull(scl); assertCompasExtension(scl, name); assertHistoryItem(scl, 2, INITIAL_VERSION, comment); - verify(compasSclDataRepository, times(1)).create(eq(SCL_TYPE), any(UUID.class), eq(name), anyString(), eq(INITIAL_VERSION), eq(who), eq(emptyList())); - verify(compasSclDataRepository, times(1)).hasDuplicateSclName(SCL_TYPE, name); + verify(compasSclDataRepository).create(eq(SCL_TYPE), any(UUID.class), eq(name), anyString(), eq(INITIAL_VERSION), eq(who), eq(emptyList())); + verify(compasSclDataRepository).hasDuplicateSclName(SCL_TYPE, name); } @Test @@ -166,7 +166,7 @@ void create_WhenCalledWithDuplicateSclName_ThenCompasExceptionThrown() throws IO compasSclDataService.create(SCL_TYPE, name, who, comment, scl); }); assertEquals(DUPLICATE_SCL_NAME_ERROR_CODE, exception.getErrorCode()); - verify(compasSclDataRepository, times(1)).hasDuplicateSclName(SCL_TYPE, name); + verify(compasSclDataRepository).hasDuplicateSclName(SCL_TYPE, name); } @Test @@ -202,8 +202,8 @@ void update_WhenCalledWithoutCompasElements_ThenSCLReturnedWithCorrectCompasExte assertNotNull(scl); assertCompasExtension(scl, previousName); assertHistoryItem(scl, 4, nextVersion, null); - verify(compasSclDataRepository, times(1)).create(eq(SCL_TYPE), eq(uuid), eq(previousName), anyString(), eq(nextVersion), eq(who), eq(emptyList())); - verify(compasSclDataRepository, times(1)).findMetaInfoByUUID(SCL_TYPE, uuid); + verify(compasSclDataRepository).create(eq(SCL_TYPE), eq(uuid), eq(previousName), anyString(), eq(nextVersion), eq(who), eq(emptyList())); + verify(compasSclDataRepository).findMetaInfoByUUID(SCL_TYPE, uuid); verify(compasSclDataRepository, never()).hasDuplicateSclName(SCL_TYPE, previousName); } @@ -229,9 +229,9 @@ void update_WhenCalledWithCompasElementsAndNewName_ThenSCLReturnedWithCorrectCom assertNotNull(scl); assertCompasExtension(scl, newName); assertHistoryItem(scl, 4, nextVersion, null); - verify(compasSclDataRepository, times(1)).create(eq(SCL_TYPE), eq(uuid), eq(newName), anyString(), eq(nextVersion), eq(who), eq(emptyList())); - verify(compasSclDataRepository, times(1)).findMetaInfoByUUID(SCL_TYPE, uuid); - verify(compasSclDataRepository, times(1)).hasDuplicateSclName(SCL_TYPE, newName); + verify(compasSclDataRepository).create(eq(SCL_TYPE), eq(uuid), eq(newName), anyString(), eq(nextVersion), eq(who), eq(emptyList())); + verify(compasSclDataRepository).findMetaInfoByUUID(SCL_TYPE, uuid); + verify(compasSclDataRepository).hasDuplicateSclName(SCL_TYPE, newName); } @Test @@ -252,8 +252,8 @@ void update_WhenCalledWithCompasElementsAndDuplicateNewName_ThenCompasExceptionT compasSclDataService.update(SCL_TYPE, uuid, changeSet, who, null, scl); }); assertEquals(DUPLICATE_SCL_NAME_ERROR_CODE, exception.getErrorCode()); - verify(compasSclDataRepository, times(1)).findMetaInfoByUUID(SCL_TYPE, uuid); - verify(compasSclDataRepository, times(1)).hasDuplicateSclName(SCL_TYPE, newName); + verify(compasSclDataRepository).findMetaInfoByUUID(SCL_TYPE, uuid); + verify(compasSclDataRepository).hasDuplicateSclName(SCL_TYPE, newName); } @Test @@ -276,8 +276,8 @@ void update_WhenCalledWithCompasElementsAndSameName_ThenSCLReturnedWithCorrectCo assertNotNull(scl); assertCompasExtension(scl, previousName); assertHistoryItem(scl, 4, nextVersion, null); - verify(compasSclDataRepository, times(1)).create(eq(SCL_TYPE), eq(uuid), eq(previousName), anyString(), eq(nextVersion), eq(who), eq(emptyList())); - verify(compasSclDataRepository, times(1)).findMetaInfoByUUID(SCL_TYPE, uuid); + verify(compasSclDataRepository).create(eq(SCL_TYPE), eq(uuid), eq(previousName), anyString(), eq(nextVersion), eq(who), eq(emptyList())); + verify(compasSclDataRepository).findMetaInfoByUUID(SCL_TYPE, uuid); verify(compasSclDataRepository, never()).hasDuplicateSclName(SCL_TYPE, previousName); } @@ -303,7 +303,7 @@ void delete_WhenCalledWithoutVersion_ThenRepositoryIsCalled() { compasSclDataService.delete(SCL_TYPE, uuid); - verify(compasSclDataRepository, times(1)).delete(SCL_TYPE, uuid); + verify(compasSclDataRepository).delete(SCL_TYPE, uuid); } @Test @@ -315,7 +315,7 @@ void delete_WhenCalledWithVersion_ThenRepositoryIsCalled() { compasSclDataService.delete(SCL_TYPE, uuid, version); - verify(compasSclDataRepository, times(1)).delete(SCL_TYPE, uuid, version); + verify(compasSclDataRepository).delete(SCL_TYPE, uuid, version); } @Test