File tree Expand file tree Collapse file tree
src/test/java/net/marcellperger/mathexpr/util/rs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,6 +176,26 @@ void inspectErr() {
176176 strCons .assertNotCalled ();
177177 }
178178
179+ @ Test
180+ void runIfOk () {
181+ MockedConsumer <Integer > intCons = new MockedConsumer <>();
182+ assertEquals (getOk (), getOk ().runIfOk (intCons ));
183+ intCons .assertCalledOnceWith (314 );
184+ intCons .reset ();
185+ assertEquals (getErr (), getErr ().runIfOk (intCons ));
186+ intCons .assertNotCalled ();
187+ }
188+
189+ @ Test
190+ void runIfErr () {
191+ MockedConsumer <String > strCons = new MockedConsumer <>();
192+ assertEquals (getErr (), getErr ().runIfErr (strCons ));
193+ strCons .assertCalledOnceWith ("TESTING_ERROR" );
194+ strCons .reset ();
195+ assertEquals (getOk (), getOk ().runIfErr (strCons ));
196+ strCons .assertNotCalled ();
197+ }
198+
179199 @ Test
180200 void stream () {
181201 assertEquals (List .of (314 ), getOk ().stream ().toList ());
You can’t perform that action at this time.
0 commit comments