2
2
3
3
import com .jnape .palatable .lambda .adt .Either ;
4
4
import com .jnape .palatable .lambda .adt .Unit ;
5
- import com .jnape .palatable .lambda .functions .specialized .Pure ;
6
5
import com .jnape .palatable .lambda .functor .builtin .Identity ;
7
6
import com .jnape .palatable .lambda .io .IO ;
8
7
import com .jnape .palatable .traitor .annotations .TestTraits ;
28
27
import static com .jnape .palatable .lambda .io .IO .io ;
29
28
import static com .jnape .palatable .lambda .monad .transformer .builtin .EitherT .eitherT ;
30
29
import static com .jnape .palatable .lambda .monad .transformer .builtin .EitherT .liftEitherT ;
31
- import static com .jnape .palatable .lambda .monad .transformer .builtin .EitherT .pureEitherT ;
32
30
import static com .jnape .palatable .traitor .framework .Subjects .subjects ;
33
31
import static org .junit .Assert .assertEquals ;
32
+ import static testsupport .assertion .MonadErrorAssert .assertLaws ;
34
33
35
34
@ RunWith (Traits .class )
36
35
public class EitherTTest {
@@ -78,12 +77,9 @@ public void staticPure() {
78
77
79
78
@ Test
80
79
public void monadError () {
81
- Pure <EitherT <Identity <?>, String , ?>> pure = pureEitherT (pureIdentity ());
82
-
83
- assertEquals (eitherT (new Identity <>(left ("Hello" ))),
84
- pure .<Integer , EitherT <Identity <?>, String , Integer >>apply (1 ).throwError ("Hello" ));
85
- assertEquals (pure .apply (5 ),
86
- EitherT .<Identity <?>, String , Integer >eitherT (new Identity <>(left ("Hello" )))
87
- .catchError (s -> pure .apply (s .length ())));
80
+ assertLaws (subjects (eitherT (new Identity <>(right (1 ))),
81
+ eitherT (new Identity <>(left ("" )))),
82
+ "bar" ,
83
+ str -> eitherT (new Identity <>(right (str .length ()))));
88
84
}
89
85
}
0 commit comments