### Question:
PathNormalizer { public static String normalizePathSlashes(String path) { if (StringUtils.isBlank(path)) { throw new IllegalArgumentException("path cannot be blank"); } String result = path; if (!result.startsWith("/")) { result = "/" + result; } if (result.endsWith("/")) { result = result.substring(0, result.length() - 1); } return result; }  static String normalizePathSlashes(String path);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testNormalizePathSlashesThrowsExceptionWhenNullGiven() { PathNormalizer.normalizePathSlashes(null); }
@Test(expected = IllegalArgumentException.class) public void testNormalizePathSlashesThrowsExceptionWhenBlankGiven() { PathNormalizer.normalizePathSlashes(" "); }
@Test public void testNormalizePathSlashesAddsNecessaryLeadingSlashesIfMissing() { String result = PathNormalizer.normalizePathSlashes("test/path"); assertThat(result).isEqualTo("/test/path"); }
@Test public void testNormalizePathSlashesRemovesUnnecessaryTrailingSlashesIfAny() { String result = PathNormalizer.normalizePathSlashes("/test/path/"); assertThat(result).isEqualTo("/test/path"); }
@Test public void testNormalizePathSlashesRemovesAndAddsSlashesWhereNeeded() { String result = PathNormalizer.normalizePathSlashes("test/path/"); assertThat(result).isEqualTo("/test/path"); }