@ -44,20 +44,45 @@ public class TestUnit<T extends TestContextInterface> implements Runnable {
add ( TestSuite . getDefault ( ) ) ;
}
//Shallow Copy
public TestUnit ( TestUnit < T > orig ) {
testUnitName = orig . testUnitName ;
ctx = orig . ctx ;
lambda = orig . lambda ;
result = orig . result ;
state = orig . state ;
lastException = orig . lastException ;
verboseMode = orig . verboseMode ;
testColor = orig . testColor ;
logFmtPadding = orig . logFmtPadding ;
logFmtMsgLen = orig . logFmtMsgLen ;
logFmtTestDuration = orig . logFmtTestDuration ;
lineWidthMin = orig . lineWidthMin ;
logFmtTestNameLen = orig . logFmtTestNameLen ;
logFmtCtxNameLen = orig . logFmtCtxNameLen ;
}
//Shallow Copy
public TestUnit < T > copy ( ) {
return new TestUnit < > ( this ) ;
}
public boolean isVerboseMode ( ) {
return verboseMode ;
}
public void setVerboseMode ( boolean verboseMode ) {
public TestUnit < T > setVerboseMode ( boolean verboseMode ) {
this . verboseMode = verboseMode ;
return this ;
}
public TermColor getTestColor ( ) {
return testColor ;
}
public void setTestColor ( TermColor testColor ) {
public TestUnit < T > setTestColor ( TermColor testColor ) {
this . testColor = testColor ;
return this ;
}
public TestState getResult ( ) {
@ -82,6 +107,11 @@ public class TestUnit<T extends TestContextInterface> implements Runnable {
return ctx ;
}
public TestUnit < T > setContext ( T ctx ) {
this . ctx = ctx ;
return this ;
}
public void run ( ) {
TestUtils . standardOutErrEnabled ( verboseMode ) ;
if ( ctx . isUninitializable ( ) ) {
@ -154,7 +184,7 @@ public class TestUnit<T extends TestContextInterface> implements Runnable {
}
private void setTestResult ( TestState r ) {
assert ( r = = TestState . SKIPPED | | r = = TestState . FAILED | | r = = TestState . SUCCESS | | r = = TestState . UNEVALUATED ) : "PityTest Internal: illegal result value '" + r + "'" ;
assert ( r = = TestState . SKIPPED | | r = = TestState . FAILED | | r = = TestState . SUCCESS | | r = = TestState . UNEVALUATED ) : "PityTest Internal: illegal result value '" + r + "'" ;
result = r ;
TestUtils . standardOutErrEnabled ( true ) ;
logH1 ( makeLogString ( ) ) ;