Skip to content
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

Updates to Spring Boot 2.7.2, Java 17, JUnit 5 #22

Open
wants to merge 1 commit into
base: integration-testing-mongodb
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
- image: cimg/openjdk:17.0.5

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
Expand Down
27 changes: 16 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext {
springBootVersion = '2.1.0.RELEASE'
springBootVersion = '2.7.2'
}
repositories {
mavenCentral()
Expand All @@ -19,7 +19,7 @@ apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'

version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
sourceCompatibility = 17

repositories {
mavenCentral()
Expand All @@ -29,15 +29,20 @@ repositories {


dependencies {
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('org.springframework.boot:spring-boot-devtools')
compile('de.flapdoodle.embed:de.flapdoodle.embed.mongo')
compile group: 'cz.jirutka.spring', name: 'embedmongo-spring', version: '1.3.1'
compile 'org.webjars:bootstrap:3.3.7-1'
compileOnly('org.projectlombok:lombok')
testCompile('org.springframework.boot:spring-boot-starter-test')
implementation('de.flapdoodle.embed:de.flapdoodle.embed.mongo')
testImplementation group: 'cz.jirutka.spring', name: 'embedmongo-spring', version: '1.3.1'
implementation('org.springframework.boot:spring-boot-starter-data-mongodb')
implementation('org.springframework.boot:spring-boot-starter-thymeleaf')
implementation('org.springframework.boot:spring-boot-starter-web')
runtimeOnly('org.springframework.boot:spring-boot-devtools')
implementation 'org.webjars:bootstrap:3.3.7-1'
compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.20'
testImplementation 'org.hamcrest:hamcrest:2.2'
testCompileOnly 'org.projectlombok:lombok:1.18.20'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.20'
testImplementation('org.springframework.boot:spring-boot-starter-test')
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: '2.7.5'
}

//export test coverage
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
3 changes: 2 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
spring.data.mongodb.port=0
spring.data.mongodb.host=localhost
spring.data.mongodb.host=localhost
spring.mongodb.embedded.version=4.0.21
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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 @@ -3,16 +3,16 @@
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.MockHttpServletResponse;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

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.request.MockMvcRequestBuilders.multipart;
Expand All @@ -30,9 +30,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)
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,7 +33,7 @@ public class IndexControllerTest {

IndexController controller;

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

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 @@ -4,8 +4,8 @@
import guru.springframework.domain.Recipe;
import guru.springframework.exceptions.NotFoundException;
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 @@ -31,7 +31,7 @@ public class RecipeControllerTest {

MockMvc mockMvc;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

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 com.mongodb.assertions.Assertions.assertNull;
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class CategoryCommandToCategoryTest {

public static final String ID_VALUE = "1";
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,12 @@

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 com.mongodb.assertions.Assertions.assertNull;
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* Created by jt on 6/21/17.
Expand All @@ -16,7 +18,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,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 com.mongodb.assertions.Assertions.assertNull;
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class IngredientCommandToIngredientTest {

Expand All @@ -21,7 +23,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,14 @@
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 com.mongodb.assertions.Assertions.assertNull;
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* Created by jt on 6/21/17.
Expand All @@ -25,7 +27,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,20 @@

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 com.mongodb.assertions.Assertions.assertNull;
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class NotesCommandToNotesTest {

public static final String ID_VALUE = "1";
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,12 @@

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 com.mongodb.assertions.Assertions.assertNull;
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* Created by jt on 6/21/17.
Expand All @@ -16,7 +18,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,12 @@
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 com.mongodb.assertions.Assertions.assertNull;
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class RecipeCommandToRecipeTest {
public static final String RECIPE_ID = "1";
Expand All @@ -30,7 +32,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,13 @@

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 com.mongodb.assertions.Assertions.assertNull;
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;

import static org.junit.Assert.*;

public class RecipeToRecipeCommandTest {

Expand All @@ -25,7 +28,7 @@ public class RecipeToRecipeCommandTest {
public static final String NOTES_ID = "9";
RecipeToRecipeCommand converter;

@Before
@BeforeEach
public void setUp() throws Exception {
converter = new RecipeToRecipeCommand(
new CategoryToCategoryCommand(),
Expand Down
Loading