Java 16 migration for Map repository examples.

See #606.
This commit is contained in:
Mark Paluch
2021-04-28 10:52:43 +02:00
parent a4c9302780
commit 20dfd398c8
3 changed files with 24 additions and 16 deletions

View File

@@ -17,9 +17,8 @@ package example.springdata.map;
import static org.assertj.core.api.Assertions.*;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
@@ -43,7 +42,7 @@ class PersonRepositoryIntegrationTest {
@Test
void storesPerson() {
Person person = repository.save(new Person("Dave", "Matthews", 47));
var person = repository.save(new Person("Dave", "Matthews", 47));
assertThat(repository.findById(person.getId())).hasValue(person);
}
@@ -51,12 +50,11 @@ class PersonRepositoryIntegrationTest {
@Test
void findsPersonByAge() {
Person dave = repository.save(new Person("Dave", "Matthews", 47));
Person oliver = repository.save(new Person("Oliver August", "Matthews", 7));
var dave = repository.save(new Person("Dave", "Matthews", 47));
var oliver = repository.save(new Person("Oliver August", "Matthews", 7));
List<Person> result = repository.findByAgeGreaterThan(18);
var result = repository.findByAgeGreaterThan(18);
assertThat(result).contains(dave);
assertThat(result).doesNotContain(oliver);
assertThat(result).contains(dave).doesNotContain(oliver);
}
}