SecretFromPathReader implements Supplier<Optional<Secret>> { static SecretFromPathReader of(final Path path) { checkNotNull(path, "Secret path"); final String secretName = String.valueOf(path.getName(path.getNameCount() - 1)); return of(checkNotNull(secretName, "Secret name"), path); } private  SecretFromPathReader(final String theSecretName, final Path thePath); @Override Optional<Secret> get();  }
@Test public void tryToGetInstanceWithNullPath() { assertThatNullPointerException() .isThrownBy(() -> SecretFromPathReader.of(null)) .withMessage("The Secret path must not be null!") .withNoCause(); }