use of org.junit.AssumptionViolatedException in project spring-security by spring-projects.
the class CryptoAssumptions method assumeAes256.
private static void assumeAes256(CipherAlgorithm cipherAlgorithm) {
boolean aes256Available = false;
try {
Cipher.getInstance(cipherAlgorithm.toString());
aes256Available = Cipher.getMaxAllowedKeyLength("AES") >= 256;
} catch (NoSuchAlgorithmException e) {
throw new AssumptionViolatedException(cipherAlgorithm + " not available, skipping test", e);
} catch (NoSuchPaddingException e) {
throw new AssumptionViolatedException(cipherAlgorithm + " padding not available, skipping test", e);
}
Assume.assumeTrue("AES key length of 256 not allowed, skipping test", aes256Available);
}
use of org.junit.AssumptionViolatedException in project geode by apache.
the class ConditionalIgnoreRule method throwOnIgnoreTest.
protected Statement throwOnIgnoreTest(Statement statement, Description description) {
if (isTest(description)) {
boolean ignoreTest = false;
String message = "";
ConditionalIgnore testCaseAnnotation = description.getAnnotation(ConditionalIgnore.class);
if (testCaseAnnotation != null) {
ignoreTest = evaluate(testCaseAnnotation, description);
message = testCaseAnnotation.value();
} else if (description.getTestClass().isAnnotationPresent(ConditionalIgnore.class)) {
ConditionalIgnore testClassAnnotation = description.getTestClass().getAnnotation(ConditionalIgnore.class);
ignoreTest = evaluate(testClassAnnotation, description);
message = testClassAnnotation.value();
}
if (ignoreTest) {
throw new AssumptionViolatedException(format(message, description));
}
}
return statement;
}
use of org.junit.AssumptionViolatedException in project mongo-java-driver by mongodb.
the class CrudTest method getOperationMongoOperations.
private BsonDocument getOperationMongoOperations(final BsonDocument operation) {
String name = operation.getString("name").getValue();
BsonDocument arguments = operation.getDocument("arguments");
String methodName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1) + "MongoOperation";
try {
Method method = getClass().getDeclaredMethod(methodName, BsonDocument.class);
return convertMongoOperationToResult(method.invoke(this, arguments));
} catch (NoSuchMethodException e) {
throw new UnsupportedOperationException("No handler for operation " + methodName);
} catch (InvocationTargetException e) {
if (e.getTargetException() instanceof AssumptionViolatedException) {
throw (AssumptionViolatedException) e.getTargetException();
}
throw new UnsupportedOperationException("Invalid handler for operation " + methodName);
} catch (IllegalAccessException e) {
throw new UnsupportedOperationException("Invalid handler access for operation " + methodName);
}
}
use of org.junit.AssumptionViolatedException in project geode by apache.
the class IgnoreUntilRule method throwOnIgnoreTest.
protected Statement throwOnIgnoreTest(Statement statement, Description description) {
if (isTest(description)) {
boolean ignoreTest = false;
String message = "";
IgnoreUntil testCaseAnnotation = description.getAnnotation(IgnoreUntil.class);
if (testCaseAnnotation != null) {
ignoreTest = evaluate(testCaseAnnotation, description);
message = testCaseAnnotation.value();
} else if (description.getTestClass().isAnnotationPresent(IgnoreUntil.class)) {
IgnoreUntil testClassAnnotation = description.getTestClass().getAnnotation(IgnoreUntil.class);
ignoreTest = evaluate(testClassAnnotation, description);
message = testClassAnnotation.value();
}
if (ignoreTest) {
throw new AssumptionViolatedException(format(message, description));
}
}
return statement;
}
use of org.junit.AssumptionViolatedException in project jackrabbit-oak by apache.
the class DocumentMongoFixture method createNodeStore.
@Override
public NodeStore createNodeStore() {
try {
String suffix = String.format("-%d-%d", System.currentTimeMillis(), sequence.incrementAndGet());
DocumentMK.Builder builder = new DocumentMK.Builder();
if (blobStore != null) {
builder.setBlobStore(blobStore);
}
builder.setPersistentCache("target/persistentCache,time");
builder.setMongoDB(getDb(suffix));
DocumentNodeStore ns = builder.getNodeStore();
suffixes.put(ns, suffix);
return ns;
} catch (Exception e) {
throw new AssumptionViolatedException("Mongo instance is not available", e);
}
}
Aggregations