patterntesting.runtime.junit.internal
Class SmokeFilter

Package class diagram package SmokeFilter
java.lang.Object
  extended by org.junit.runner.manipulation.Filter
      extended by patterntesting.runtime.junit.internal.SmokeFilter

public final class SmokeFilter
extends org.junit.runner.manipulation.Filter

This filter handles the different annotations like Broken, RunTestOn, SkipTestOn, IntegrationTest or SmokeTest.

Since:
1.0 (03.05.2010)
Author:
oliver

Field Summary
 
Fields inherited from class org.junit.runner.manipulation.Filter
ALL
 
Constructor Summary
SmokeFilter()
           
 
Method Summary
 String describe()
          Describes the kind of test e.g.
 int getFilteredNumber()
          Gets the number of methods which was filtered out.
 boolean hasFiltered()
          Checks if there are some methods filtered out.
 boolean isBroken(String method, Broken broken)
          Checks for a given method if the condition of the given Broken annotations is fulfilled.
 void setOsName(String name)
          For testing you can set the OS name.
 void setToday(Date date)
          For testing (e.g. to check the past) you can set the today's date.
 void setUserName(String name)
          For testing you can set the user name.
 boolean shouldBeIgnored(org.junit.runner.Description description)
          Should be ignored.
 boolean shouldRun(org.junit.runner.Description description)
          Handles the different annotations like Broken, RunTestOn, SkipTestOn, IntegrationTest or SmokeTest.
 String toString()
          Prints the description of this filter.
 
Methods inherited from class org.junit.runner.manipulation.Filter
apply, intersect, matchMethodDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SmokeFilter

public SmokeFilter()
Method Detail

setToday

public void setToday(Date date)
For testing (e.g. to check the past) you can set the today's date.

Parameters:
date - the new today's date

setOsName

public void setOsName(String name)
For testing you can set the OS name.

Parameters:
name - the new os name

setUserName

public void setUserName(String name)
For testing you can set the user name.

Parameters:
name - the new user name

describe

public String describe()
Describes the kind of test e.g. "IntegrationTest".

Specified by:
describe in class org.junit.runner.manipulation.Filter
Returns:
e.g. "all tests including integration tests"
See Also:
Filter.describe()

shouldRun

public boolean shouldRun(org.junit.runner.Description description)
Handles the different annotations like Broken, RunTestOn, SkipTestOn, IntegrationTest or SmokeTest. We use a cache (shouldRunCache) here in this implementation to avoid to much logging of "...run method / skip method..." messages.

Specified by:
shouldRun in class org.junit.runner.manipulation.Filter
Parameters:
description - containing the JUnit class and test method
Returns:
depends on the annotation
See Also:
Filter.shouldRun(org.junit.runner.Description)

shouldBeIgnored

public boolean shouldBeIgnored(org.junit.runner.Description description)
Should be ignored.

Parameters:
description - the description
Returns:
true, if successful

isBroken

public boolean isBroken(String method,
                        Broken broken)
Checks for a given method if the condition of the given Broken annotations is fulfilled.
NOTE: The method has default visibility

Parameters:
method - the method
broken - the broken
Returns:
true, if is broken

hasFiltered

public boolean hasFiltered()
Checks if there are some methods filtered out.

Returns:
true if some methods were filtered

getFilteredNumber

public int getFilteredNumber()
Gets the number of methods which was filtered out.

Returns:
the filtered number

toString

public String toString()
Prints the description of this filter.

Overrides:
toString in class Object
Returns:
a String including the result of the describe() method
See Also:
Object.toString()


Copyright © 2002–2014 PatternTesting Team. All rights reserved.