/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache license, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the license for the specific language governing permissions and
 * limitations under the license.
 */
package org.apache.logging.log4j.core.pattern;

import java.util.List;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.junit.InitialLoggerContext;
import org.apache.logging.log4j.test.appender.ListAppender;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 *
 */
public class ExtendedThrowableTest {
    private ListAppender app;

    @Rule
    public InitialLoggerContext init = new InitialLoggerContext("log4j-throwablefilter.xml");

    @Before
    public void setUp() throws Exception {
        this.app = (ListAppender) this.init.getContext().getConfiguration().getAppenders().get("List");
    }

    @After
    public void tearDown() throws Exception {
        this.app.clear();
    }

    @Test
    public void testException() {
        final Logger logger = this.init.getContext().getLogger("LoggerTest");
        final Throwable cause = new NullPointerException("null pointer");
        final Throwable parent = new IllegalArgumentException("IllegalArgument", cause);
        logger.error("Exception", parent);
        final List<String> msgs = app.getMessages();
        assertNotNull(msgs);
        assertEquals("Incorrect number of messages. Should be 1 is " + msgs.size(), msgs.size(), 1);
        assertTrue("No suppressed lines", msgs.get(0).contains("suppressed"));
    }
}

@@ -1030,32 +1030,8 @@
 er;%0A
-import org.junit.After;%0A
 impo
@@ -1068,16 +1068,21 @@
 g.junit.
+Class
 Rule;%0Aim
@@ -1222,16 +1222,21 @@
 ;%0A%0A    @
+Class
 Rule%0A   
@@ -1243,16 +1243,23 @@
  public 
+static 
 InitialL
@@ -1271,19 +1271,22 @@
 Context 
-ini
+contex
 t = new 
@@ -1415,67 +1415,22 @@
 p = 
-(ListAppender) this.init.getC
+c
 ontext
-()
 .get
-Configuration().ge
+Lis
 tApp
@@ -1438,23 +1438,16 @@
 nder
-s().get
 (%22List%22)
 ;%0A  
@@ -1446,90 +1446,8 @@
 st%22)
-;%0A    %7D%0A%0A    @After%0A    public void tearDown() throws Exception %7B%0A        this.app
 .cle
@@ -1537,30 +1537,15 @@
 r = 
-this.init.getC
+c
 ontext
-()
 .get
@@ -1937,16 +1937,19 @@
 .size(),
+ 1,
  msgs.si
@@ -1952,19 +1952,16 @@
 s.size()
-, 1
 );%0A     

Simplify test with newer ILC methods.