@@ -72,8 +72,8 @@ void tearDown() {
7272 @ Test
7373 void testAddCategory () {
7474 // given
75- final AddCategoryRequest addCategoryRequest = addCategoryRequestTestBuilder .build ();
76- final Category expectedResponse = categoryTestBuilder .build ();
75+ final AddCategoryRequest addCategoryRequest = addCategoryRequestTestBuilder .withDefaultValues (). build ();
76+ final Category expectedResponse = categoryTestBuilder .withDefaultValues (). build ();
7777
7878 // when
7979 doReturn (false ).when (categoryRepository ).existsByName (anyString ());
@@ -93,7 +93,7 @@ void testAddCategory() {
9393 @ Test
9494 void testAddCategoryThatAlreadyExists () {
9595 // given
96- final AddCategoryRequest addCategoryRequest = addCategoryRequestTestBuilder .build ();
96+ final AddCategoryRequest addCategoryRequest = addCategoryRequestTestBuilder .withDefaultValues (). build ();
9797
9898 // when
9999 doReturn (true ).when (categoryRepository ).existsByName (anyString ());
@@ -108,9 +108,10 @@ void testAddCategoryThatAlreadyExists() {
108108 @ Test
109109 void testUpdateCategory () {
110110 // given
111- final Category existingCategory = categoryTestBuilder .build ();
112- final UpdateCategoryRequest updateCategoryRequest = updateCategoryRequestTestBuilder .build ();
111+ final Category existingCategory = categoryTestBuilder .withDefaultValues (). build ();
112+ final UpdateCategoryRequest updateCategoryRequest = updateCategoryRequestTestBuilder .withDefaultValues (). build ();
113113 final Category expectedResponse = categoryTestBuilder
114+ .withDefaultValues ()
114115 .withName (updateCategoryRequest .name ())
115116 .withDescription (updateCategoryRequest .description ())
116117 .build ();
@@ -132,7 +133,7 @@ void testUpdateCategory() {
132133 @ Test
133134 void testUpdateCategoryThatDoesNotExist () {
134135 // given
135- final UpdateCategoryRequest updateCategoryRequest = updateCategoryRequestTestBuilder .build ();
136+ final UpdateCategoryRequest updateCategoryRequest = updateCategoryRequestTestBuilder .withDefaultValues (). build ();
136137
137138 // when
138139 doReturn (false ).when (categoryRepository ).existsByNameAndIdIsNot (anyString (), anyLong ());
@@ -149,8 +150,8 @@ void testUpdateCategoryThatDoesNotExist() {
149150 @ Test
150151 void testUpdateCategoryNameToCategoryThatAlreadyExists () {
151152 // given
152- final Category existingCategory = categoryTestBuilder .build ();
153- final UpdateCategoryRequest updateCategoryRequest = updateCategoryRequestTestBuilder .build ();
153+ final Category existingCategory = categoryTestBuilder .withDefaultValues (). build ();
154+ final UpdateCategoryRequest updateCategoryRequest = updateCategoryRequestTestBuilder .withDefaultValues (). build ();
154155
155156 // when
156157 doReturn (true ).when (categoryRepository ).existsByNameAndIdIsNot (anyString (), anyLong ());
@@ -165,9 +166,10 @@ void testUpdateCategoryNameToCategoryThatAlreadyExists() {
165166 @ Test
166167 void testAddProductToCategory () {
167168 // given
168- final Product product = productTestBuilder .build ();
169- final Category category = categoryTestBuilder .build ();
169+ final Product product = productTestBuilder .withDefaultValues (). build ();
170+ final Category category = categoryTestBuilder .withDefaultValues (). build ();
170171 final Category expectedResponse = categoryTestBuilder
172+ .withDefaultValues ()
171173 .withProduct (product )
172174 .build ();
173175
@@ -188,8 +190,9 @@ void testAddProductToCategory() {
188190 @ Test
189191 void testAddProductToCategoryThatIsAlreadyInCategory () {
190192 // given
191- final Product product = productTestBuilder .build ();
193+ final Product product = productTestBuilder .withDefaultValues (). build ();
192194 final Category category = categoryTestBuilder
195+ .withDefaultValues ()
193196 .withProduct (product )
194197 .build ();
195198
@@ -208,7 +211,7 @@ void testAddProductToCategoryThatIsAlreadyInCategory() {
208211 @ Test
209212 void testAddProductToCategoryThatDoesNotExist () {
210213 // given
211- final Product product = productTestBuilder .build ();
214+ final Product product = productTestBuilder .withDefaultValues (). build ();
212215
213216 // when
214217 doReturn (Optional .empty ()).when (categoryRepository ).findById (anyLong ());
@@ -223,11 +226,12 @@ void testAddProductToCategoryThatDoesNotExist() {
223226 @ Test
224227 void testRemoveProductFromCategory () {
225228 // given
226- final Product product = productTestBuilder .build ();
229+ final Product product = productTestBuilder .withDefaultValues (). build ();
227230 final Category category = categoryTestBuilder
231+ .withDefaultValues ()
228232 .withProduct (product )
229233 .build ();
230- final Category expectedResponse = categoryTestBuilder .build ();
234+ final Category expectedResponse = categoryTestBuilder .withDefaultValues (). build ();
231235
232236 // when
233237 doReturn (Optional .of (category )).when (categoryRepository ).findById (anyLong ());
@@ -246,8 +250,8 @@ void testRemoveProductFromCategory() {
246250 @ Test
247251 void testRemoveProductThatIsNotInCategory () {
248252 // given
249- final Product product = productTestBuilder .build ();
250- final Category category = categoryTestBuilder .build ();
253+ final Product product = productTestBuilder .withDefaultValues (). build ();
254+ final Category category = categoryTestBuilder .withDefaultValues (). build ();
251255
252256 // when
253257 doReturn (Optional .of (category )).when (categoryRepository ).findById (anyLong ());
@@ -264,7 +268,7 @@ void testRemoveProductThatIsNotInCategory() {
264268 @ Test
265269 void testRemoveProductFromCategoryThatDoesNotExist () {
266270 // given
267- Product product = productTestBuilder .build ();
271+ Product product = productTestBuilder .withDefaultValues (). build ();
268272
269273 // when
270274 doReturn (Optional .empty ()).when (categoryRepository ).findById (anyLong ());
@@ -279,8 +283,9 @@ void testRemoveProductFromCategoryThatDoesNotExist() {
279283 @ Test
280284 void testRetireCategory () {
281285 // given
282- Category category = categoryTestBuilder .build ();
286+ Category category = categoryTestBuilder .withDefaultValues (). build ();
283287 Category expectedCategory = categoryTestBuilder
288+ .withDefaultValues ()
284289 .withRetired (true )
285290 .build ();
286291
@@ -298,6 +303,7 @@ void testRetireCategory() {
298303 void testRetireCategoryAlreadyRetiredThrowsRetirementException () {
299304 // given
300305 Category retiredCategory = categoryTestBuilder
306+ .withDefaultValues ()
301307 .withRetired (true )
302308 .build ();
303309
0 commit comments