org.momeunit.ant.event
Class TestEvent

java.lang.Object
  extended by org.momeunit.ant.event.TestEvent

public class TestEvent
extends Object

Class that encapsulates information of test event. Test events of different types can be constructed using static factory methods createStartTestEvent(long, String, String), createErrorTestEvent(long, String, String, String, String, String), createFailTestEvent(long, String, String, String, String, String), createEndTestEvent(long, String, String). This class contains methods for accessing and modifying of type of the event; time at which this event occurred; name and classname of test on which this event occurred; classname, message and stack trace of error or failure occurred.

Version:
1.1.2
Author:
Sergio Morozov

Field Summary
static int END_TEST
          End test event type.
static int ERROR_TEST
          Error test event type.
static int FAIL_TEST
          Fail test event type.
static int START_TEST
          Start test event type.
 
Constructor Summary
TestEvent()
          Instantiates TestEvent.
TestEvent(int type, long timestamp, String testName, String testClassName, String errorClassName, String msg, String stackTrace)
          Instantiates TestEvent with given type, test name, test class name, class name of error or failure, error or failure message, stack trace of error or failure.
 
Method Summary
static TestEvent createEndTestEvent(long timestamp, String testName, String testClassName)
          Creates end test event with given test name and test classname.
static TestEvent createErrorTestEvent(long timestamp, String testName, String testClassName, String errorClassName, String msg, String stackTrace)
          Creates error test event with given test name, test classname, classname, message and stack trace of error occurred.
static TestEvent createFailTestEvent(long timestamp, String testName, String testClassName, String errorClassName, String msg, String stackTrace)
          Creates failure test event with given test name, test classname, classname, message and stack trace of error occurred.
static TestEvent createStartTestEvent(long timestamp, String testName, String testClassName)
          Creates start test event with given test name and test classname.
 String getErrorClassName()
          Returns classname of error or failure occurred.
 String getMsg()
          Returns message of error or failure occurred.
 String getStackTrace()
          Returns stack trace of error or failure occurred.
 String getTestClassName()
          Returns classname of test during which execution a test event occurred.
 String getTestName()
          Returns name of test during which execution a test event occurred.
 long getTimestamp()
          Returns time at which test event occurred.
 int getType()
          Returns type of test event.
 boolean isFailure()
          Returns whether this test event is a failure test event.
 void setErrorClassName(String errorClassName)
          Sets classname of error or failure occurred.
 void setMsg(String msg)
          Sets message of error or failure occurred.
 void setStackTrace(String stackTrace)
          Sets stack trace of error or failure occurred.
 void setTestClassName(String testClassName)
          Sets classname of test during which execution a test event occurred.
 void setTestName(String testName)
          Sets name of test during which execution a test event occurred.
 void setTimestamp(long timestamp)
          Sets time at which test event occurred.
 void setType(int type)
          Sets type of test event.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

START_TEST

public static final int START_TEST
Start test event type.

Since:
1.1
See Also:
Constant Field Values

FAIL_TEST

public static final int FAIL_TEST
Fail test event type.

Since:
1.1
See Also:
Constant Field Values

ERROR_TEST

public static final int ERROR_TEST
Error test event type.

Since:
1.1
See Also:
Constant Field Values

END_TEST

public static final int END_TEST
End test event type.

Since:
1.1
See Also:
Constant Field Values
Constructor Detail

TestEvent

public TestEvent()
Instantiates TestEvent.

Since:
1.1

TestEvent

public TestEvent(int type,
                 long timestamp,
                 String testName,
                 String testClassName,
                 String errorClassName,
                 String msg,
                 String stackTrace)
Instantiates TestEvent with given type, test name, test class name, class name of error or failure, error or failure message, stack trace of error or failure.

Parameters:
type - type of TestEvent.
timestamp - time at which this event occurred.
testName - name of test on which this event occurs.
testClassName - classname of test on which this event occurs.
errorClassName - classname of error or failure.
msg - error or failure message.
stackTrace - stack trace of error or failure.
Since:
1.1
Method Detail

createStartTestEvent

