фикс тестов

This commit is contained in:
Вячеслав Иванов 2024-03-15 12:45:33 +04:00
parent c8bf667c58
commit 05dbc2902f
2 changed files with 14 additions and 14 deletions

View File

@ -29,8 +29,8 @@ class StockServiceTests {
stockService.create(new StockEntity(null, "Stock 1", 50)); stockService.create(new StockEntity(null, "Stock 1", 50));
stockService.create(new StockEntity(null, "Stock 2", 0)); stockService.create(new StockEntity(null, "Stock 2", 0));
final StockEntity last = stockService.create(new StockEntity(null, "Stock 3", 25)); final StockEntity last = stockService.create(new StockEntity(null, "Stock 3", 25));
Assertions.assertEquals(6, stockService.getAll().size()); Assertions.assertEquals(3, stockService.getAll().size());
Assertions.assertEquals(last, stockService.get(6L)); Assertions.assertEquals(last, stockService.get(3L));
} }
@Test @Test
@ -41,7 +41,7 @@ class StockServiceTests {
final StockEntity entity = stockService.get(3L); final StockEntity entity = stockService.get(3L);
final String oldName = entity.getName(); final String oldName = entity.getName();
final StockEntity newEntity = stockService.update(3L, new StockEntity(1L, test, valueTest)); 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(newEntity, stockService.get(3L));
Assertions.assertEquals(test, newEntity.getName()); Assertions.assertEquals(test, newEntity.getName());
Assertions.assertNotEquals(oldName, newEntity.getName()); Assertions.assertNotEquals(oldName, newEntity.getName());
@ -51,12 +51,12 @@ class StockServiceTests {
@Order(3) @Order(3)
void deleteTest() { void deleteTest() {
stockService.delete(3L); stockService.delete(3L);
Assertions.assertEquals(5, stockService.getAll().size()); Assertions.assertEquals(2, stockService.getAll().size());
final StockEntity last = stockService.get(5L); final StockEntity last = stockService.get(2L);
Assertions.assertEquals(5L, last.getId()); Assertions.assertEquals(2L, last.getId());
final StockEntity newEntity = stockService.create(new StockEntity(null, "TEST", 15)); final StockEntity newEntity = stockService.create(new StockEntity(null, "TEST", 15));
Assertions.assertEquals(6, stockService.getAll().size()); Assertions.assertEquals(3, stockService.getAll().size());
Assertions.assertEquals(7L, newEntity.getId()); Assertions.assertEquals(4L, newEntity.getId());
} }
} }

View File

@ -29,8 +29,8 @@ class TypeServiceTests {
typeService.create(new TypeEntity(null, "Пепперони")); typeService.create(new TypeEntity(null, "Пепперони"));
typeService.create(new TypeEntity(null, "Мясная")); typeService.create(new TypeEntity(null, "Мясная"));
final TypeEntity last = typeService.create(new TypeEntity(null, "Сырная")); final TypeEntity last = typeService.create(new TypeEntity(null, "Сырная"));
Assertions.assertEquals(3, typeService.getAll().size()); Assertions.assertEquals(6, typeService.getAll().size());
Assertions.assertEquals(last, typeService.get(3L)); Assertions.assertEquals(last, typeService.get(6L));
} }
@Test @Test
@ -40,7 +40,7 @@ class TypeServiceTests {
final TypeEntity entity = typeService.get(3L); final TypeEntity entity = typeService.get(3L);
final String oldName = entity.getName(); final String oldName = entity.getName();
final TypeEntity newEntity = typeService.update(3L, new TypeEntity(1L, test)); 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(newEntity, typeService.get(3L));
Assertions.assertEquals(test, newEntity.getName()); Assertions.assertEquals(test, newEntity.getName());
Assertions.assertNotEquals(oldName, newEntity.getName()); Assertions.assertNotEquals(oldName, newEntity.getName());
@ -50,12 +50,12 @@ class TypeServiceTests {
@Order(3) @Order(3)
void deleteTest() { void deleteTest() {
typeService.delete(3L); typeService.delete(3L);
Assertions.assertEquals(2, typeService.getAll().size()); Assertions.assertEquals(5, typeService.getAll().size());
final TypeEntity last = typeService.get(2L); final TypeEntity last = typeService.get(2L);
Assertions.assertEquals(2L, last.getId()); Assertions.assertEquals(2L, last.getId());
final TypeEntity newEntity = typeService.create(new TypeEntity(null, "Сырная")); final TypeEntity newEntity = typeService.create(new TypeEntity(null, "Сырная"));
Assertions.assertEquals(3, typeService.getAll().size()); Assertions.assertEquals(6, typeService.getAll().size());
Assertions.assertEquals(4L, newEntity.getId()); Assertions.assertEquals(7L, newEntity.getId());
} }
} }