"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderBuilderTest.java" between
apache-log4j-2.11.1-src.tar.gz and apache-log4j-2.11.2-src.tar.gz

About: Apache Log4j 2 is a logging library for Java. Source distribution (Java).

ConsoleAppenderBuilderTest.java  (apache-log4j-2.11.1-src):ConsoleAppenderBuilderTest.java  (apache-log4j-2.11.2-src)
skipping to change at line 21 skipping to change at line 21
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the license for the specific language governing permissions and * See the license for the specific language governing permissions and
* limitations under the license. * limitations under the license.
*/ */
package org.apache.logging.log4j.core.appender; package org.apache.logging.log4j.core.appender;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import org.apache.logging.log4j.core.ErrorHandler;
import org.apache.logging.log4j.core.layout.PatternLayout; import org.apache.logging.log4j.core.layout.PatternLayout;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class ConsoleAppenderBuilderTest { public class ConsoleAppenderBuilderTest {
/** /**
* Tests https://issues.apache.org/jira/browse/LOG4J2-1620 * Tests https://issues.apache.org/jira/browse/LOG4J2-1620
*/ */
@Test @Test
skipping to change at line 42 skipping to change at line 43
Assert.assertTrue(ConsoleAppender.newBuilder().isImmediateFlush()); Assert.assertTrue(ConsoleAppender.newBuilder().isImmediateFlush());
} }
/** /**
* Tests https://issues.apache.org/jira/browse/LOG4J2-1636 * Tests https://issues.apache.org/jira/browse/LOG4J2-1636
* *
* Tested with Oracle 7 and 8 and IBM Java 8. * Tested with Oracle 7 and 8 and IBM Java 8.
*/ */
@Test @Test
public void testDefaultLayoutDefaultCharset() { public void testDefaultLayoutDefaultCharset() {
final ConsoleAppender appender = ConsoleAppender.newBuilder().withName(" test").build(); final ConsoleAppender appender = ConsoleAppender.newBuilder().setName("t est").build();
final PatternLayout layout = (PatternLayout) appender.getLayout(); final PatternLayout layout = (PatternLayout) appender.getLayout();
final String charsetName = System.getProperty("sun.stdout.encoding"); final String charsetName = System.getProperty("sun.stdout.encoding");
final String expectedName = charsetName != null ? charsetName : Charset. defaultCharset().name(); final String expectedName = charsetName != null ? charsetName : Charset. defaultCharset().name();
Assert.assertEquals(expectedName, layout.getCharset().name()); Assert.assertEquals(expectedName, layout.getCharset().name());
} }
/**
* Tests https://issues.apache.org/jira/browse/LOG4J2-2441
*/
@Test
public void testSetNullErrorHandlerIsNotAllowed() {
final ConsoleAppender appender = ConsoleAppender.newBuilder().setName("t
est").build();
final ErrorHandler handler = appender.getHandler();
Assert.assertNotNull(handler);
// This could likely be allowed to throw, but we're just testing that
// setting null does not actually set a null handler.
appender.setHandler(null);
Assert.assertSame(handler, appender.getHandler());
}
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)