Package org.talend.sdk.component.junit
Class ExceptionVerifier<T extends RuntimeException>
java.lang.Object
org.talend.sdk.component.junit.ExceptionVerifier<T>
- All Implemented Interfaces:
- org.junit.rules.TestRule
public class ExceptionVerifier<T extends RuntimeException>
extends Object
implements org.junit.rules.TestRule
A rule to access an exception from a test using a 
Consumer
 Usage example :
 
 
 
 Rule public ExceptionVerifier<HttpException> httpExceptionRule = new ExceptionVerifier<>();
  @Test
  public void test(){
      httpExceptionRule.assertWith(e -> {
          assertEquals(401, e.getResponse().status());
          assertEquals("expected error message", e.getResponse().error(String.class));
      });
  }
 
 - 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionorg.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description) voidassertWith(Consumer<T> consumer) 
- 
Constructor Details- 
ExceptionVerifierpublic ExceptionVerifier()
 
- 
- 
Method Details- 
assertWith
- 
applypublic org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - Specified by:
- applyin interface- org.junit.rules.TestRule
 
 
-