类org.junit.internal.AssumptionViolatedException源码实例Demo

下面列出了怎么用org.junit.internal.AssumptionViolatedException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: activiti6-boot2   文件: ActivitiFormRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
  return new Statement() {
    @Override
    public void evaluate() throws Throwable {
      List<Throwable> errors = new ArrayList<Throwable>();

      startingQuietly(description, errors);
      try {
        base.evaluate();
        succeededQuietly(description, errors);
      } catch (AssumptionViolatedException e) {
        errors.add(e);
        skippedQuietly(e, description, errors);
      } catch (Throwable t) {
        errors.add(t);
        failedQuietly(t, description, errors);
      } finally {
        finishedQuietly(description, errors);
      }

      MultipleFailureException.assertEmpty(errors);
    }
  };
}
 
源代码2 项目: activiti6-boot2   文件: ActivitiRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
  return new Statement() {
    @Override
    public void evaluate() throws Throwable {
      List<Throwable> errors = new ArrayList<Throwable>();

      startingQuietly(description, errors);
      try {
        base.evaluate();
        succeededQuietly(description, errors);
      } catch (AssumptionViolatedException e) {
        errors.add(e);
        skippedQuietly(e, description, errors);
      } catch (Throwable t) {
        errors.add(t);
        failedQuietly(t, description, errors);
      } finally {
        finishedQuietly(description, errors);
      }

      MultipleFailureException.assertEmpty(errors);
    }
  };
}
 
源代码3 项目: activiti6-boot2   文件: ActivitiRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
	return new Statement() {
		@Override
		public void evaluate() throws Throwable {
			List<Throwable> errors = new ArrayList<Throwable>();

			startingQuietly(description, errors);
			try {
				base.evaluate();
				succeededQuietly(description, errors);
			} catch (AssumptionViolatedException e) {
				errors.add(e);
				skippedQuietly(e, description, errors);
			} catch (Throwable t) {
				errors.add(t);
				failedQuietly(t, description, errors);
			} finally {
				finishedQuietly(description, errors);
			}

			MultipleFailureException.assertEmpty(errors);
		}
	};
}
 
