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

Update to Spring Boot v2.7.0 #6

Open
wants to merge 2 commits into
base: master
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
22 changes: 22 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Verify

on:
pull_request:
branches:
- master

jobs:
compile:
runs-on: ubuntu-latest
strategy:
matrix:
java: [17]
name: Java ${{ matrix.java }} compile and run tests
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'adopt-hotspot'
- name: Compile with Java ${{ matrix.java }}
run: mvn test --no-transfer-progress
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.5</version>
<version>2.7.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class SuperHeroControllerMockMvcStandaloneTest {
private JacksonTester<SuperHero> jsonSuperHero;

@BeforeEach
public void setup() {
void setup() {
// We would need this line if we would not use the MockitoExtension
// MockitoAnnotations.initMocks(this);
// Here we can't use @AutoConfigureJsonTesters because there isn't a Spring context
Expand All @@ -57,7 +57,7 @@ public void setup() {
}

@Test
public void canRetrieveByIdWhenExists() throws Exception {
void canRetrieveByIdWhenExists() throws Exception {
// given
given(superHeroRepository.getSuperHero(2))
.willReturn(new SuperHero("Rob", "Mannon", "RobotMan"));
Expand All @@ -76,7 +76,7 @@ public void canRetrieveByIdWhenExists() throws Exception {
}

@Test
public void canRetrieveByIdWhenDoesNotExist() throws Exception {
void canRetrieveByIdWhenDoesNotExist() throws Exception {
// given
given(superHeroRepository.getSuperHero(2))
.willThrow(new NonExistingHeroException());
Expand All @@ -93,7 +93,7 @@ public void canRetrieveByIdWhenDoesNotExist() throws Exception {
}

@Test
public void canRetrieveByNameWhenExists() throws Exception {
void canRetrieveByNameWhenExists() throws Exception {
// given
given(superHeroRepository.getSuperHero("RobotMan"))
.willReturn(Optional.of(new SuperHero("Rob", "Mannon", "RobotMan")));
Expand All @@ -112,7 +112,7 @@ public void canRetrieveByNameWhenExists() throws Exception {
}

@Test
public void canRetrieveByNameWhenDoesNotExist() throws Exception {
void canRetrieveByNameWhenDoesNotExist() throws Exception {
// given
given(superHeroRepository.getSuperHero("RobotMan"))
.willReturn(Optional.empty());
Expand All @@ -129,7 +129,7 @@ public void canRetrieveByNameWhenDoesNotExist() throws Exception {
}

@Test
public void canCreateANewSuperHero() throws Exception {
void canCreateANewSuperHero() throws Exception {
// when
MockHttpServletResponse response = mvc.perform(
post("/superheroes/").contentType(MediaType.APPLICATION_JSON).content(
Expand All @@ -141,7 +141,7 @@ public void canCreateANewSuperHero() throws Exception {
}

@Test
public void headerIsPresent() throws Exception {
void headerIsPresent() throws Exception {
// when
MockHttpServletResponse response = mvc.perform(
get("/superheroes/2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class SuperHeroControllerMockMvcWithContextTest {
private JacksonTester<SuperHero> jsonSuperHero;

@Test
public void canRetrieveByIdWhenExists() throws Exception {
void canRetrieveByIdWhenExists() throws Exception {
// given
given(superHeroRepository.getSuperHero(2))
.willReturn(new SuperHero("Rob", "Mannon", "RobotMan"));
Expand All @@ -60,7 +60,7 @@ public void canRetrieveByIdWhenExists() throws Exception {
}

@Test
public void canRetrieveByIdWhenDoesNotExist() throws Exception {
void canRetrieveByIdWhenDoesNotExist() throws Exception {
// given
given(superHeroRepository.getSuperHero(2))
.willThrow(new NonExistingHeroException());
Expand All @@ -77,7 +77,7 @@ public void canRetrieveByIdWhenDoesNotExist() throws Exception {
}

@Test
public void canRetrieveByNameWhenExists() throws Exception {
void canRetrieveByNameWhenExists() throws Exception {
// given
given(superHeroRepository.getSuperHero("RobotMan"))
.willReturn(Optional.of(new SuperHero("Rob", "Mannon", "RobotMan")));
Expand All @@ -96,7 +96,7 @@ public void canRetrieveByNameWhenExists() throws Exception {
}

@Test
public void canRetrieveByNameWhenDoesNotExist() throws Exception {
void canRetrieveByNameWhenDoesNotExist() throws Exception {
// given
given(superHeroRepository.getSuperHero("RobotMan"))
.willReturn(Optional.empty());
Expand All @@ -113,7 +113,7 @@ public void canRetrieveByNameWhenDoesNotExist() throws Exception {
}

@Test
public void canCreateANewSuperHero() throws Exception {
void canCreateANewSuperHero() throws Exception {
// when
MockHttpServletResponse response = mvc.perform(
post("/superheroes/").contentType(MediaType.APPLICATION_JSON).content(
Expand All @@ -125,7 +125,7 @@ public void canCreateANewSuperHero() throws Exception {
}

@Test
public void headerIsPresent() throws Exception {
void headerIsPresent() throws Exception {
// when
MockHttpServletResponse response = mvc.perform(
get("/superheroes/2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class SuperHeroControllerSpringBootMockTest {
private JacksonTester<SuperHero> jsonSuperHero;

@Test
public void canRetrieveByIdWhenExists() throws Exception {
void canRetrieveByIdWhenExists() throws Exception {
// given
given(superHeroRepository.getSuperHero(2))
.willReturn(new SuperHero("Rob", "Mannon", "RobotMan"));
Expand All @@ -63,7 +63,7 @@ public void canRetrieveByIdWhenExists() throws Exception {
}

@Test
public void canRetrieveByIdWhenDoesNotExist() throws Exception {
void canRetrieveByIdWhenDoesNotExist() throws Exception {
// given
given(superHeroRepository.getSuperHero(2))
.willThrow(new NonExistingHeroException());
Expand All @@ -80,7 +80,7 @@ public void canRetrieveByIdWhenDoesNotExist() throws Exception {
}

@Test
public void canRetrieveByNameWhenExists() throws Exception {
void canRetrieveByNameWhenExists() throws Exception {
// given
given(superHeroRepository.getSuperHero("RobotMan"))
.willReturn(Optional.of(new SuperHero("Rob", "Mannon", "RobotMan")));
Expand All @@ -99,7 +99,7 @@ public void canRetrieveByNameWhenExists() throws Exception {
}

@Test
public void canRetrieveByNameWhenDoesNotExist() throws Exception {
void canRetrieveByNameWhenDoesNotExist() throws Exception {
// given
given(superHeroRepository.getSuperHero("RobotMan"))
.willReturn(Optional.empty());
Expand All @@ -116,7 +116,7 @@ public void canRetrieveByNameWhenDoesNotExist() throws Exception {
}

@Test
public void canCreateANewSuperHero() throws Exception {
void canCreateANewSuperHero() throws Exception {
// when
MockHttpServletResponse response = mvc.perform(
post("/superheroes/").contentType(MediaType.APPLICATION_JSON).content(
Expand All @@ -128,7 +128,7 @@ public void canCreateANewSuperHero() throws Exception {
}

@Test
public void headerIsPresent() throws Exception {
void headerIsPresent() throws Exception {
// when
MockHttpServletResponse response = mvc.perform(
get("/superheroes/2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class SuperHeroControllerSpringBootTest {
private TestRestTemplate restTemplate;

@Test
public void canRetrieveByIdWhenExists() {
void canRetrieveByIdWhenExists() {
// given
given(superHeroRepository.getSuperHero(2))
.willReturn(new SuperHero("Rob", "Mannon", "RobotMan"));
Expand All @@ -47,7 +47,7 @@ public void canRetrieveByIdWhenExists() {
}

@Test
public void canRetrieveByIdWhenDoesNotExist() {
void canRetrieveByIdWhenDoesNotExist() {
// given
given(superHeroRepository.getSuperHero(2))
.willThrow(new NonExistingHeroException());
Expand All @@ -61,7 +61,7 @@ public void canRetrieveByIdWhenDoesNotExist() {
}

@Test
public void canRetrieveByNameWhenExists() {
void canRetrieveByNameWhenExists() {
// given
given(superHeroRepository.getSuperHero("RobotMan"))
.willReturn(Optional.of(new SuperHero("Rob", "Mannon", "RobotMan")));
Expand All @@ -76,7 +76,7 @@ public void canRetrieveByNameWhenExists() {
}

@Test
public void canRetrieveByNameWhenDoesNotExist() {
void canRetrieveByNameWhenDoesNotExist() {
// given
given(superHeroRepository.getSuperHero("RobotMan"))
.willReturn(Optional.empty());
Expand All @@ -91,7 +91,7 @@ public void canRetrieveByNameWhenDoesNotExist() {
}

@Test
public void canCreateANewSuperHero() {
void canCreateANewSuperHero() {
// when
ResponseEntity<SuperHero> superHeroResponse = restTemplate.postForEntity("/superheroes/",
new SuperHero("Rob", "Mannon", "RobotMan"), SuperHero.class);
Expand All @@ -101,7 +101,7 @@ public void canCreateANewSuperHero() {
}

@Test
public void headerIsPresent() throws Exception {
void headerIsPresent() throws Exception {
// when
ResponseEntity<SuperHero> superHeroResponse = restTemplate.getForEntity("/superheroes/2", SuperHero.class);

Expand Down