@Test
public void testFlatten() throws Exception {

  {
    Either<String, Either<String, Integer>> e = left("error");
    assertEquals("error", e.left().value());
  }
  {
    Either<String, Either<String, Integer>> e = right(Either.<String, Integer>left("error"));
    assertTrue(flatten(e).isLeft());
    assertEquals("error", flatten(e).left().value());
  }
  {
    Either<String, Either<String, Integer>> e = right(Either.<String, Integer>right(1));
    assertTrue(flatten(e).isRight());
    assertEquals(new Integer(1), flatten(e).right().value());
  }
}