### Question:
UnixDomainHttpEndpoint { static UnixDomainHttpEndpoint parseFrom(URI endpoint) { final Path path = Paths.get(endpoint.getPath()); final int sockPathIndex = indexOfSockFile(path); final String filePath = "/" + path.subpath(0, sockPathIndex + 1).toString(); final File unixDomainFile = new File(filePath); if (sockPathIndex == path.getNameCount() - 1) { return new UnixDomainHttpEndpoint(unixDomainFile, "/"); } String pathSegment = "/" + path.subpath(sockPathIndex + 1, path.getNameCount()).toString(); return new UnixDomainHttpEndpoint(unixDomainFile, pathSegment); } private  UnixDomainHttpEndpoint(File unixDomainFile, String endpoint);   }### Answer:
@Test public void splitOnlyWithFile() { UnixDomainHttpEndpoint out = UnixDomainHttpEndpoint.parseFrom(URI.create("http+unix: assertEquals("/some/path.sock", out.unixDomainFile.toString()); assertEquals("/", out.pathSegment); }
@Test public void splitOnlyWithFileAndEndpoint() { UnixDomainHttpEndpoint out = UnixDomainHttpEndpoint.parseFrom(URI.create("http+unix: assertEquals("/some/path.sock", out.unixDomainFile.toString()); assertEquals("/hello", out.pathSegment); }
@Test(expected = IllegalStateException.class) public void missingSockFile() { UnixDomainHttpEndpoint.parseFrom(URI.create("http+unix: }