PublishHelperUtils { public static String adjustStoragePathIfNecessary(String originalPath, IStorageDestinationAdjuster adjuster) { String path = originalPath; if (null != adjuster) { String newPath = adjuster.adjustPath(path); if (null != newPath) { path = newPath; } } if (null == path) { path = ""; } return path; }  static String adjustStoragePathIfNecessary(String originalPath, IStorageDestinationAdjuster adjuster);  }
@Test public void testAdjustStoragePathIfNecessaryUseAdjusterResponse() { final String response = "Hello"; Assert.assertEquals( response, PublishHelperUtils.adjustStoragePathIfNecessary( "blah", (String path) -> { return response; } ) ); }
@Test public void testAdjustStoragePathIfNecessaryAdjusterNullResponse() { String originalPath = "Hello"; Assert.assertEquals( originalPath, PublishHelperUtils.adjustStoragePathIfNecessary( originalPath, (String path) -> { return null; } ) ); }
@Test public void testAdjustStoragePathIfNecessaryNull() { Assert.assertEquals( "", PublishHelperUtils.adjustStoragePathIfNecessary(null, null) ); }
@Test public void testAdjustStoragePathIfNecessaryNullAdjuster() { Assert.assertEquals( "Hello", PublishHelperUtils.adjustStoragePathIfNecessary("Hello", null) ); }