Skip to content

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

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: delete-ingredient
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
Updated to Java 17, Spring Boot 2.7.2, and JUnit 5
  • Loading branch information
ximanta committed Oct 14, 2022
commit faf829a1cb40047421717f19a5208271c8555c0e
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
@@ -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);

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,7 +36,7 @@ public class IngredientControllerTest {

MockMvc mockMvc;

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

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,7 +30,7 @@ public class RecipeControllerTest {

MockMvc mockMvc;

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

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

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

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.
@@ -25,7 +26,7 @@ public class IngredientToIngredientCommandTest {

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,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();

Original file line number Diff line number Diff line change
@@ -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();
}
Original file line number Diff line number Diff line change
@@ -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()),
Original file line number Diff line number Diff line change
@@ -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(),
Original file line number Diff line number Diff line change
@@ -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();

Original file line number Diff line number Diff line change
@@ -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();
}
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.
@@ -12,7 +12,7 @@ public class CategoryTest {

Category category;

@Before
@BeforeEach
public void setUp(){
category = new Category();
}
Loading
Oops, something went wrong.