### Question:
GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCredentialProvider()); if (pathToCredentialsFile.isAbsolute()) { java.nio.file.Path pathRelative = currentDirectory.relativize(pathToCredentialsFile); return new Path(pathRelative.toString()); } else { return new Path(pathToCredentialsFile.toString()); } } @Autowired  GCPCredentialPathProvider(GCPSecurity security); Path newPath();  }### Answer:
@Test public void newInstanceWithRelativePath() { String relativePath = "../test.json"; security.setCredentialProvider(relativePath); String result = new GCPCredentialPathProvider(security).newPath().toString(); assertThat(result, is(relativePath)); }
@Test public void newInstanceWithAbsolutePath() { security.setCredentialProvider("/test.json"); String result = new GCPCredentialPathProvider(security).newPath().toString(); assertFalse(new Path(result).isAbsolute()); assertThat(result, startsWith("../")); }
@Test public void newInstanceWithBlankPath() { security.setCredentialProvider(""); Path result = new GCPCredentialPathProvider(security).newPath(); assertNull(result); }