diff --git a/src/test/kotlin/no/nb/mlt/wls/domain/WLSServiceTest.kt b/src/test/kotlin/no/nb/mlt/wls/domain/WLSServiceTest.kt index d9f5efa2..df4d7416 100644 --- a/src/test/kotlin/no/nb/mlt/wls/domain/WLSServiceTest.kt +++ b/src/test/kotlin/no/nb/mlt/wls/domain/WLSServiceTest.kt @@ -16,6 +16,7 @@ import no.nb.mlt.wls.domain.model.Packaging import no.nb.mlt.wls.domain.ports.inbound.CreateOrderDTO import no.nb.mlt.wls.domain.ports.inbound.ItemMetadata import no.nb.mlt.wls.domain.ports.inbound.ItemNotFoundException +import no.nb.mlt.wls.domain.ports.inbound.MoveItemPayload import no.nb.mlt.wls.domain.ports.inbound.OrderNotFoundException import no.nb.mlt.wls.domain.ports.inbound.ValidationException import no.nb.mlt.wls.domain.ports.outbound.InventoryNotifier @@ -138,7 +139,7 @@ class WLSServiceTest { val cut = WLSService(itemRepoMock, orderRepoMock, storageSystemRepoMock, inventoryNotifierMock) runTest { - val movedItem = cut.moveItem(testItem.hostId, testItem.hostName, 1.0, "Somewhere nice") + val movedItem = cut.moveItem(testMoveItemPayload) assertThat(movedItem).isEqualTo(expectedItem) coVerify(exactly = 1) { itemRepoMock.getItem(any(), any()) } @@ -154,7 +155,7 @@ class WLSServiceTest { val cut = WLSService(itemRepoMock, orderRepoMock, storageSystemRepoMock, inventoryNotifierMock) runTest { assertThrows { - cut.moveItem(testItem.hostId, testItem.hostName, 1.0, "Somewhere nice") + cut.moveItem(testMoveItemPayload) } coVerify(exactly = 1) { itemRepoMock.getItem(any(), any()) } @@ -170,7 +171,7 @@ class WLSServiceTest { val cut = WLSService(itemRepoMock, orderRepoMock, storageSystemRepoMock, inventoryNotifierMock) runTest { assertThrows { - cut.moveItem(testItem.hostId, testItem.hostName, -1.0, "Somewhere nice") + cut.moveItem(testMoveItemPayload.copy(quantity = -1.0)) } coVerify(exactly = 0) { itemRepoMock.getItem(any(), any()) } @@ -186,7 +187,7 @@ class WLSServiceTest { val cut = WLSService(itemRepoMock, orderRepoMock, storageSystemRepoMock, inventoryNotifierMock) runTest { assertThrows { - cut.moveItem(testItem.hostId, testItem.hostName, 1.0, " ") + cut.moveItem(testMoveItemPayload.copy(location = " ")) } coVerify(exactly = 0) { itemRepoMock.getItem(any(), any()) } @@ -435,6 +436,14 @@ class WLSServiceTest { ) ) + private val testMoveItemPayload = + MoveItemPayload( + "12345", + HostName.AXIELL, + 1.0, + "Somewhere nice" + ) + private fun Order.toCreateOrderDTO() = CreateOrderDTO( hostName = testOrder.hostName,