CVS: junit/src/org/junit/experimental/theories/runner/api Theories.java, 1.1, 1.2

David Saff <[email protected]> Thu, 12 Jul 2007 10:08:28 -0700
Newsgroups gmane.comp.java.junit.devel
Message-ID <[email protected]>
Update of /cvsroot/junit/junit/src/org/junit/experimental/theories/runner/api
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26134/src/org/junit/experimental/theories/runner/api

Modified Files:
	Theories.java 
Log Message:
Re-organize theory packages

Index: Theories.java
===================================================================
RCS file: /cvsroot/junit/junit/src/org/junit/experimental/theories/runner/api/Theories.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Theories.java	2 Jul 2007 18:11:14 -0000	1.1
+++ Theories.java	12 Jul 2007 17:08:26 -0000	1.2
@@ -3,67 +3,17 @@
  */
 package org.junit.experimental.theories.runner.api;
 
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.ArrayList;
 import java.util.List;
 
-import org.junit.Assert;
-import org.junit.Assume.AssumptionViolatedException;
-import org.junit.experimental.theories.javamodel.api.ConcreteFunction;
 import org.junit.experimental.theories.methods.api.Theory;
-import org.junit.experimental.theories.runner.TheoryContainerReference;
+import org.junit.experimental.theories.runner.TheoryMethod;
 import org.junit.internal.runners.InitializationError;
 import org.junit.internal.runners.JUnit4ClassRunner;
-import org.junit.internal.runners.TestClass;
 import org.junit.internal.runners.TestMethod;
 
 @SuppressWarnings("restriction")
 public class Theories extends JUnit4ClassRunner {
-	public static class TheoryMethod extends TestMethod {
-		private final Method fMethod;
-
-		private List<AssumptionViolatedException> fInvalidParameters= new ArrayList<AssumptionViolatedException>();
-
-		private TheoryMethod(Method method, TestClass testClass) {
-			super(method, testClass);
-			fMethod= method;
-		}
-
-		@Override
-		public void invoke(Object test) throws IllegalArgumentException,
-				IllegalAccessException, InvocationTargetException {
-			TheoryContainerReference container= new TheoryContainerReference(
-					test);
-
-			ConcreteFunction function= new ConcreteFunction(test, fMethod);
-
-			int runCount= 0;
-			try {
-				runCount+= container.runWithParameters(this,
-						new ArrayList<Object>(), function.signatures());
-			} catch (Throwable e) {
-				throw new InvocationTargetException(e);
-			}
-			if (runCount == 0)
-				Assert
-						.fail("Never found parameters that satisfied method.  Violated assumptions: "
-								+ fInvalidParameters);
-		}
-
-		public boolean nullsOk() {
-			return fMethod.getAnnotation(Theory.class).nullsAccepted();
-		}
-
-		public Method getMethod() {
-			return fMethod;
-		}
-
-		public void addAssumptionFailure(AssumptionViolatedException e) {
-			fInvalidParameters.add(e);
-		}
-	}
-
 	@Override
 	protected void validate() throws InitializationError {
 	}


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/