Skip to content

Instantly share code, notes, and snippets.

@ruimo
Last active July 20, 2018 00:14
Show Gist options
  • Save ruimo/5f4a89fa3ff3da34606b295506a8a4c5 to your computer and use it in GitHub Desktop.
Save ruimo/5f4a89fa3ff3da34606b295506a8a4c5 to your computer and use it in GitHub Desktop.
public class FooTest {
static class WithValue<T> {
final T v;
WithValue(T v) {
this.v = v;
}
void doTest(Consumer<T> f) {
f.accept(v);
}
}
<T> WithValue<T> with(T v) {
return new WithValue(v);
}
@Test public emptyString() {
with("").doTest(s -> assertEquals(0, s.length()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment