Skip to content

Instantly share code, notes, and snippets.

@dotkebi
Created June 14, 2017 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotkebi/f7e14599640736c0d83b29b6ac299aa1 to your computer and use it in GitHub Desktop.
Save dotkebi/f7e14599640736c0d83b29b6ac299aa1 to your computer and use it in GitHub Desktop.
ExampleMatacherTest.java
@RunWith(SpringRunner.class)
@SpringBootTest
public class ExampleMatcherTest {
@Autowired
private ExampleRepository repository;
@Test
public void exampleTest() {
Child child = new Child();
child.setName("C");
Parent parent = new Parent();
parent.setChild(child);
ExampleMatcher matcher = ExampleMatcher.matching()
.withIgnoreNullValues()
.withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING);
Example<Parent> example = Example.of(parent, matcher);
assertTrue(repository.findAll(example).size > 0);
}
}
public interface ExampleRepository extends JpaRepository<Parent, Long> {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment