### Question:
RefUtils { public static Optional<String> getExternalPath(String ref) { if (ref == null) { return Optional.empty(); } return Optional.of(ref.split(REFERENCE_SEPARATOR)) .filter(it -> it.length == 2) .map(it -> it[0]) .filter(it -> !it.isEmpty()); } private  RefUtils(); static String computeDefinitionName(String ref); static Optional<String> getExternalPath(String ref); static boolean isAnExternalRefFormat(RefFormat refFormat); static RefFormat computeRefFormat(String ref); static String mungedRef(String refString); static String readExternalUrlRef(String file, RefFormat refFormat, List<AuthorizationValue> auths,
                                            String rootPath); static String readExternalClasspathRef(String file, RefFormat refFormat, List<AuthorizationValue> auths,
                                                  String rootPath); static String buildUrl(String rootPath, String relativePath); static String readExternalRef(String file, RefFormat refFormat, List<AuthorizationValue> auths,
                                         Path parentDirectory);  }### Answer:
@Test public void shouldReturnEmptyExternalPathForInternalReference() { String ref = "#/components/test"; Optional<String> externalPath = RefUtils.getExternalPath(ref); assertThat(externalPath.isPresent(), is(false)); }
@Test public void shouldReturnEmptyExternalPathForNullReference() { String ref = null; Optional<String> externalPath = RefUtils.getExternalPath(ref); assertThat(externalPath.isPresent(), is(false)); }
@Test public void shouldReturnEmptyExternalPathForEmptyReference() { String ref = ""; Optional<String> externalPath = RefUtils.getExternalPath(ref); assertThat(externalPath.isPresent(), is(false)); }
@Test public void shouldReturnEmptyExternalPathForInvalidReference() { String ref = "test"; Optional<String> externalPath = RefUtils.getExternalPath(ref); assertThat(externalPath.isPresent(), is(false)); }
@Test public void shouldReturnExternalPathForFileReference() { String ref = "test.yaml#/components/test"; Optional<String> externalPath = RefUtils.getExternalPath(ref); assertThat(externalPath.isPresent(), is(true)); assertThat(externalPath.get(), equalTo("test.yaml")); }
@Test public void shouldReturnExternalPathForHttpReference() { String ref = "http: Optional<String> externalPath = RefUtils.getExternalPath(ref); assertThat(externalPath.isPresent(), is(true)); assertThat(externalPath.get(), equalTo("http: }