org.apache.log4j.pattern
Class NameAbbreviatorTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.log4j.pattern.NameAbbreviatorTest
All Implemented Interfaces:
junit.framework.Test

public class NameAbbreviatorTest
extends junit.framework.TestCase

Tests for NameAbbrevator.


Constructor Summary
NameAbbreviatorTest(java.lang.String name)
          Create a new instance.
 
Method Summary
 void testBlank()
          Check that getAbbreviator(" ") returns default abbreviator.
 void testBlankOne()
          Check that blanks are trimmed in evaluating abbreviation pattern.
 void testGetDefault()
          Check that getDefaultAbbreviator does not return null.
 void testMinusOne()
          Check that getAbbreviator("-1").abbreviate() drops first name element.
 void testMulti()
          Check that getAbbreviator("1.*.2").abbreviate drops all but the first character from the first element, uses all of the second element and drops all but the first two characters of the rest of the non-final elements.
 void testOne()
          Check that getAbbreviator("1").abbreviate() drops all but the final name element.
 void testOneDot()
          Check that getAbbreviator("1.").abbreviate abbreviates non-final elements to one character.
 void testOneTildeDot()
          Check that getAbbreviator("1~.").abbreviate abbreviates non-final elements to one character and a tilde.
 void testTwo()
          Check that getAbbreviator("2").abbreviate drops all but the last two elements.
 void testZero()
          Check that "0" drops all name content.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NameAbbreviatorTest

public NameAbbreviatorTest(java.lang.String name)
Create a new instance.

Parameters:
name - test name
Method Detail

testGetDefault

public void testGetDefault()
Check that getDefaultAbbreviator does not return null.


testZero

public void testZero()
Check that "0" drops all name content.


testBlank

public void testBlank()
Check that getAbbreviator(" ") returns default abbreviator.


testOne

public void testOne()
Check that getAbbreviator("1").abbreviate() drops all but the final name element.


testBlankOne

public void testBlankOne()
Check that blanks are trimmed in evaluating abbreviation pattern.


testTwo

public void testTwo()
Check that getAbbreviator("2").abbreviate drops all but the last two elements.


testOneDot

public void testOneDot()
Check that getAbbreviator("1.").abbreviate abbreviates non-final elements to one character.


testOneTildeDot

public void testOneTildeDot()
Check that getAbbreviator("1~.").abbreviate abbreviates non-final elements to one character and a tilde.


testMulti

public void testMulti()
Check that getAbbreviator("1.*.2").abbreviate drops all but the first character from the first element, uses all of the second element and drops all but the first two characters of the rest of the non-final elements.


testMinusOne

public void testMinusOne()
Check that getAbbreviator("-1").abbreviate() drops first name element.



Copyright © 2010 The Apache Software Foundation. Licensed under the Apache License, Version 2.0

Apache Extras Companion for Apache log4j, Apache log4j and Apache are trademarks of the Apache Software Foundation.