Test for non existent file provided for generation
@@ -12,7 +12,6 @@ import java.nio.file.Paths;
import static com.github.nexus.config.PrivateKeyType.UNLOCKED;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.catchThrowable;
public class PrivateKeyAdapterTest {
@@ -110,4 +109,21 @@ public class PrivateKeyAdapterTest {
assertThat(result.getPassword()).isEqualTo("PASSWORD");
}
+ @Test
+ public void nonExistentPrivateKeyPath() throws IOException {
+ Path path = Paths.get("bogus.somename");
+
+ final PrivateKeyMutable pkm = new PrivateKeyMutable(
+ path,
+ null,
+ null,
+ null,
+ new PrivateKey(null, null, UNLOCKED, null, null, null, null, null)
+ );
+
+ final PrivateKey result = adapter.unmarshal(pkm);
+
+ assertThat(result.getPath()).isEqualTo(path);
+ }
+
}
