How to implement ExampleMatcher, to match just one property randomly from my class and ignore the other properties?
Assume my class like this :
Public Class Teacher() {
String id;
String name;
String address;
String phone;
int area;
..other properties is here...
}
If I want to match by the name:
Teacher TeacherExample = new Teacher("Peter");
ExampleMatcher matcher = ExampleMatcher.matchingAny()
.withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING)
.withIgnoreCase()
.withIgnorePaths("id", "address", "phone","area",...); //no name
and if I want to match by the address:
ExampleMatcher matcher = ExampleMatcher.matchingAny()
.withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING)
.withIgnoreCase()
.withIgnorePaths("id", "name", "phone","area",...); //no address
so I need to repeat the withIgnorePaths(..)
How to avoid that?