diff --git a/pom.xml b/pom.xml
index 30280172f3..3af7656b0f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,14 +14,14 @@
org.springframework.boot
spring-boot-starter-parent
- 2.1.0.RELEASE
+ 2.7.2
UTF-8
UTF-8
- 1.8
+ 17
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index e45c5013c5..7d80715172 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1 +1,4 @@
-logging.level.guru.springframework=debug
\ No newline at end of file
+logging.level.guru.springframework=debug
+spring.h2.console.enabled=true
+spring.datasource.url=jdbc:h2:mem:mydb
+spring.jpa.defer-datasource-initialization=true
\ No newline at end of file
diff --git a/src/test/java/guru/springframework/Spring5RecipeAppApplicationTests.java b/src/test/java/guru/springframework/Spring5RecipeAppApplicationTests.java
index 775dc5feef..ecdca7f03f 100644
--- a/src/test/java/guru/springframework/Spring5RecipeAppApplicationTests.java
+++ b/src/test/java/guru/springframework/Spring5RecipeAppApplicationTests.java
@@ -1,11 +1,10 @@
package guru.springframework;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
-@RunWith(SpringRunner.class)
+
@SpringBootTest
public class Spring5RecipeAppApplicationTests {
diff --git a/src/test/java/guru/springframework/controllers/IndexControllerTest.java b/src/test/java/guru/springframework/controllers/IndexControllerTest.java
index 8f314563d2..430987a230 100644
--- a/src/test/java/guru/springframework/controllers/IndexControllerTest.java
+++ b/src/test/java/guru/springframework/controllers/IndexControllerTest.java
@@ -2,8 +2,8 @@
import guru.springframework.domain.Recipe;
import guru.springframework.services.RecipeService;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -14,7 +14,7 @@
import java.util.HashSet;
import java.util.Set;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -33,7 +33,7 @@ public class IndexControllerTest {
IndexController controller;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
diff --git a/src/test/java/guru/springframework/controllers/IngredientControllerTest.java b/src/test/java/guru/springframework/controllers/IngredientControllerTest.java
index 7198420a7e..3aad8f305f 100644
--- a/src/test/java/guru/springframework/controllers/IngredientControllerTest.java
+++ b/src/test/java/guru/springframework/controllers/IngredientControllerTest.java
@@ -5,8 +5,8 @@
import guru.springframework.services.IngredientService;
import guru.springframework.services.RecipeService;
import guru.springframework.services.UnitOfMeasureService;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.MediaType;
@@ -36,7 +36,7 @@ public class IngredientControllerTest {
MockMvc mockMvc;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
diff --git a/src/test/java/guru/springframework/controllers/RecipeControllerTest.java b/src/test/java/guru/springframework/controllers/RecipeControllerTest.java
index 0073d3b2e8..cd9bee4fa0 100644
--- a/src/test/java/guru/springframework/controllers/RecipeControllerTest.java
+++ b/src/test/java/guru/springframework/controllers/RecipeControllerTest.java
@@ -3,8 +3,8 @@
import guru.springframework.commands.RecipeCommand;
import guru.springframework.domain.Recipe;
import guru.springframework.services.RecipeService;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.MediaType;
@@ -30,7 +30,7 @@ public class RecipeControllerTest {
MockMvc mockMvc;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
diff --git a/src/test/java/guru/springframework/converters/CategoryCommandToCategoryTest.java b/src/test/java/guru/springframework/converters/CategoryCommandToCategoryTest.java
index cc7298e5c7..ad2b04c188 100644
--- a/src/test/java/guru/springframework/converters/CategoryCommandToCategoryTest.java
+++ b/src/test/java/guru/springframework/converters/CategoryCommandToCategoryTest.java
@@ -2,10 +2,10 @@
import guru.springframework.commands.CategoryCommand;
import guru.springframework.domain.Category;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
public class CategoryCommandToCategoryTest {
@@ -13,7 +13,7 @@ public class CategoryCommandToCategoryTest {
public static final String DESCRIPTION = "description";
CategoryCommandToCategory conveter;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
conveter = new CategoryCommandToCategory();
}
diff --git a/src/test/java/guru/springframework/converters/CategoryToCategoryCommandTest.java b/src/test/java/guru/springframework/converters/CategoryToCategoryCommandTest.java
index 1cf4445b95..5d83279d17 100644
--- a/src/test/java/guru/springframework/converters/CategoryToCategoryCommandTest.java
+++ b/src/test/java/guru/springframework/converters/CategoryToCategoryCommandTest.java
@@ -2,10 +2,11 @@
import guru.springframework.commands.CategoryCommand;
import guru.springframework.domain.Category;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
-import static org.junit.Assert.*;
/**
* Created by jt on 6/21/17.
@@ -16,7 +17,7 @@ public class CategoryToCategoryCommandTest {
public static final String DESCRIPTION = "descript";
CategoryToCategoryCommand convter;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
convter = new CategoryToCategoryCommand();
}
diff --git a/src/test/java/guru/springframework/converters/IngredientCommandToIngredientTest.java b/src/test/java/guru/springframework/converters/IngredientCommandToIngredientTest.java
index ec7c275d70..90520babf3 100644
--- a/src/test/java/guru/springframework/converters/IngredientCommandToIngredientTest.java
+++ b/src/test/java/guru/springframework/converters/IngredientCommandToIngredientTest.java
@@ -4,12 +4,14 @@
import guru.springframework.commands.UnitOfMeasureCommand;
import guru.springframework.domain.Ingredient;
import guru.springframework.domain.Recipe;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
import java.math.BigDecimal;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+
public class IngredientCommandToIngredientTest {
@@ -21,7 +23,7 @@ public class IngredientCommandToIngredientTest {
IngredientCommandToIngredient converter;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
converter = new IngredientCommandToIngredient(new UnitOfMeasureCommandToUnitOfMeasure());
}
diff --git a/src/test/java/guru/springframework/converters/IngredientToIngredientCommandTest.java b/src/test/java/guru/springframework/converters/IngredientToIngredientCommandTest.java
index 40601af92f..f62f5208c8 100644
--- a/src/test/java/guru/springframework/converters/IngredientToIngredientCommandTest.java
+++ b/src/test/java/guru/springframework/converters/IngredientToIngredientCommandTest.java
@@ -4,12 +4,13 @@
import guru.springframework.domain.Ingredient;
import guru.springframework.domain.Recipe;
import guru.springframework.domain.UnitOfMeasure;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+
/**
* Created by jt on 6/21/17.
@@ -25,7 +26,7 @@ public class IngredientToIngredientCommandTest {
IngredientToIngredientCommand converter;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
converter = new IngredientToIngredientCommand(new UnitOfMeasureToUnitOfMeasureCommand());
}
diff --git a/src/test/java/guru/springframework/converters/NotesCommandToNotesTest.java b/src/test/java/guru/springframework/converters/NotesCommandToNotesTest.java
index 855f02ed11..564a03be1c 100644
--- a/src/test/java/guru/springframework/converters/NotesCommandToNotesTest.java
+++ b/src/test/java/guru/springframework/converters/NotesCommandToNotesTest.java
@@ -2,10 +2,11 @@
import guru.springframework.commands.NotesCommand;
import guru.springframework.domain.Notes;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
-import static org.junit.Assert.*;
public class NotesCommandToNotesTest {
@@ -13,7 +14,7 @@ public class NotesCommandToNotesTest {
public static final String RECIPE_NOTES = "Notes";
NotesCommandToNotes converter;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
converter = new NotesCommandToNotes();
diff --git a/src/test/java/guru/springframework/converters/NotesToNotesCommandTest.java b/src/test/java/guru/springframework/converters/NotesToNotesCommandTest.java
index bac0ac0d36..a5fe8bc398 100644
--- a/src/test/java/guru/springframework/converters/NotesToNotesCommandTest.java
+++ b/src/test/java/guru/springframework/converters/NotesToNotesCommandTest.java
@@ -2,10 +2,11 @@
import guru.springframework.commands.NotesCommand;
import guru.springframework.domain.Notes;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
-import static org.junit.Assert.*;
/**
* Created by jt on 6/21/17.
@@ -16,7 +17,7 @@ public class NotesToNotesCommandTest {
public static final String RECIPE_NOTES = "Notes";
NotesToNotesCommand converter;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
converter = new NotesToNotesCommand();
}
diff --git a/src/test/java/guru/springframework/converters/RecipeCommandToRecipeTest.java b/src/test/java/guru/springframework/converters/RecipeCommandToRecipeTest.java
index bbacedba5c..5259dfbec0 100644
--- a/src/test/java/guru/springframework/converters/RecipeCommandToRecipeTest.java
+++ b/src/test/java/guru/springframework/converters/RecipeCommandToRecipeTest.java
@@ -6,10 +6,10 @@
import guru.springframework.commands.RecipeCommand;
import guru.springframework.domain.Difficulty;
import guru.springframework.domain.Recipe;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
public class RecipeCommandToRecipeTest {
public static final Long RECIPE_ID = 1L;
@@ -30,7 +30,7 @@ public class RecipeCommandToRecipeTest {
RecipeCommandToRecipe converter;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
converter = new RecipeCommandToRecipe(new CategoryCommandToCategory(),
new IngredientCommandToIngredient(new UnitOfMeasureCommandToUnitOfMeasure()),
diff --git a/src/test/java/guru/springframework/converters/RecipeToRecipeCommandTest.java b/src/test/java/guru/springframework/converters/RecipeToRecipeCommandTest.java
index 9bf0d75d14..f2de35cf5f 100644
--- a/src/test/java/guru/springframework/converters/RecipeToRecipeCommandTest.java
+++ b/src/test/java/guru/springframework/converters/RecipeToRecipeCommandTest.java
@@ -2,10 +2,11 @@
import guru.springframework.commands.RecipeCommand;
import guru.springframework.domain.*;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
-import static org.junit.Assert.*;
public class RecipeToRecipeCommandTest {
@@ -25,7 +26,7 @@ public class RecipeToRecipeCommandTest {
public static final Long NOTES_ID = 9L;
RecipeToRecipeCommand converter;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
converter = new RecipeToRecipeCommand(
new CategoryToCategoryCommand(),
diff --git a/src/test/java/guru/springframework/converters/UnitOfMeasureCommandToUnitOfMeasureTest.java b/src/test/java/guru/springframework/converters/UnitOfMeasureCommandToUnitOfMeasureTest.java
index 820f5d52bf..dc3ffcb2b9 100644
--- a/src/test/java/guru/springframework/converters/UnitOfMeasureCommandToUnitOfMeasureTest.java
+++ b/src/test/java/guru/springframework/converters/UnitOfMeasureCommandToUnitOfMeasureTest.java
@@ -2,10 +2,10 @@
import guru.springframework.commands.UnitOfMeasureCommand;
import guru.springframework.domain.UnitOfMeasure;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
public class UnitOfMeasureCommandToUnitOfMeasureTest {
@@ -14,7 +14,7 @@ public class UnitOfMeasureCommandToUnitOfMeasureTest {
UnitOfMeasureCommandToUnitOfMeasure converter;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
converter = new UnitOfMeasureCommandToUnitOfMeasure();
diff --git a/src/test/java/guru/springframework/converters/UnitOfMeasureToUnitOfMeasureCommandTest.java b/src/test/java/guru/springframework/converters/UnitOfMeasureToUnitOfMeasureCommandTest.java
index 68a3257077..6135632430 100644
--- a/src/test/java/guru/springframework/converters/UnitOfMeasureToUnitOfMeasureCommandTest.java
+++ b/src/test/java/guru/springframework/converters/UnitOfMeasureToUnitOfMeasureCommandTest.java
@@ -2,10 +2,11 @@
import guru.springframework.commands.UnitOfMeasureCommand;
import guru.springframework.domain.UnitOfMeasure;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
-import static org.junit.Assert.*;
/**
* Created by jt on 6/21/17.
@@ -17,7 +18,7 @@ public class UnitOfMeasureToUnitOfMeasureCommandTest {
UnitOfMeasureToUnitOfMeasureCommand converter;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
converter = new UnitOfMeasureToUnitOfMeasureCommand();
}
diff --git a/src/test/java/guru/springframework/domain/CategoryTest.java b/src/test/java/guru/springframework/domain/CategoryTest.java
index 11badc457f..c10b9d569e 100644
--- a/src/test/java/guru/springframework/domain/CategoryTest.java
+++ b/src/test/java/guru/springframework/domain/CategoryTest.java
@@ -1,9 +1,9 @@
package guru.springframework.domain;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Created by jt on 6/17/17.
@@ -12,7 +12,7 @@ public class CategoryTest {
Category category;
- @Before
+ @BeforeEach
public void setUp(){
category = new Category();
}
diff --git a/src/test/java/guru/springframework/repositories/UnitOfMeasureRepositoryIT.java b/src/test/java/guru/springframework/repositories/UnitOfMeasureRepositoryIT.java
index b934959591..fd96ac3c18 100644
--- a/src/test/java/guru/springframework/repositories/UnitOfMeasureRepositoryIT.java
+++ b/src/test/java/guru/springframework/repositories/UnitOfMeasureRepositoryIT.java
@@ -1,28 +1,26 @@
package guru.springframework.repositories;
import guru.springframework.domain.UnitOfMeasure;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.Optional;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Created by jt on 6/17/17.
*/
-@RunWith(SpringRunner.class)
@DataJpaTest
public class UnitOfMeasureRepositoryIT {
@Autowired
UnitOfMeasureRepository unitOfMeasureRepository;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
}
diff --git a/src/test/java/guru/springframework/services/IngredientServiceImplTest.java b/src/test/java/guru/springframework/services/IngredientServiceImplTest.java
index d8442ab99b..22268986e6 100644
--- a/src/test/java/guru/springframework/services/IngredientServiceImplTest.java
+++ b/src/test/java/guru/springframework/services/IngredientServiceImplTest.java
@@ -9,14 +9,14 @@
import guru.springframework.domain.Recipe;
import guru.springframework.repositories.RecipeRepository;
import guru.springframework.repositories.UnitOfMeasureRepository;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.util.Optional;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.*;
@@ -39,7 +39,7 @@ public IngredientServiceImplTest() {
this.ingredientCommandToIngredient = new IngredientCommandToIngredient(new UnitOfMeasureCommandToUnitOfMeasure());
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
diff --git a/src/test/java/guru/springframework/services/RecipeServiceIT.java b/src/test/java/guru/springframework/services/RecipeServiceIT.java
index f8702b99c2..0e2c59a315 100644
--- a/src/test/java/guru/springframework/services/RecipeServiceIT.java
+++ b/src/test/java/guru/springframework/services/RecipeServiceIT.java
@@ -5,20 +5,18 @@
import guru.springframework.converters.RecipeToRecipeCommand;
import guru.springframework.domain.Recipe;
import guru.springframework.repositories.RecipeRepository;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Created by jt on 6/21/17.
*/
-@RunWith(SpringRunner.class)
@SpringBootTest
public class RecipeServiceIT {
diff --git a/src/test/java/guru/springframework/services/RecipeServiceImplTest.java b/src/test/java/guru/springframework/services/RecipeServiceImplTest.java
index 151a42197d..04da7a7c22 100644
--- a/src/test/java/guru/springframework/services/RecipeServiceImplTest.java
+++ b/src/test/java/guru/springframework/services/RecipeServiceImplTest.java
@@ -6,8 +6,8 @@
import guru.springframework.converters.RecipeToRecipeCommand;
import guru.springframework.domain.Recipe;
import guru.springframework.repositories.RecipeRepository;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -15,9 +15,10 @@
import java.util.Optional;
import java.util.Set;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.*;
+import static org.springframework.test.util.AssertionErrors.assertNotNull;
/**
* Created by jt on 6/17/17.
@@ -35,7 +36,7 @@ public class RecipeServiceImplTest {
@Mock
RecipeCommandToRecipe recipeCommandToRecipe;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
diff --git a/src/test/java/guru/springframework/services/UnitOfMeasureServiceImplTest.java b/src/test/java/guru/springframework/services/UnitOfMeasureServiceImplTest.java
index d055bd519b..8b5696e8e0 100644
--- a/src/test/java/guru/springframework/services/UnitOfMeasureServiceImplTest.java
+++ b/src/test/java/guru/springframework/services/UnitOfMeasureServiceImplTest.java
@@ -4,15 +4,15 @@
import guru.springframework.converters.UnitOfMeasureToUnitOfMeasureCommand;
import guru.springframework.domain.UnitOfMeasure;
import guru.springframework.repositories.UnitOfMeasureRepository;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.util.HashSet;
import java.util.Set;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.*;
public class UnitOfMeasureServiceImplTest {
@@ -23,7 +23,7 @@ public class UnitOfMeasureServiceImplTest {
@Mock
UnitOfMeasureRepository unitOfMeasureRepository;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);