diff --git a/dependency-check-core/src/test/java/com/codeaffine/junit/ignore/ConditionalIgnoreRule.java b/dependency-check-core/src/test/java/com/codeaffine/junit/ignore/ConditionalIgnoreRule.java
deleted file mode 100644
index 1c1fab570..000000000
--- a/dependency-check-core/src/test/java/com/codeaffine/junit/ignore/ConditionalIgnoreRule.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * *****************************************************************************
- * Copyright (c) 2013 Rüdiger Herrmann All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Rüdiger Herrmann - initial API and implementation
- *****************************************************************************
- */
-package com.codeaffine.junit.ignore;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.junit.Assume;
-import org.junit.rules.MethodRule;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-
-public class ConditionalIgnoreRule implements MethodRule {
-
- public interface IgnoreCondition {
-
- boolean isSatisfied();
- }
-
- @Retention(RetentionPolicy.RUNTIME)
- @Target({ElementType.METHOD})
- public @interface ConditionalIgnore {
-
- Class extends IgnoreCondition> condition();
- }
-
- public Statement apply(Statement base, FrameworkMethod method, Object target) {
- Statement result = base;
- if (hasConditionalIgnoreAnnotation(method)) {
- IgnoreCondition condition = getIgnoreContition(method);
- if (condition.isSatisfied()) {
- result = new IgnoreStatement(condition);
- }
- }
- return result;
- }
-
- private boolean hasConditionalIgnoreAnnotation(FrameworkMethod method) {
- return method.getAnnotation(ConditionalIgnore.class) != null;
- }
-
- private IgnoreCondition getIgnoreContition(FrameworkMethod method) {
- ConditionalIgnore annotation = method.getAnnotation(ConditionalIgnore.class);
- return newCondition(annotation);
- }
-
- private IgnoreCondition newCondition(ConditionalIgnore annotation) {
- try {
- return annotation.condition().newInstance();
- } catch (RuntimeException re) {
- throw re;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private static class IgnoreStatement extends Statement {
-
- private IgnoreCondition condition;
-
- IgnoreStatement(IgnoreCondition condition) {
- this.condition = condition;
- }
-
- @Override
- public void evaluate() {
- Assume.assumeTrue("Ignored by " + condition.getClass().getSimpleName(), false);
- }
- }
-
-}
diff --git a/dependency-check-core/src/test/java/com/codeaffine/junit/ignore/NotRunningOnWindows.java b/dependency-check-core/src/test/java/com/codeaffine/junit/ignore/NotRunningOnWindows.java
deleted file mode 100644
index 16cf154dc..000000000
--- a/dependency-check-core/src/test/java/com/codeaffine/junit/ignore/NotRunningOnWindows.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * *****************************************************************************
- * Copyright (c) 2013 Rüdiger Herrmann All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Rüdiger Herrmann - initial API and implementation
- * ****************************************************************************
- */
-package com.codeaffine.junit.ignore;
-
-/**
- * The following NotRunningOnWindows class was taken from blog by Rüdiger Herrmann titled
- * A JUnit Rule to Conditionally Ignore Tests.
- *
- * @author Rüdiger Herrmann
- */
-public class NotRunningOnWindows implements ConditionalIgnoreRule.IgnoreCondition {
-
- @Override
- public boolean isSatisfied() {
- return !System.getProperty("os.name").startsWith("Windows");
- }
-}
diff --git a/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzerTest.java b/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzerTest.java
index ee76cb825..cf205f04d 100644
--- a/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzerTest.java
+++ b/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzerTest.java
@@ -17,16 +17,12 @@
*/
package org.owasp.dependencycheck.analyzer;
-import com.codeaffine.junit.ignore.ConditionalIgnoreRule;
-import com.codeaffine.junit.ignore.ConditionalIgnoreRule.ConditionalIgnore;
-import com.codeaffine.junit.ignore.NotRunningOnWindows;
import java.io.File;
import org.junit.After;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.owasp.dependencycheck.dependency.Confidence;
import org.owasp.dependencycheck.dependency.Dependency;
@@ -88,12 +84,12 @@ public class AssemblyAnalyzerTest {
analyzer.analyze(d, null);
}
- @Rule
- public ConditionalIgnoreRule rule = new ConditionalIgnoreRule();
-
- @Test()
- @ConditionalIgnore(condition = NotRunningOnWindows.class)
+ @Test(expected = AnalysisException.class)
public void testWithSettingMono() throws Exception {
+
+ //This test doesn't work on Windows.
+ assumeFalse(System.getProperty("os.name").startsWith("Windows"));
+
String oldValue = Settings.getString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH);
// if oldValue is null, that means that neither the system property nor the setting has
// been set. If that's the case, then we have to make it such that when we recover,
@@ -105,14 +101,10 @@ public class AssemblyAnalyzerTest {
Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, "/yooser/bine/mono");
}
- //** @Test(expected = AnalysisException) doesn't seem to work with the conditional test **//
- AnalysisException aex = null;
try {
// Have to make a NEW analyzer because during setUp, it would have gotten the correct one
AssemblyAnalyzer aanalyzer = new AssemblyAnalyzer();
aanalyzer.initialize();
- } catch (AnalysisException ex) {
- aex = ex;
} finally {
// Now recover the way we came in. If we had to set a System property, delete it. Otherwise,
// reset the old value
@@ -122,7 +114,6 @@ public class AssemblyAnalyzerTest {
Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, oldValue);
}
}
- assertNull("Excpted exception: org.owasp.dependencycheck.analyzer.AnalysisException", aex);
}
@After