From eb62c727ef2c9065f0f383b91de36d06a40326c9 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: Wed, 27 Mar 2024 20:41:07 +0400 Subject: [PATCH] fix test --- .../test/java/com/example/demo/TypeServiceTests.java | 12 ++++++------ .../test/java/com/example/demo/UserServiceTests.java | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/demo/src/test/java/com/example/demo/TypeServiceTests.java b/demo/src/test/java/com/example/demo/TypeServiceTests.java index 68bced0..07f7076 100644 --- a/demo/src/test/java/com/example/demo/TypeServiceTests.java +++ b/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(6, typeService.getAll().size()); - Assertions.assertEquals(last, typeService.get(6L)); + Assertions.assertEquals(3, typeService.getAll().size()); + Assertions.assertEquals(last, typeService.get(3L)); } @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(6, typeService.getAll().size()); + Assertions.assertEquals(3, 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(5, typeService.getAll().size()); + Assertions.assertEquals(2, typeService.getAll().size()); final TypeEntity last = typeService.get(2L); Assertions.assertEquals(2L, last.getId()); final TypeEntity newEntity = typeService.create(new TypeEntity(null, "Сырная")); - Assertions.assertEquals(6, typeService.getAll().size()); - Assertions.assertEquals(7L, newEntity.getId()); + Assertions.assertEquals(3, typeService.getAll().size()); + Assertions.assertEquals(4L, newEntity.getId()); } } diff --git a/demo/src/test/java/com/example/demo/UserServiceTests.java b/demo/src/test/java/com/example/demo/UserServiceTests.java index 16e411c..3940e4c 100644 --- a/demo/src/test/java/com/example/demo/UserServiceTests.java +++ b/demo/src/test/java/com/example/demo/UserServiceTests.java @@ -29,8 +29,8 @@ class UserServiceTests { userService.create(new UserEntity(null, "User 1", "test@test", "qwerty")); userService.create(new UserEntity(null, "User 2", "test1@test1", "12345678")); final UserEntity last = userService.create(new UserEntity(null, "User 3", "test2@test2", "mrgurgnugrn")); - Assertions.assertEquals(5, userService.getAll().size()); - Assertions.assertEquals(last, userService.get(5L)); + Assertions.assertEquals(3, userService.getAll().size()); + Assertions.assertEquals(last, userService.get(3L)); } @Test @@ -42,7 +42,7 @@ class UserServiceTests { final UserEntity entity = userService.get(3L); final String oldName = entity.getName(); final UserEntity newEntity = userService.update(3L, new UserEntity(1L, test, email, password)); - Assertions.assertEquals(5, userService.getAll().size()); + Assertions.assertEquals(3, userService.getAll().size()); Assertions.assertEquals(newEntity, userService.get(3L)); Assertions.assertEquals(test, newEntity.getName()); Assertions.assertNotEquals(oldName, newEntity.getName()); @@ -52,12 +52,12 @@ class UserServiceTests { @Order(3) void deleteTest() { userService.delete(3L); - Assertions.assertEquals(4, userService.getAll().size()); + Assertions.assertEquals(2, userService.getAll().size()); final UserEntity last = userService.get(2L); Assertions.assertEquals(2L, last.getId()); final UserEntity newEntity = userService.create(new UserEntity(null, "TEST", "ortrigr@rbirirrgi", "rgkrgimrgirg")); - Assertions.assertEquals(5, userService.getAll().size()); - Assertions.assertEquals(6L, newEntity.getId()); + Assertions.assertEquals(3, userService.getAll().size()); + Assertions.assertEquals(4L, newEntity.getId()); } }