public static TestEvent createStartTestEvent(long timestamp,
                                             String testName,
                                             String testClassName)
Creates start test event with given test name and test classname.

Parameters:
timestamp - time at which this event occurred.
testName - name of test started.
testClassName - classname of test started.
Returns:
the created test event.
Since:
1.1

createEndTestEvent

public static TestEvent createEndTestEvent(long timestamp,
                                           String testName,
                                           String testClassName)
Creates end test event with given test name and test classname.

Parameters:
timestamp - time at which this event occurred.
testName - name of test finished.
testClassName - classname of test finished.
Returns:
the created test event.
Since:
1.1

createErrorTestEvent

public static TestEvent createErrorTestEvent(long timestamp,
                                             String testName,
                                             String testClassName,
                                             String errorClassName,
                                             String msg,
                                             String stackTrace)
Creates error test event with given test name, test classname, classname, message and stack trace of error occurred.

Parameters:
timestamp - time at which this event occurred.
testName - name of test during execution error occurred.
testClassName - classname of test during execution error occurred.
errorClassName - classname of error occurred.
msg - message of error occurred.
stackTrace - stack trace of error occurred.
Returns:
the created test event.
Since:
1.1

createFailTestEvent

public static TestEvent createFailTestEvent(long timestamp,
                                            String testName,
                                            String testClassName,
                                            String errorClassName,
                                            String msg,
                                            String stackTrace)
Creates failure test event with given test name, test classname, classname, message and stack trace of error occurred.

Parameters:
timestamp - time at which this event occurred.
testName - name of test during execution failure occurred.
testClassName - classname of test during execution failure occurred.
errorClassName - classname of failure occurred.
msg - message of failure occurred.
stackTrace - stack trace of failure occurred.
Returns:
the created test event.
Since:
1.1

getErrorClassName

public String getErrorClassName()
Returns classname of error or failure occurred.

Returns:
the classname of error or failure occurred.
Since:
1.1

setErrorClassName

public void setErrorClassName(String errorClassName)
Sets classname of error or failure occurred.

Parameters:
errorClassName - classname of error or failure occurred.
Since:
1.1

getMsg

public String getMsg()
Returns message of error or failure occurred.

Returns:
the message of error or failure occurred.
Since:
1.1

setMsg

public void setMsg(String msg)
Sets message of error or failure occurred.

Parameters:
msg - the message of error or failure occurred.
Since:
1.1

getStackTrace

public String getStackTrace()
Returns stack trace of error or failure occurred.

Returns:
the stack trace of error or failure occurred.
Since:
1.1

setStackTrace

public void setStackTrace(String stackTrace)
Sets stack trace of error or failure occurred.

Parameters:
stackTrace - stack trace of error or failure occurred.
Since:
1.1

getTestClassName

public String getTestClassName()
Returns classname of test during which execution a test event occurred.

Returns:
classname of test during which execution a test event occurred.
Since:
1.1

setTestClassName

public void setTestClassName(String testClassName)
Sets classname of test during which execution a test event occurred.

Parameters:
testClassName - the classname of test during which execution a test event occurred.
Since:
1.1

getTestName

public String getTestName()
Returns name of test during which execution a test event occurred.

Returns:
the name of test during which execution a test event occurred.
Since:
1.1

setTestName

public void setTestName(String testName)
Sets name of test during which execution a test event occurred.

Parameters:
testName - name of test during which execution a test event occurred.
Since:
1.1

getTimestamp

public long getTimestamp()
Returns time at which test event occurred.

Returns:
the time at which test event occurred.
Since:
1.1

setTimestamp

public void setTimestamp(long timestamp)
Sets time at which test event occurred.

Parameters:
timestamp - the time at which test event occurred.
Since:
1.1

isFailure

public boolean isFailure()
Returns whether this test event is a failure test event.

Returns:
true if this test event is a failure test event, false otherwise.
Since:
1.1

getType

public int getType()
Returns type of test event.

Returns:
the type of test event.
Since:
1.1

setType

public void setType(int type)
Sets type of test event.

Parameters:
type - type of test event.
Since:
1.1

toString

public String toString()
Overrides:
toString in class Object