3132333435363738
@Test(expected = ClassCastException.class) public void passingWrongTypeToErasureYieldsException() { Delegate c = new Reductor<Long, Integer>(new Count<Integer>(), 0l); c.perform(new Object()); } }
9192939495969798
} @Test(expected = ClassCastException.class) public void callingErasureWithWrongTypeYieldsException() { Delegate d = new Densify<Integer>(RangeMother.sequencer, RangeMother.comparator); d.perform(new Object()); } }
4445464748495051
} @Test(expected = ClassCastException.class) public void consumingFromErasureWithWrongTypeYieldsException() { final Delegate cons = new ConsumeIntoCollection<ArrayList<Integer>, Integer>(new ArrayListFactory<Integer>()); cons.perform(new Object()); } }
@Test(expected = ClassCastException.class) public void consumingFromErasureWithWrongTypeYieldsException() { final StringOutputIterator output = new StringOutputIterator(); Delegate pipe = new ConsumeIntoOutputIterator(output); pipe.perform(new Object()); } }
4849505152535455
} @Test(expected = ClassCastException.class) public void consumingFromErasureWithWrongTypeYieldsException() { final Delegate cons = new ConsumeIntoMap<HashMap<O, O>, O, O>(new HashMapFactory<O, O>()); cons.perform(new Object()); } }
2930313233343536
@Test(expected = ClassCastException.class) public void passingWrongTypeToErasureYieldsException() { final List<O> bucket = new ArrayList<O>(); Delegate d = new CollectionAllAdder<List<O>, O>(bucket); d.perform(new Object()); } }
2122232425262728293031
} @Test// you probably expect this (expected = ClassCastException.class) public void passingWrongTypeToErasureJustForwardsToTheNestedAction() { Delegate d = new PredicateToDelegate<O>(new Always<O>()); d.perform(new Object()); } @Test public void adapterCorrectlyPassesFirstParamToAdapted() { final Box<O> param = Box.empty();
} @Test// you probably expect this (expected = ClassCastException.class) public void passingWrongTypeToErasureJustForwardsToTheNestedAction() { final Delegate d = new ActionToDelegate<O>(new Noop<O>()); d.perform(new Object()); } @Test public void callingAdapterCallsAdapted() { final Box<Object> box = new Box<Object>();
2021222324252627282930
} @Test(expected = ClassCastException.class) public void passingNonStringToErasureYieldsException() { Delegate d = new BooleanTryParser(); d.perform(new Object()); } @Test public void parsingValidTrueStringYieldsTrue() { final Maybe<Boolean> got = new BooleanTryParser().perform("true");
2223242526272829303132
} @Test(expected = ClassCastException.class) public void passingNonStringToErasureYieldsException() { Delegate d = new ByteTryParser(10); d.perform(new Object()); } @Test public void parsingNullStringYieldsNothing() { final Maybe<Byte> got = new ByteTryParser(10).perform(null);