Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void canPeelUsingConveniencePredicate()
        internal virtual void CanPeelUsingConveniencePredicate()
        {
            // given
            Exception expected;
            Exception exception = new ARuntimeException(new AnotherRuntimeException(new LevelFourException("", expected = new LevelThreeException("", new LevelFourException("")))));

            // when
            Exception peeled = Exceptions.Peel(exception, Predicates.instanceOfAny(typeof(Exception), typeof(LevelFourException)));

            // then
            assertEquals(expected, peeled);
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void canPeelExceptions()
        internal virtual void CanPeelExceptions()
        {
            // given
            Exception expected;
            Exception exception = new LevelOneException("", new LevelTwoException("", new LevelThreeException("", expected = new LevelThreeException("include", new LevelFourException("")))));

            // when
            Exception peeled = Exceptions.Peel(exception, item => !(item is LevelThreeException) || !item.Message.contains("include"));

            // then
            assertEquals(expected, peeled);
        }