fix
This commit is contained in:
parent
d59106789a
commit
9f24db1622
@ -39,7 +39,6 @@ public class OrderController {
|
||||
private OrderDto toDto(OrderEntity entity) {
|
||||
OrderDto dto = new OrderDto(productService);
|
||||
dto.setId(entity.getId());
|
||||
dto.setUserId(entity.getUser().getId());
|
||||
dto.setProductId(entity.getProduct().getId());
|
||||
dto.setCount(entity.getCount());
|
||||
return dto;
|
||||
|
@ -38,14 +38,11 @@ public class OrderDto {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ public class OrderService {
|
||||
|
||||
public OrderEntity update(Long id, OrderEntity entity) {
|
||||
final OrderEntity existsEntity = get(id);
|
||||
existsEntity.setUser(entity.getUser());
|
||||
existsEntity.setProduct(entity.getProduct());
|
||||
existsEntity.setCount(entity.getCount());
|
||||
return repository.update(existsEntity);
|
||||
|
@ -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(9, typeService.getAll().size());
|
||||
Assertions.assertEquals(last, typeService.get(9L));
|
||||
}
|
||||
|
||||
@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(9, 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(8, 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(9, typeService.getAll().size());
|
||||
Assertions.assertEquals(10L, newEntity.getId());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user