### Question:
Substring { public static Prefix prefix(String prefix) { return new Prefix(requireNonNull(prefix)); } private  Substring(); static Prefix prefix(String prefix); static Prefix prefix(char prefix); static Suffix suffix(String suffix); static Suffix suffix(char suffix); static Pattern substring(String str); static Pattern first(String str); static Pattern first(char character); static Pattern first(java.util.regex.Pattern regexPattern); static Pattern first(java.util.regex.Pattern regexPattern, int group); static Pattern spanningInOrder(String stop1, String stop2, String... moreStops); static Pattern last(String str); static Pattern last(char character); static Pattern before(Pattern delimiter); static Pattern after(Pattern delimiter); static Pattern upToIncluding(Pattern pattern); static Pattern between(Pattern open, Pattern close); static final Pattern NONE; static final Pattern BEGINNING; static final Pattern END; }### Answer:
@Test public void prefix_toString() { assertThat(prefix("foo").toString()).isEqualTo("foo"); }
@Test public void prefix_noMatch() { assertThat(prefix("foo").in("notfoo")).isEmpty(); assertThat(prefix("foo").in("")).isEmpty(); assertThat(prefix("foo").iterateIn("notfoo")).isEmpty(); assertThat(prefix("foo").iterateIn("")).isEmpty(); }
@Test public void charPrefix_toString() { assertThat(prefix('a').toString()).isEqualTo("a"); }
@Test public void charPrefix_noMatch() { assertThat(prefix('f').in("notfoo")).isEmpty(); assertThat(prefix('f').in("")).isEmpty(); assertThat(prefix('f').iterateIn("")).isEmpty(); }
@Test public void prefix_addToIfAbsent_absent() { assertThat(prefix("google3/").addToIfAbsent("java/com")).isEqualTo("google3/java/com"); }
@Test public void prefix_addToIfAbsent_present() { assertThat(prefix("google3/").addToIfAbsent("google3/java/com")).isEqualTo("google3/java/com"); }
@Test public void patternFrom_noMatch() { assertThat(prefix("foo").from("")).isEmpty(); }
@Test public void testNulls() throws Exception { new NullPointerTester().testAllPublicInstanceMethods(prefix("foo").in("foobar").get()); newClassSanityTester().testNulls(Substring.class); newClassSanityTester().forAllPublicStaticMethods(Substring.class).testNulls(); }