View Javadoc
1   package io.atlassian.fugue;
2   
3   import org.junit.Test;
4   
5   import static io.atlassian.fugue.Either.left;
6   import static io.atlassian.fugue.Either.right;
7   import static org.hamcrest.Matchers.is;
8   import static org.junit.Assert.assertThat;
9   
10  public class EitherLeftBiasTest {
11    private final Either<String, Integer> l = left("heyaa!");
12    private final Either<String, Integer> r = right(12);
13  
14    @Test public void leftOr_valueIsALeft_returnsLeftValue() {
15      assertThat(l.leftOr(Functions.constant("yo dude")), is("heyaa!"));
16    }
17  
18    @Test public void leftOr_valueIsARight_returnsRightTransformerResult() {
19      assertThat(r.leftOr(Functions.constant("yo dude")), is("yo dude"));
20    }
21  }