@Test
public void testFormatSegments() throws Exception {

    MatcherAssert.assertThat(formatPath("this", "that"), CoreMatchers.equalTo("/this/that"));
    MatcherAssert.assertThat(formatPath("this", "", "that"), CoreMatchers.equalTo("/this//that"));
    MatcherAssert.assertThat(formatPath("this", "", "that", "/this and that"),
            CoreMatchers.equalTo("/this//that/%2Fthis%20and%20that"));
    MatcherAssert.assertThat(formatPath("this", "", "", "that", "", ""),
            CoreMatchers.equalTo("/this///that//"));
    MatcherAssert.assertThat(formatPath(""), CoreMatchers.equalTo("/"));
    MatcherAssert.assertThat(formatPath(), CoreMatchers.equalTo(""));
}