ttomcat-1778514358873.zip-extract/_dependencies/maven/junit_junit-4.13.2/org/junit/rules/TestWatchman.java

Path
ttomcat-1778514358873.zip-extract/_dependencies/maven/junit_junit-4.13.2/org/junit/rules/TestWatchman.java
Status
scanned
Type
file
Name
TestWatchman.java
Extension
.java
Programming language
Java
Mime type
text/x-java
File type
Java source, ASCII text
Tag

      
    
Rootfs path

      
    
Size
2419 (2.4 KB)
MD5
946b9d695f551928b68a73cd44ec67d0
SHA1
7d845071ee345f02b264ef798ac7b2cf538cc01a
SHA256
1b27276b8f64f8768c812ae3b0255611c0e48f6298da9c527f6174076bd4fc4e
SHA512

      
    
SHA1_git
c8d6c71ab7cfa2f066aa37797d1ac04ae1f372a8
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestWatchman.java | 2.4 KB |

package org.junit.rules; import org.junit.internal.AssumptionViolatedException; import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.Statement; /** * TestWatchman is a base class for Rules that take note of the testing * action, without modifying it. For example, this class will keep a log of each * passing and failing test: * * <pre> * public static class WatchmanTest { * private static String watchedLog; * * &#064;Rule * public MethodRule watchman= new TestWatchman() { * &#064;Override * public void failed(Throwable e, FrameworkMethod method) { * watchedLog+= method.getName() + &quot; &quot; + e.getClass().getSimpleName() * + &quot; &quot;; * } * * &#064;Override * public void succeeded(FrameworkMethod method) { * watchedLog+= method.getName() + &quot; &quot; + &quot;success! &quot;; * } * }; * * &#064;Test * public void fails() { * fail(); * } * * &#064;Test * public void succeeds() { * } * } * </pre> * * @since 4.7 * @deprecated Use {@link TestWatcher} (which implements {@link TestRule}) instead. */ @Deprecated public class TestWatchman implements MethodRule { public Statement apply(final Statement base, final FrameworkMethod method, Object target) { return new Statement() { @Override public void evaluate() throws Throwable { starting(method); try { base.evaluate(); succeeded(method); } catch (AssumptionViolatedException e) { throw e; } catch (Throwable e) { failed(e, method); throw e; } finally { finished(method); } } }; } /** * Invoked when a test method succeeds */ public void succeeded(FrameworkMethod method) { } /** * Invoked when a test method fails */ public void failed(Throwable e, FrameworkMethod method) { } /** * Invoked when a test method is about to start */ public void starting(FrameworkMethod method) { } /** * Invoked when a test method finishes (whether passing or failing) */ public void finished(FrameworkMethod method) { } }