class Test6 { public static void main(String[] args) { CS2030STest we = new CS2030STest(); class Incr implements Immutator { public Integer invoke(Integer t1) { return t1 + 1; } } class Length implements Immutator { public Integer invoke(String t1) { return t1.length(); } } Probably> justIncr = Probably.just(new Incr()); Probably> justLength = Probably.just(new Length()); Probably> noIncr = Probably.none(); Probably> noLength = Probably.none(); we.prefix("jshell> class Incr implements Immutator {"); we.prefix(" ...> public Integer invoke(Integer t1) {"); we.prefix(" ...> return t1 + 1;"); we.prefix(" ...> }"); we.prefix("jshell> class Length implements Immutator {"); we.prefix(" ...> public Integer invoke(String t1) {"); we.prefix(" ...> return t1.length();"); we.prefix(" ...> }"); we.prefix("jshell> Probably> justIncr = Probably.just(new Incr());"); we.prefix("jshell> Probably> justLength = Probably.just(new Length());"); we.prefix("jshell> Probably> noIncr = Probably.none();"); we.prefix("jshell> Probably> noLength = Probably.none();"); we.expect("Probably.just(17).apply(justIncr)", Probably.just(17).apply(justIncr).toString(), "<18>"); we.expect("Probably.none().apply(justIncr)", Probably.none().apply(justIncr).toString(), "<>"); we.expect("Probably.just(17).apply(noIncr)", Probably.just(17).apply(noIncr).toString(), "<>"); we.expect("Probably.none().apply(noIncr)", Probably.none().apply(noIncr).toString(), "<>"); we.expect("Probably.just(\"string\").apply(justLength)", Probably.just("string").apply(justLength).toString(), "<6>"); we.expect("Probably.none().apply(justLength)", Probably.none().apply(justLength).toString(), "<>"); we.expect("Probably.just(\"string\").apply(noLength)", Probably.just("string").apply(noLength).toString(), "<>"); we.expect("Probably.none().apply(noLength)", Probably.none().apply(noLength).toString(), "<>"); we.showStat(); we.print(); } }