22
33import com .jnape .palatable .lambda .adt .Either ;
44import com .jnape .palatable .lambda .adt .Unit ;
5- import com .jnape .palatable .lambda .functions .specialized .Pure ;
65import com .jnape .palatable .lambda .functor .builtin .Identity ;
76import com .jnape .palatable .lambda .io .IO ;
87import com .jnape .palatable .traitor .annotations .TestTraits ;
2827import static com .jnape .palatable .lambda .io .IO .io ;
2928import static com .jnape .palatable .lambda .monad .transformer .builtin .EitherT .eitherT ;
3029import static com .jnape .palatable .lambda .monad .transformer .builtin .EitherT .liftEitherT ;
31- import static com .jnape .palatable .lambda .monad .transformer .builtin .EitherT .pureEitherT ;
3230import static com .jnape .palatable .traitor .framework .Subjects .subjects ;
3331import static org .junit .Assert .assertEquals ;
32+ import static testsupport .assertion .MonadErrorAssert .assertLaws ;
3433
3534@ RunWith (Traits .class )
3635public class EitherTTest {
@@ -78,12 +77,9 @@ public void staticPure() {
7877
7978 @ Test
8079 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 ()))));
8884 }
8985}
0 commit comments