@Test
public void canFindFileWithNonExactMatch() {

    Optional<FileLocator.FileResult> result = fileLocator.find("p1/hello", emptyList());
    assertTrue(result.isPresent());
    // either JSON or XML file could be returned
    File jsonFile = rootDir.resolve("p1/hello.json").toFile();
    File xmlFile = rootDir.resolve("p1/hello.xml").toFile();
    File actualFile = result.get().file;
    if (actualFile.equals(jsonFile)) {
        assertEquals(singletonList("application/json"), result.get().fileHttpHeaders.get("Content-Type"));
        assertTimestampIsWithinSecondsAgo(result.get().fileHttpHeaders.getFirst("Last-Modified").orElse("none"));
    } else if (actualFile.equals(xmlFile)) {
        assertEquals(singletonList("text/xml"), result.get().fileHttpHeaders.get("Content-Type"));
        assertTimestampIsWithinSecondsAgo(result.get().fileHttpHeaders.getFirst("Last-Modified").orElse("none"));
    } else {
        fail("Found file is not as expected: " + actualFile);
    }
}