源代码4 项目: activiti6-boot2   文件: ActivitiDmnRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<Throwable>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            } finally {
                finishedQuietly(description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
@Override
public Statement apply(final Statement base, final Description description, final Object[] params) {
	return new Statement() {
		public void evaluate() throws Throwable {
			ArrayList<Throwable> errors = new ArrayList<Throwable>();
			ParameterizedTestWatcher.this.startingQuietly(description, errors, params);

			try {
				base.evaluate();
				ParameterizedTestWatcher.this.succeededQuietly(description, errors, params);
			} catch (AssumptionViolatedException var7) {
				errors.add(var7);
				ParameterizedTestWatcher.this.skippedQuietly(var7, description, errors, params);
			} catch (Throwable var8) {
				errors.add(var8);
				ParameterizedTestWatcher.this.failedQuietly(var8, description, errors, params);
			} finally {
				ParameterizedTestWatcher.this.finishedQuietly(description, errors, params);
			}

			MultipleFailureException.assertEmpty(errors);
		}
	};
}
 
源代码6 项目: openjdk-jdk9   文件: UnsafeDeopt.java
@Test
public void testUnsafe() {
    int m = 42;
    long addr1 = createBuffer();
    long addr2 = createBuffer();
    try {
        ResolvedJavaMethod method = getResolvedJavaMethod("readWriteReadUnsafe");
        Object receiver = method.isStatic() ? null : this;
        Result expect = executeExpected(method, receiver, addr1, m);
        if (getCodeCache() == null) {
            return;
        }
        testAgainstExpected(method, expect, receiver, addr2, m);
    } catch (AssumptionViolatedException e) {
        // Suppress so that subsequent calls to this method within the
        // same Junit @Test annotated method can proceed.
    } finally {
        disposeBuffer(addr1);
        disposeBuffer(addr2);
    }
}
 
源代码7 项目: openjdk-jdk9   文件: UnsafeDeopt.java
@Test
public void testByteBuffer() {
    int m = 42;
    try {
        ResolvedJavaMethod method = getResolvedJavaMethod("readWriteReadByteBuffer");
        Object receiver = method.isStatic() ? null : this;
        Result expect = executeExpected(method, receiver, ByteBuffer.allocateDirect(32), m);
        if (getCodeCache() == null) {
            return;
        }
        ByteBuffer warmupBuffer = ByteBuffer.allocateDirect(32);
        for (int i = 0; i < 10000; ++i) {
            readWriteReadByteBuffer(warmupBuffer, (i % 50) + 1);
            warmupBuffer.putInt(0, 0);
        }
        testAgainstExpected(method, expect, receiver, ByteBuffer.allocateDirect(32), m);
    } catch (AssumptionViolatedException e) {
        // Suppress so that subsequent calls to this method within the
        // same Junit @Test annotated method can proceed.
    }
}
 
源代码8 项目: hadoop   文件: S3ATestUtils.java
public static S3AFileSystem createTestFileSystem(Configuration conf) throws
    IOException {
  String fsname = conf.getTrimmed(TestS3AFileSystemContract.TEST_FS_S3A_NAME, "");


  boolean liveTest = !StringUtils.isEmpty(fsname);
  URI testURI = null;
  if (liveTest) {
    testURI = URI.create(fsname);
    liveTest = testURI.getScheme().equals(Constants.FS_S3A);
  }
  if (!liveTest) {
    // This doesn't work with our JUnit 3 style test cases, so instead we'll
    // make this whole class not run by default
    throw new AssumptionViolatedException(
        "No test filesystem in " + TestS3AFileSystemContract.TEST_FS_S3A_NAME);
  }
  S3AFileSystem fs1 = new S3AFileSystem();
  //enable purging in tests
  conf.setBoolean(Constants.PURGE_EXISTING_MULTIPART, true);
  conf.setInt(Constants.PURGE_EXISTING_MULTIPART_AGE, 0);
  fs1.initialize(testURI, conf);
  return fs1;
}
 
源代码9 项目: big-c   文件: S3ATestUtils.java
public static S3AFileSystem createTestFileSystem(Configuration conf) throws
    IOException {
  String fsname = conf.getTrimmed(TestS3AFileSystemContract.TEST_FS_S3A_NAME, "");


  boolean liveTest = !StringUtils.isEmpty(fsname);
  URI testURI = null;
  if (liveTest) {
    testURI = URI.create(fsname);
    liveTest = testURI.getScheme().equals(Constants.FS_S3A);
  }
  if (!liveTest) {
    // This doesn't work with our JUnit 3 style test cases, so instead we'll
    // make this whole class not run by default
    throw new AssumptionViolatedException(
        "No test filesystem in " + TestS3AFileSystemContract.TEST_FS_S3A_NAME);
  }
  S3AFileSystem fs1 = new S3AFileSystem();
  //enable purging in tests
  conf.setBoolean(Constants.PURGE_EXISTING_MULTIPART, true);
  conf.setInt(Constants.PURGE_EXISTING_MULTIPART_AGE, 0);
  fs1.initialize(testURI, conf);
  return fs1;
}
 
源代码10 项目: lucene-solr   文件: LuceneTestCase.java
/**
 * Helper method for {@link #expectThrows} and {@link #expectThrowsAnyOf} that takes care of propagating
 * any {@link AssertionError} or {@link AssumptionViolatedException} instances thrown if and only if they 
 * are super classes of the <code>expectedTypes</code>.  Otherwise simply returns any {@link Throwable} 
 * thrown, regardless of type, or null if the <code>runnable</code> completed w/o error.
 */
private static Throwable _expectThrows(List<? extends Class<?>> expectedTypes, ThrowingRunnable runnable) {
                                       
  try {
    runnable.run();
  } catch (AssertionError | AssumptionViolatedException ae) {
    for (Class<?> expectedType : expectedTypes) {
      if (expectedType.isInstance(ae)) { // user is expecting this type explicitly
        return ae;
      }
    }
    throw ae;
  } catch (Throwable e) {
    return e;
  }
  return null;
}
 
源代码11 项目: lucene-solr   文件: TestExpectThrows.java
/** 
 * Tests that {@link #expectThrows} behaves correctly when the Runnable contains an 
 * assumption that does not pass: by allowing that assumption to propogate and cause 
 * the test to <code>SKIP</code>.
 */
public void testNestedAssume() {
  final AtomicBoolean ran = new AtomicBoolean(false);
  AssumptionViolatedException caught = null;
  try {
    final IOException returned = expectThrows(IOException.class, () -> {
        ran.getAndSet(true);
        assumeTrue("this assumption should propogate", false);
      });
    fail("must not complete"); // NOTE: we don't use expectThrows to test expectThrows
  } catch (AssumptionViolatedException ave) {
    caught = ave;
  }
  assertTrue(ran.get());
  assertNotNull(caught);
  assertEquals("this assumption should propogate", caught.getMessage());
}
 
源代码12 项目: lucene-solr   文件: TestExpectThrows.java
/** 
 * Tests that {@link #expectThrows} behaves correctly when the Runnable contains an 
 * assumption that does not pass but the caller has explicitly said they expect an Exception of that type: 
 * by returning that assumption failure Exception.
 */
public void testExpectingNestedAssume() {
  final AtomicBoolean ran = new AtomicBoolean(false);
  AssumptionViolatedException returned = null;
  try {
    returned = expectThrows(AssumptionViolatedException.class, () -> {
        ran.getAndSet(true);
        assumeTrue("this assumption should be returned, not propogated", false);
      });
  } catch (AssumptionViolatedException caught) { // NOTE: we don't use expectThrows to test expectThrows
    assertNull("An exception should not have been thrown", caught);
  }
  assertTrue(ran.get());
  assertNotNull(returned);
  assertEquals("this assumption should be returned, not propogated", returned.getMessage());
}
 
protected Statement prepareMethodBlock(final FrameworkMethod method, final RunNotifier notifier) {
	final Statement methodBlock = superMethodBlock(method);
	return new Statement() {
		@Override
		public void evaluate() throws Throwable {
			try {
				methodBlock.evaluate();
				Description description = describeChild(method);
				try {
					notifier.fireTestStarted(description);
					notifier.fireTestAssumptionFailed(new Failure(description, new AssumptionViolatedException("Method " + method.getName() + " did parse any input")));
				} finally {
					notifier.fireTestFinished(description);
				}
			} catch(TestDataCarrier testData) {
				AbstractParallelScenarioRunner.this.testData.put(method, testData.getData());
			}
		}
	};
}
 
源代码14 项目: xtext-eclipse   文件: AbstractScenarioRunner.java
protected void process(String data) throws Exception {
	IInjectorProvider delegate = getOrCreateInjectorProvider().getDelegate();
	if (delegate instanceof IRegistryConfigurator) {
		IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) delegate;
		registryConfigurator.setupRegistry();
		try {
			ScenarioProcessor processor = delegate.getInjector().getInstance(processorClass);
			String preProcessed = processor.preProcess(data);
			if (preProcessed == null) {
				throw new AssumptionViolatedException("Input is filtered by the pre processing step: " + data);
			}
			doProcess(preProcessed, processor);
		} finally {
			registryConfigurator.restoreRegistry();
		}
	}
}
 
源代码15 项目: flowable-engine   文件: FlowableDmnRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            } finally {
                finishedQuietly(description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
源代码16 项目: flowable-engine   文件: FlowableIdmRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
源代码17 项目: flowable-engine   文件: ActivitiRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<Throwable>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            } finally {
                finishedQuietly(description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
源代码18 项目: flowable-engine   文件: FlowableCmmnRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            } finally {
                finishedQuietly(description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
源代码19 项目: tinkerpop   文件: GremlinProcessRunner.java
@Override
public void runChild(final FrameworkMethod method, final RunNotifier notifier) {
    final Description description = describeChild(method);
    if (this.isIgnored(method)) {
        notifier.fireTestIgnored(description);
    } else {
        final EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
        eachNotifier.fireTestStarted();
        boolean ignored = false;
        try {
            this.methodBlock(method).evaluate();
        } catch (AssumptionViolatedException ave) {
            eachNotifier.addFailedAssumption(ave);
        } catch (Throwable e) {
            if (validateForGraphComputer(e)) {
                eachNotifier.fireTestIgnored();
                logger.info(e.getMessage());
                ignored = true;
            } else
                eachNotifier.addFailure(e);
        } finally {
            if (!ignored)
                eachNotifier.fireTestFinished();
        }
    }
}
 
源代码20 项目: flowable-engine   文件: FlowableAppRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            } finally {
                finishedQuietly(description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
源代码21 项目: flowable-engine   文件: FlowableFormRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            } finally {
                finishedQuietly(description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
源代码22 项目: flowable-engine   文件: FlowableContentRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            } finally {
                finishedQuietly(description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
源代码23 项目: flowable-engine   文件: FlowableEventRule.java
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            } finally {
                finishedQuietly(description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
源代码24 项目: activiti6-boot2   文件: ActivitiFormRule.java
private void skippedQuietly(AssumptionViolatedException e, Description description, List<Throwable> errors) {
  try {
    skipped(e, description);
  } catch (Throwable t) {
    errors.add(t);
  }
}
 
源代码25 项目: activiti6-boot2   文件: ActivitiRule.java
private void skippedQuietly(AssumptionViolatedException e, Description description, List<Throwable> errors) {
  try {
    skipped(e, description);
  } catch (Throwable t) {
    errors.add(t);
  }
}
 
源代码26 项目: hifive-pitalium   文件: ParameterizedTestWatcher.java
private void skippedQuietly(AssumptionViolatedException e, Description description, List<Throwable> errors,
		Object[] params) {
	try {
		if (e instanceof org.junit.AssumptionViolatedException) {
			this.skipped((org.junit.AssumptionViolatedException) e, description, params);
		} else {
			this.skipped(e, description, params);
		}
	} catch (Throwable var5) {
		errors.add(var5);
	}

}
 
源代码27 项目: activiti6-boot2   文件: ActivitiRule.java
private void skippedQuietly(AssumptionViolatedException e,
    Description description, List<Throwable> errors) {
	try {
		skipped(e, description);
	} catch (Throwable t) {
		errors.add(t);
	}
}
 
源代码28 项目: marathonv5   文件: AllureMarathonRunListener.java
public void fireTestCaseFailure(Throwable throwable) {
    if (throwable instanceof AssumptionViolatedException) {
        getLifecycle().fire(new TestCaseCanceledEvent().withThrowable(throwable));
    } else {
        getLifecycle().fire(new TestCaseFailureEvent().withThrowable(throwable));
    }
}
 
源代码29 项目: openjdk-jdk9   文件: GraalCompilerTest.java
protected void test(String name, Object... args) {
    try {
        ResolvedJavaMethod method = getResolvedJavaMethod(name);
        Object receiver = method.isStatic() ? null : this;
        test(method, receiver, args);
    } catch (AssumptionViolatedException e) {
        // Suppress so that subsequent calls to this method within the
        // same Junit @Test annotated method can proceed.
    }
}
 
源代码30 项目: hadoop   文件: S3FileSystemContractBaseTest.java
@Override
protected void setUp() throws Exception {
  Configuration conf = new Configuration();
  store = getFileSystemStore();
  fs = new S3FileSystem(store);
  String fsname = conf.get(KEY_TEST_FS);
  if (StringUtils.isEmpty(fsname)) {
    throw new AssumptionViolatedException(
        "No test FS defined in :" + KEY_TEST_FS);
  }
  fs.initialize(URI.create(fsname), conf);
}
 
 类所在包
 同包方法