22
33import com .spun .util .Tuple ;
44import org .lambda .functions .Function1 ;
5+ import org .lambda .functions .Function2 ;
56import org .lambda .query .Queryable ;
67
7- public class ParseInputWith2Parameters <IN1 , IN2 , OUT >
8+ public class ParseInputWith2Parameters <IN1 , IN2 >
89{
910 private final String expected ;
10- private final Function1 <String , OUT > transformer ;
11- public ParseInputWith2Parameters (String expected , Function1 <String , OUT > transformer )
11+ private final Function1 <String , Tuple < IN1 , IN2 > > transformer ;
12+ public ParseInputWith2Parameters (String expected , Function1 <String , Tuple < IN1 , IN2 > > transformer )
1213 {
1314 this .expected = expected ;
1415 this .transformer = transformer ;
1516 }
16-
17- public static <IN1 , IN2 > ParseInputWith2Parameters <IN1 , IN2 , Tuple <IN1 , IN2 >> create (String expected ,
17+ public static <IN1 , IN2 > ParseInputWith2Parameters <IN1 , IN2 > create (String expected ,
1818 Function1 <String , IN1 > t1 , Function1 <String , IN2 > t2 )
1919 {
2020 Function1 <String , Tuple <IN1 , IN2 >> f = s -> {
@@ -25,13 +25,16 @@ public static <IN1, IN2> ParseInputWith2Parameters<IN1, IN2, Tuple<IN1, IN2>> cr
2525 };
2626 return new ParseInputWith2Parameters <>(expected , f );
2727 }
28- // public <OUT2> ParseInputWith2Parameters<OUT2> transformTo(Function1<IN1, OUT2> transformer1)
29- // {
30- // Function1<String, OUT2> transformer2 = (String t) -> transformer1.call(transformer.call(t));
31- // return new ParseInputWith2Parameters<>(expected, transformer2);
32- // }
33- public void verifyAll (Function1 <OUT , Object > transform )
28+ public void verifyAll (Function1 <Tuple <IN1 , IN2 >, Object > transform )
29+ {
30+ getParseInput ().verifyAll (transform );
31+ }
32+ public void verifyAll (Function2 <IN1 , IN2 , Object > transform )
33+ {
34+ getParseInput ().verifyAll ((t ) -> transform .call (t .getFirst (), t .getSecond ()));
35+ }
36+ private ParseInput <Tuple <IN1 , IN2 >> getParseInput ()
3437 {
35- new ParseInput <OUT >(expected , s -> new Tuple <>(s , transformer .call (s ))). verifyAll ( transform );
38+ return new ParseInput <>(expected , s -> new Tuple <>(s , transformer .call (s )));
3639 }
3740}
0 commit comments