You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2022/11/11 08:56:51 UTC

[uima-uimafit] branch feature/211-Conveniently-skip-validation created (now 62484e6)

This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch feature/211-Conveniently-skip-validation
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git


      at 62484e6  Issue #211: Conveniently skip validation

This branch includes the following new commits:

     new 62484e6  Issue #211: Conveniently skip validation

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[uima-uimafit] 01/01: Issue #211: Conveniently skip validation

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch feature/211-Conveniently-skip-validation
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git

commit 62484e6d4dce5ded7b646b57391bc6c94e6e0a5c
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Fri Nov 11 09:56:44 2022 +0100

    Issue #211: Conveniently skip validation
    
    - Add convenience methods for skipping validation
    - Add JavaDoc
---
 .../apache/uima/fit/testing/junit/ManagedCas.java  | 29 +++++++++++++++++++++-
 .../apache/uima/fit/testing/junit/ManagedJCas.java | 29 +++++++++++++++++++++-
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/uimafit-junit/src/main/java/org/apache/uima/fit/testing/junit/ManagedCas.java b/uimafit-junit/src/main/java/org/apache/uima/fit/testing/junit/ManagedCas.java
index cfb50aa..b16d163 100644
--- a/uimafit-junit/src/main/java/org/apache/uima/fit/testing/junit/ManagedCas.java
+++ b/uimafit-junit/src/main/java/org/apache/uima/fit/testing/junit/ManagedCas.java
@@ -112,16 +112,43 @@ public final class ManagedCas implements TestWatcher, AfterTestExecutionCallback
     }
   }
 
+  /**
+   * Skip validation for the current test run only.
+   * 
+   * @return the object for chaining.
+   */
   public ManagedCas skipValidation() {
-    validator = null;
+    validator = new Validator.Builder().withoutAutoDetectedChecks().build();
     return this;
   }
 
+  /**
+   * Skip validation by default. If validation is enabled for a particular run using
+   * {@link #withValidator(Validator)} it is reset to a no-op validator again after the test is
+   * complete.
+   * 
+   * @return the object for chaining.
+   */
+  public ManagedCas withoutDefaultValidator() {
+    this.defaultValidator = new Validator.Builder().withoutAutoDetectedChecks().build();
+    return this;
+  }
+
+  /**
+   * Set a default validator for the all test runs.
+   * 
+   * @return the object for chaining.
+   */
   public ManagedCas withDefaultValidator(Validator aValidator) {
     this.defaultValidator = aValidator;
     return this;
   }
 
+  /**
+   * Set a validator for the current test run only.
+   * 
+   * @return the object for chaining.
+   */
   public ManagedCas withValidator(Validator aValidator) {
     this.validator = aValidator;
     return this;
diff --git a/uimafit-junit/src/main/java/org/apache/uima/fit/testing/junit/ManagedJCas.java b/uimafit-junit/src/main/java/org/apache/uima/fit/testing/junit/ManagedJCas.java
index fb2c0d9..74e51b2 100644
--- a/uimafit-junit/src/main/java/org/apache/uima/fit/testing/junit/ManagedJCas.java
+++ b/uimafit-junit/src/main/java/org/apache/uima/fit/testing/junit/ManagedJCas.java
@@ -113,16 +113,43 @@ public final class ManagedJCas
     }
   }
 
+  /**
+   * Skip validation for the current test run only.
+   * 
+   * @return the object for chaining.
+   */
   public ManagedJCas skipValidation() {
-    validator = null;
+    validator = new Validator.Builder().withoutAutoDetectedChecks().build();
     return this;
   }
 
+  /**
+   * Skip validation by default. If validation is enabled for a particular run using
+   * {@link #withValidator(Validator)} it is reset to a no-op validator again after the test is
+   * complete.
+   * 
+   * @return the object for chaining.
+   */
+  public ManagedJCas withoutDefaultValidator() {
+    this.defaultValidator = new Validator.Builder().withoutAutoDetectedChecks().build();
+    return this;
+  }
+
+  /**
+   * Set a default validator for the all test runs.
+   * 
+   * @return the object for chaining.
+   */
   public ManagedJCas withDefaultValidator(Validator aValidator) {
     this.defaultValidator = aValidator;
     return this;
   }
 
+  /**
+   * Set a validator for the current test run only.
+   * 
+   * @return the object for chaining.
+   */
   public ManagedJCas withValidator(Validator aValidator) {
     this.validator = aValidator;
     return this;