Skip to content

Commit 6db9b2e

Browse files
BENCH-205 removed redundant constructors from Entity classes
1 parent 31a0c27 commit 6db9b2e

File tree

3 files changed

+1
-19
lines changed

3 files changed

+1
-19
lines changed

src/main/java/com/answerdigital/answerking/model/Category.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.answerdigital.answerking.model;
22

3-
import com.answerdigital.answerking.request.AddCategoryRequest;
43
import com.fasterxml.jackson.annotation.JsonIgnore;
54
import com.fasterxml.jackson.annotation.JsonProperty;
65
import lombok.AllArgsConstructor;
@@ -65,16 +64,6 @@ public class Category {
6564
@JsonIgnore
6665
private Set<Product> products = new HashSet<>();
6766

68-
public Category(final AddCategoryRequest categoryRequest) {
69-
this.name = categoryRequest.name();
70-
this.description = categoryRequest.description();
71-
this.createdOn = ZonedDateTime.now(ZoneOffset.UTC)
72-
.truncatedTo( ChronoUnit.SECONDS )
73-
.format( DateTimeFormatter.ofPattern( "yyyy-MM-dd HH:mm::ss" ) );
74-
this.lastUpdated = this.createdOn;
75-
this.retired = false;
76-
}
77-
7867
public Category(final String name, final String description) {
7968
this.name = name;
8069
this.description = description;

src/main/java/com/answerdigital/answerking/model/Product.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ public class Product {
5757
@JsonIgnore
5858
private Set<LineItem> lineItems = new HashSet<>();
5959

60-
public Product(final ProductRequest productRequest){
61-
this.name = productRequest.name();
62-
this.description = productRequest.description();
63-
this.price = productRequest.price();
64-
this.retired = false;
65-
}
66-
6760
public Product(final String name, final String description, final BigDecimal price, final boolean isRetired) {
6861
this.name = name;
6962
this.description = description;

src/test/java/com/answerdigital/answerking/controller/CategoryControllerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void removeProductFromCategoryTest() throws Exception {
6666
void addCategoryTest() throws Exception {
6767
ObjectMapper mapper = new ObjectMapper();
6868
final var addCategoryRequest = new AddCategoryRequest("random name", "random description");
69-
final var category = new Category(addCategoryRequest);
69+
final var category = new Category("random name", "random description");
7070
final var categoryRequest = "{\"name\": \"random name\",\"description\": \"random description\"}";
7171
final String testDate = ZonedDateTime.now( ZoneId.of( "Etc/UTC" ) )
7272
.truncatedTo( ChronoUnit.SECONDS )

0 commit comments

Comments
 (0)