From 05dbc2902fe9fba21645cfc7c2412eff568ee897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D1=8F=D1=87=D0=B5=D1=81=D0=BB=D0=B0=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Fri, 15 Mar 2024 12:45:33 +0400 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D1=82=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/demo/StockServiceTests.java | 16 ++++++++-------- .../java/com/example/demo/TypeServiceTests.java | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/2 семестр/lab2/demo/src/test/java/com/example/demo/StockServiceTests.java b/2 семестр/lab2/demo/src/test/java/com/example/demo/StockServiceTests.java index 13d07d7..ea7b72c 100644 --- a/2 семестр/lab2/demo/src/test/java/com/example/demo/StockServiceTests.java +++ b/2 семестр/lab2/demo/src/test/java/com/example/demo/StockServiceTests.java @@ -29,8 +29,8 @@ class StockServiceTests { stockService.create(new StockEntity(null, "Stock 1", 50)); stockService.create(new StockEntity(null, "Stock 2", 0)); final StockEntity last = stockService.create(new StockEntity(null, "Stock 3", 25)); - Assertions.assertEquals(6, stockService.getAll().size()); - Assertions.assertEquals(last, stockService.get(6L)); + Assertions.assertEquals(3, stockService.getAll().size()); + Assertions.assertEquals(last, stockService.get(3L)); } @Test @@ -41,7 +41,7 @@ class StockServiceTests { final StockEntity entity = stockService.get(3L); final String oldName = entity.getName(); final StockEntity newEntity = stockService.update(3L, new StockEntity(1L, test, valueTest)); - Assertions.assertEquals(6, stockService.getAll().size()); + Assertions.assertEquals(3, stockService.getAll().size()); Assertions.assertEquals(newEntity, stockService.get(3L)); Assertions.assertEquals(test, newEntity.getName()); Assertions.assertNotEquals(oldName, newEntity.getName()); @@ -51,12 +51,12 @@ class StockServiceTests { @Order(3) void deleteTest() { stockService.delete(3L); - Assertions.assertEquals(5, stockService.getAll().size()); - final StockEntity last = stockService.get(5L); - Assertions.assertEquals(5L, last.getId()); + Assertions.assertEquals(2, stockService.getAll().size()); + final StockEntity last = stockService.get(2L); + Assertions.assertEquals(2L, last.getId()); final StockEntity newEntity = stockService.create(new StockEntity(null, "TEST", 15)); - Assertions.assertEquals(6, stockService.getAll().size()); - Assertions.assertEquals(7L, newEntity.getId()); + Assertions.assertEquals(3, stockService.getAll().size()); + Assertions.assertEquals(4L, newEntity.getId()); } } diff --git a/2 семестр/lab2/demo/src/test/java/com/example/demo/TypeServiceTests.java b/2 семестр/lab2/demo/src/test/java/com/example/demo/TypeServiceTests.java index 07f7076..68bced0 100644 --- a/2 семестр/lab2/demo/src/test/java/com/example/demo/TypeServiceTests.java +++ b/2 семестр/lab2/demo/src/test/java/com/example/demo/TypeServiceTests.java @@ -29,8 +29,8 @@ class TypeServiceTests { typeService.create(new TypeEntity(null, "Пепперони")); typeService.create(new TypeEntity(null, "Мясная")); final TypeEntity last = typeService.create(new TypeEntity(null, "Сырная")); - Assertions.assertEquals(3, typeService.getAll().size()); - Assertions.assertEquals(last, typeService.get(3L)); + Assertions.assertEquals(6, typeService.getAll().size()); + Assertions.assertEquals(last, typeService.get(6L)); } @Test @@ -40,7 +40,7 @@ class TypeServiceTests { final TypeEntity entity = typeService.get(3L); final String oldName = entity.getName(); final TypeEntity newEntity = typeService.update(3L, new TypeEntity(1L, test)); - Assertions.assertEquals(3, typeService.getAll().size()); + Assertions.assertEquals(6, typeService.getAll().size()); Assertions.assertEquals(newEntity, typeService.get(3L)); Assertions.assertEquals(test, newEntity.getName()); Assertions.assertNotEquals(oldName, newEntity.getName()); @@ -50,12 +50,12 @@ class TypeServiceTests { @Order(3) void deleteTest() { typeService.delete(3L); - Assertions.assertEquals(2, typeService.getAll().size()); + Assertions.assertEquals(5, typeService.getAll().size()); final TypeEntity last = typeService.get(2L); Assertions.assertEquals(2L, last.getId()); final TypeEntity newEntity = typeService.create(new TypeEntity(null, "Сырная")); - Assertions.assertEquals(3, typeService.getAll().size()); - Assertions.assertEquals(4L, newEntity.getId()); + Assertions.assertEquals(6, typeService.getAll().size()); + Assertions.assertEquals(7L, newEntity.getId()); } }