@Test void testServiceDockerfile() throws MalformedURLException { Optional<String> type = MediaTypes.detectType(new URL("http", "localhost", 80, "/test/Dockerfile.native")); assertThat(type, is(Optional.of(DockerfileTypeDetector.MEDIA_TYPE))); type = MediaTypes.detectType(URI.create("http: assertThat(type, is(Optional.of(DockerfileTypeDetector.MEDIA_TYPE))); type = MediaTypes.detectType("some text pointing to a file: Dockerfile"); assertThat(type, is(Optional.of(DockerfileTypeDetector.MEDIA_TYPE))); }
public static Optional<String> detectType(URL url) { return DETECTORS.stream() .map(mtd -> mtd.detectType(url)) .flatMap(Optional::stream) .findFirst(); }
MediaTypes { public static Optional<String> detectType(URL url) { return DETECTORS.stream() .map(mtd -> mtd.detectType(url)) .flatMap(Optional::stream) .findFirst(); } }
MediaTypes { public static Optional<String> detectType(URL url) { return DETECTORS.stream() .map(mtd -> mtd.detectType(url)) .flatMap(Optional::stream) .findFirst(); } private  MediaTypes(); }
MediaTypes { public static Optional<String> detectType(URL url) { return DETECTORS.stream() .map(mtd -> mtd.detectType(url)) .flatMap(Optional::stream) .findFirst(); } private  MediaTypes(); static Optional<String> detectType(URL url); static Optional<String> detectType(URI uri); static Optional<String> detectType(Path file); static Optional<String> detectType(String fileName); static Optional<String> detectExtensionType(String fileSuffix); }
MediaTypes { public static Optional<String> detectType(URL url) { return DETECTORS.stream() .map(mtd -> mtd.detectType(url)) .flatMap(Optional::stream) .findFirst(); } private  MediaTypes(); static Optional<String> detectType(URL url); static Optional<String> detectType(URI uri); static Optional<String> detectType(Path file); static Optional<String> detectType(String fileName); static Optional<String> detectExtensionType(String fileSuffix);  }