Skip to content

Commit fd4ec6f

Browse files
Added integration test to reproduce a problem with parameter parsing.
1 parent 1fbbb85 commit fd4ec6f

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

47703096/src/test/java/org/example/data/PersonRepositoryTests.java

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package org.example.data;
22

3+
import org.example.domain.Person;
34
import org.junit.Test;
45
import org.junit.runner.RunWith;
56
import org.springframework.beans.factory.annotation.Autowired;
67
import org.springframework.boot.test.context.SpringBootTest;
78
import org.springframework.test.context.junit4.SpringRunner;
89

9-
import static org.junit.Assert.assertNotNull;
10+
import java.util.List;
11+
import java.util.UUID;
12+
13+
import static org.junit.Assert.*;
1014

1115
@RunWith(SpringRunner.class)
1216
@SpringBootTest
@@ -15,6 +19,31 @@ public class PersonRepositoryTests
1519
@Autowired
1620
private PersonRepository repository;
1721

22+
@Test
23+
public void testFindByFirstName()
24+
{
25+
final String firstName = UUID.randomUUID().toString(), lastName = "001:1";
26+
27+
final Person person = new Person();
28+
person.setFirstName(firstName);
29+
person.setLastName(lastName);
30+
31+
repository.save(person);
32+
33+
final List<Person> results = repository.findByFirstName(firstName);
34+
35+
assertNotNull(results);
36+
assertFalse(results.isEmpty());
37+
38+
results.forEach(person1 -> {
39+
assertNotNull(person);
40+
assertNotNull(person.getFirstName());
41+
assertNotNull(person.getLastName());
42+
assertEquals(firstName, person.getFirstName());
43+
assertEquals(lastName, person.getLastName());
44+
});
45+
}
46+
1847
@Test
1948
public void testFindByFirstNameAndLastName()
2049
{

0 commit comments

Comments
 (0)