Skip to content

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

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: display-enum-list
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Expand Up @@ -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>
Expand Down
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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

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 {

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

@Before
@BeforeEach
public void setUp() throws Exception {
conveter = new CategoryCommandToCategory();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
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 {

Expand All @@ -21,7 +22,7 @@ public class IngredientCommandToIngredientTest {

IngredientCommandToIngredient converter;

@Before
@BeforeEach
public void setUp() throws Exception {
converter = new IngredientCommandToIngredient(new UnitOfMeasureCommandToUnitOfMeasure());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -25,7 +26,7 @@ public class IngredientToIngredientCommandTest {

IngredientToIngredientCommand converter;

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

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 {

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

public class UnitOfMeasureCommandToUnitOfMeasureTest {

Expand All @@ -14,7 +15,7 @@ public class UnitOfMeasureCommandToUnitOfMeasureTest {

UnitOfMeasureCommandToUnitOfMeasure converter;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

/**
* Created by jt on 6/21/17.
Expand All @@ -17,7 +17,7 @@ public class UnitOfMeasureToUnitOfMeasureCommandTest {

UnitOfMeasureToUnitOfMeasureCommand converter;

@Before
@BeforeEach
public void setUp() throws Exception {
converter = new UnitOfMeasureToUnitOfMeasureCommand();
}
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/guru/springframework/domain/CategoryTest.java
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -12,7 +12,7 @@ public class CategoryTest {

Category category;

@Before
@BeforeEach
public void setUp(){
category = new Category();
}
Expand Down
Loading