Skip to content

Updated to Java 17, Spring Boot 2.7.2, and JUnit 5 #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: save-image-to-db
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -14,14 +14,14 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<version>2.7.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<java.version>17</java.version>
</properties>

<dependencies>
5 changes: 4 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
logging.level.guru.springframework=debug
logging.level.guru.springframework=debug
spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:mydb
spring.jpa.defer-datasource-initialization=true
Original file line number Diff line number Diff line change
@@ -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 {

Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@
import guru.springframework.commands.RecipeCommand;
import guru.springframework.services.ImageService;
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.mock.web.MockMultipartFile;
@@ -28,9 +28,9 @@ public class ImageControllerTest {

MockMvc mockMvc;

@Before
@BeforeEach
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
MockitoAnnotations.openMocks(this);

controller = new ImageController(imageService, recipeService);
mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
Original file line number Diff line number Diff line change
@@ -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,9 +33,9 @@ public class IndexControllerTest {

IndexController controller;

@Before
@BeforeEach
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
MockitoAnnotations.openMocks(this);

controller = new IndexController(recipeService);
}
Original file line number Diff line number Diff line change
@@ -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,9 +36,9 @@ public class IngredientControllerTest {

MockMvc mockMvc;

@Before
@BeforeEach
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
MockitoAnnotations.openMocks(this);

controller = new IngredientController(ingredientService, recipeService, unitOfMeasureService);
mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
Original file line number Diff line number Diff line change
@@ -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,9 +30,9 @@ public class RecipeControllerTest {

MockMvc mockMvc;

@Before
@BeforeEach
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
MockitoAnnotations.openMocks(this);

controller = new RecipeController(recipeService);
mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
Original file line number Diff line number Diff line change
@@ -2,18 +2,19 @@

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.*;

public class CategoryCommandToCategoryTest {

public static final Long ID_VALUE = new Long(1L);
public static final Long ID_VALUE = Long.valueOf(1L);
public static final String DESCRIPTION = "description";
CategoryCommandToCategory conveter;

@Before
@BeforeEach
public void setUp() throws Exception {
conveter = new CategoryCommandToCategory();
}
Original file line number Diff line number Diff line change
@@ -2,21 +2,21 @@

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.*;

/**
* Created by jt on 6/21/17.
*/
public class CategoryToCategoryCommandTest {

public static final Long ID_VALUE = new Long(1L);
public static final Long ID_VALUE = Long.valueOf(1L);
public static final String DESCRIPTION = "descript";
CategoryToCategoryCommand convter;

@Before
@BeforeEach
public void setUp() throws Exception {
convter = new CategoryToCategoryCommand();
}
Original file line number Diff line number Diff line change
@@ -4,24 +4,25 @@
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 {

public static final Recipe RECIPE = new Recipe();
public static final BigDecimal AMOUNT = new BigDecimal("1");
public static final String DESCRIPTION = "Cheeseburger";
public static final Long ID_VALUE = new Long(1L);
public static final Long UOM_ID = new Long(2L);
public static final Long ID_VALUE = Long.valueOf(1L);
public static final Long UOM_ID = Long.valueOf(2L);

IngredientCommandToIngredient converter;

@Before
@BeforeEach
public void setUp() throws Exception {
converter = new IngredientCommandToIngredient(new UnitOfMeasureCommandToUnitOfMeasure());
}
Original file line number Diff line number Diff line change
@@ -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.
@@ -19,13 +20,13 @@ public class IngredientToIngredientCommandTest {
public static final Recipe RECIPE = new Recipe();
public static final BigDecimal AMOUNT = new BigDecimal("1");
public static final String DESCRIPTION = "Cheeseburger";
public static final Long UOM_ID = new Long(2L);
public static final Long ID_VALUE = new Long(1L);
public static final Long UOM_ID = Long.valueOf(2L);
public static final Long ID_VALUE = Long.valueOf(1L);


IngredientToIngredientCommand converter;

@Before
@BeforeEach
public void setUp() throws Exception {
converter = new IngredientToIngredientCommand(new UnitOfMeasureToUnitOfMeasureCommand());
}
Original file line number Diff line number Diff line change
@@ -2,18 +2,18 @@

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.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

public class NotesCommandToNotesTest {

public static final Long ID_VALUE = new Long(1L);
public static final Long ID_VALUE = Long.valueOf(1L);
public static final String RECIPE_NOTES = "Notes";
NotesCommandToNotes converter;

@Before
@BeforeEach
public void setUp() throws Exception {
converter = new NotesCommandToNotes();

Original file line number Diff line number Diff line change
@@ -2,21 +2,22 @@

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.
*/
public class NotesToNotesCommandTest {

public static final Long ID_VALUE = new Long(1L);
public static final Long ID_VALUE = Long.valueOf(1L);
public static final String RECIPE_NOTES = "Notes";
NotesToNotesCommand converter;

@Before
@BeforeEach
public void setUp() throws Exception {
converter = new NotesToNotesCommand();
}
Original file line number Diff line number Diff line change
@@ -6,10 +6,11 @@
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.jupiter.api.Assertions.*;

import static org.junit.Assert.*;

public class RecipeCommandToRecipeTest {
public static final Long RECIPE_ID = 1L;
@@ -30,7 +31,7 @@ public class RecipeCommandToRecipeTest {
RecipeCommandToRecipe converter;


@Before
@BeforeEach
public void setUp() throws Exception {
converter = new RecipeCommandToRecipe(new CategoryCommandToCategory(),
new IngredientCommandToIngredient(new UnitOfMeasureCommandToUnitOfMeasure()),
Original file line number Diff line number Diff line change
@@ -2,10 +2,10 @@

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.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

public class RecipeToRecipeCommandTest {

@@ -25,7 +25,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(),
Original file line number Diff line number Diff line change
@@ -2,19 +2,20 @@

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.*;

public class UnitOfMeasureCommandToUnitOfMeasureTest {

public static final String DESCRIPTION = "description";
public static final Long LONG_VALUE = new Long(1L);
public static final Long LONG_VALUE = Long.valueOf(1L);

UnitOfMeasureCommandToUnitOfMeasure converter;

@Before
@BeforeEach
public void setUp() throws Exception {
converter = new UnitOfMeasureCommandToUnitOfMeasure();

Loading
Oops, something went wrong.