@Test public void testComposition() { mappedSUL.pre(); Character result = mappedSUL.step('A'); Assert.assertNotNull(result); Assert.assertEquals(result.charValue(), 'A'); result = mappedSUL.step(INNER_EXCEPTION_TRIGGER_CHAR); Assert.assertNotNull(result); Assert.assertEquals(result.charValue(), INNER_EXCEPTION_TRIGGER_CHAR); result = mappedSUL.step('C'); Assert.assertNotNull(result); Assert.assertEquals(result.charValue(), INNER_EXCEPTION_TRIGGER_CHAR); result = mappedSUL.step(null); Assert.assertNotNull(result); Assert.assertEquals(result.charValue(), INNER_EXCEPTION_TRIGGER_CHAR); mappedSUL.post(); mappedSUL.pre(); result = mappedSUL.step('A'); Assert.assertNotNull(result); Assert.assertEquals(result.charValue(), 'A'); result = mappedSUL.step(OUTER_EXCEPTION_TRIGGER_CHAR); Assert.assertNotNull(result); Assert.assertEquals(result.charValue(), OUTER_EXCEPTION_RESULT); result = mappedSUL.step('C'); Assert.assertNotNull(result); Assert.assertEquals(result.charValue(), 'C'); result = mappedSUL.step(NESTED_EXCEPTION_TRIGGER_CHAR); Assert.assertNotNull(result); Assert.assertEquals(result.charValue(), NESTED_EXCEPTION_TRIGGER_CHAR); Assert.assertThrows(NullPointerException.class, () -> mappedSUL.step(null)); mappedSUL.post(); mappedSUL.pre(); mappedSUL.pre(); Assert.assertEquals(4, this.innerUnwrappedMapper.getPreCounter()); Assert.assertEquals(4, this.outerWrappedMapper.getPreCounter()); Assert.assertEquals(2, this.innerUnwrappedMapper.getPostCounter()); Assert.assertEquals(2, this.outerWrappedMapper.getPostCounter()); Assert.assertFalse(mappedSUL.canFork()); Assert.assertThrows(mappedSUL::fork); }
@Override public boolean canFork() { return mapper1.canFork() && mapper2.canFork(); }
SULMapperComposition extends MapperComposition<AI, AO, ACI, CAO, CI, CO, SULMapper<? super AI, ? extends AO, ACI, CAO>, SULMapper<? super ACI, ? extends CAO, ? extends CI, ? super CO>> implements SULMapper<AI, AO, CI, CO> { @Override public boolean canFork() { return mapper1.canFork() && mapper2.canFork(); } }
SULMapperComposition extends MapperComposition<AI, AO, ACI, CAO, CI, CO, SULMapper<? super AI, ? extends AO, ACI, CAO>, SULMapper<? super ACI, ? extends CAO, ? extends CI, ? super CO>> implements SULMapper<AI, AO, CI, CO> { @Override public boolean canFork() { return mapper1.canFork() && mapper2.canFork(); } SULMapperComposition(SULMapper<? super AI, ? extends AO, ACI, CAO> outerMapper,
                         SULMapper<? super ACI, ? extends CAO, ? extends CI, ? super CO> innerMapper); }
SULMapperComposition extends MapperComposition<AI, AO, ACI, CAO, CI, CO, SULMapper<? super AI, ? extends AO, ACI, CAO>, SULMapper<? super ACI, ? extends CAO, ? extends CI, ? super CO>> implements SULMapper<AI, AO, CI, CO> { @Override public boolean canFork() { return mapper1.canFork() && mapper2.canFork(); } SULMapperComposition(SULMapper<? super AI, ? extends AO, ACI, CAO> outerMapper,
                         SULMapper<? super ACI, ? extends CAO, ? extends CI, ? super CO> innerMapper); @SuppressWarnings("PMD.AvoidCatchingGenericException") // we want to allow mapping generic RuntimeExceptions @Override MappedException<? extends AO> mapWrappedException(SULException exception); @SuppressWarnings("PMD.AvoidCatchingGenericException") // we want to allow mapping generic RuntimeExceptions @Override MappedException<? extends AO> mapUnwrappedException(RuntimeException exception); @Override boolean canFork(); @Override SULMapper<AI, AO, CI, CO> fork(); }
SULMapperComposition extends MapperComposition<AI, AO, ACI, CAO, CI, CO, SULMapper<? super AI, ? extends AO, ACI, CAO>, SULMapper<? super ACI, ? extends CAO, ? extends CI, ? super CO>> implements SULMapper<AI, AO, CI, CO> { @Override public boolean canFork() { return mapper1.canFork() && mapper2.canFork(); } SULMapperComposition(SULMapper<? super AI, ? extends AO, ACI, CAO> outerMapper,
                         SULMapper<? super ACI, ? extends CAO, ? extends CI, ? super CO> innerMapper); @SuppressWarnings("PMD.AvoidCatchingGenericException") // we want to allow mapping generic RuntimeExceptions @Override MappedException<? extends AO> mapWrappedException(SULException exception); @SuppressWarnings("PMD.AvoidCatchingGenericException") // we want to allow mapping generic RuntimeExceptions @Override MappedException<? extends AO> mapUnwrappedException(RuntimeException exception); @Override boolean canFork(); @Override SULMapper<AI, AO, CI, CO> fork();  }