Methods Summary |
---|
protected org.apache.log4j.Layout | createLayout()
return new MockLayout();
|
public void | testActivateOptions()Tests activateOptions.
DateLayout layout = (DateLayout) createLayout();
layout.setDateFormat("HH:mm:ss");
layout.setTimeZone("+05:00");
layout.activateOptions();
|
public void | testDateFormatOption()Tests DateLayout.DATE_FORMAT_OPTION constant.
assertEquals("DateFormat", DateLayout.DATE_FORMAT_OPTION);
|
public void | testDateTimeFormat()Tests DateTimeDateFormat class.
DateFormat format = new DateTimeDateFormat();
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(1970, 0, 1, 0, 0, 0);
String actual = format.format(calendar.getTime());
SimpleDateFormat df = new SimpleDateFormat("dd MMM yyyy HH:mm:ss,SSS");
String expected = df.format(calendar.getTime());
assertEquals(expected, actual);
|
public void | testGetOptionStrings()Tests getOptionStrings().
String[] options = ((DateLayout) createLayout()).getOptionStrings();
assertEquals(2, options.length);
|
public void | testISO8601Format()Tests IS08601DateFormat class.
DateFormat format = new ISO8601DateFormat();
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(1970, 0, 1, 0, 0, 0);
String actual = format.format(calendar.getTime());
assertEquals("1970-01-01 00:00:00,000", actual);
|
public void | testNullDateFormat()Tests DateLayout.NULL_DATE_FORMAT constant.
assertEquals("NULL", DateLayout.NULL_DATE_FORMAT);
|
public void | testRelativeTimeDateFormat()Tests DateLayout.RELATIVE constant.
assertEquals("RELATIVE", DateLayout.RELATIVE_TIME_DATE_FORMAT);
|
public void | testSetDateFormat()Tests setDateFormat.
DateLayout layout = (DateLayout) createLayout();
layout.setDateFormat("ABSOLUTE");
assertEquals("ABSOLUTE", layout.getDateFormat());
|
public void | testSetDateFormatAbsolute()Tests 2 parameter setDateFormat with "ABSOLUTE".
DateLayout layout = (DateLayout) createLayout();
layout.setDateFormat("aBsolUte", TimeZone.getDefault());
|
public void | testSetDateFormatDateTime()Tests 2 parameter setDateFormat with "DATETIME".
DateLayout layout = (DateLayout) createLayout();
layout.setDateFormat("dAte", TimeZone.getDefault());
|
public void | testSetDateFormatISO8601()Tests 2 parameter setDateFormat with "ISO8601".
DateLayout layout = (DateLayout) createLayout();
layout.setDateFormat("iSo8601", TimeZone.getDefault());
|
public void | testSetDateFormatNull()Tests 2 parameter setDateFormat with null.
DateLayout layout = (DateLayout) createLayout();
layout.setDateFormat((String) null, null);
|
public void | testSetDateFormatNullString()Tests 2 parameter setDateFormat with "NULL".
DateLayout layout = (DateLayout) createLayout();
layout.setDateFormat("NuLL", null);
|
public void | testSetDateFormatRelative()Tests 2 parameter setDateFormat with "RELATIVE".
DateLayout layout = (DateLayout) createLayout();
layout.setDateFormat("rElatIve", TimeZone.getDefault());
|
public void | testSetDateFormatSimple()Tests 2 parameter setDateFormat with "HH:mm:ss".
DateLayout layout = (DateLayout) createLayout();
layout.setDateFormat("HH:mm:ss", TimeZone.getDefault());
|
public void | testSetDateFormatWithFormat()Tests setDateFormat(DateFormat, TimeZone).
DateFormat format = new SimpleDateFormat("HH:mm");
DateLayout layout = (DateLayout) createLayout();
layout.setDateFormat(format, TimeZone.getDefault());
|
public void | testSetOptionDateFormat()Tests setting DateFormat through setOption method.
DateLayout layout = (DateLayout) createLayout();
layout.setOption("dAtefOrmat", "foobar");
assertEquals("FOOBAR", layout.getDateFormat());
|
public void | testSetOptionTimeZone()Tests setting TimeZone through setOption method.
DateLayout layout = (DateLayout) createLayout();
layout.setOption("tImezOne", "+05:00");
assertEquals("+05:00", layout.getTimeZone());
|
public void | testSetTimeZone()Tests setTimeZone.
DateLayout layout = (DateLayout) createLayout();
layout.setTimeZone("+05:00");
assertEquals("+05:00", layout.getTimeZone());
|
public void | testTimeZoneOption()Tests DateLayout.TIMEZONE_OPTION constant.
assertEquals("TimeZone", DateLayout.TIMEZONE_OPTION);
|