Either { @Override public String toString() { if (left != null) { return "Either.left(" + left + ")"; } else { return "Either.right(" + right + ")"; } } private  Either(L left, R right); L getLeft(); R getRight(); boolean isLeft(); boolean isRight(); static Either<L, R> left(L left); static Either<L, R> right(R right); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testToString() { assertEquals("Either.right(ok)", ok.toString()); assertEquals("Either.left(ko)", ko.toString()); }