I have the following test code which checks the content of a particular directory structure
assertThat(install_should_not_fail).isDirectory().satisfies(isnf -> {
assertThat(new File(isnf, "maven-metadata-local.xml")).isNotEmpty();
assertThat(new File(isnf, "1.0")).isDirectory().satisfies(v10 -> {
assertThat(v10).satisfies(file -> {
assertThat(new File(file, "install_should_not_fail-1.0.jar")).isNotEmpty();
assertThat(new File(file, "install_should_not_fail-1.0.pom")).isNotEmpty();
assertThat(new File(file, "_remote.repositories")).isNotEmpty();
});
});
});
and I have several tests which do very similar things. The question is: Can that be made simpler (I know I could refactor out a method which contains exactly that code) but I'm interested more in getting the above code simpler using AssertJ if it's possible?
Aucun commentaire:
Enregistrer un commentaire