Author: lfryc(a)redhat.com
Date: 2010-07-28 09:39:25 -0400 (Wed, 28 Jul 2010)
New Revision: 18255
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
Log:
support for not parametrized test classes
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2010-07-28
13:38:50 UTC (rev 18254)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2010-07-28
13:39:25 UTC (rev 18255)
@@ -56,7 +56,7 @@
import org.testng.annotations.ITestAnnotation;
/**
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @author <a href="mailto:ppitonak@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
public class MatrixConfigurator implements IAnnotationTransformer,
IInvokedMethodListener, IMethodInterceptor {
@@ -94,14 +94,12 @@
private void configureMethod(ITestResult testResult) {
Method realMethod = ((Queue<Method>) methods).poll();
- Class<?> realClass;
- try {
- realClass = realMethod.getDeclaringClass();
- } catch (NullPointerException e) {
- System.out.println(e);
+ Class<?> realClass = realMethod.getDeclaringClass();
+
+ if (!configurations.get(realClass).get(realMethod).hasNext()) {
return;
}
-
+
final Object testInstance = testResult.getInstance();
Map<NamedType, Object> configuration =
configurations.get(realClass).get(realMethod).next();
@@ -147,22 +145,8 @@
annotation.setInvocationCount(invocationCount);
}
- // public List<IMethodInstance> intercept(List<IMethodInstance> methods,
ITestContext context) {
- // for (IMethodInstance methodInstance : methods) {
- // int count = createConfiguration(methodInstance);
- // for (int i = 0; i < count; i++) {
- // methodInstances.add(methodInstance);
- // }
- // }
- //
- // return methodInstances;
- // }
-
public int createConfiguration(Class<?> realClass, Method realMethod) {
- // Class<?> realClass = method.getRealClass();
- // String methodName = method.getName();
-
Map<NamedType, List<? extends Object>> parameters = new
LinkedHashMap<NamedType, List<? extends Object>>();
List<NamedType> unsatisfied = new LinkedList<NamedType>();
@@ -181,13 +165,6 @@
}
}
- // get a injections from method level
- // Method realMethod;
- // try {
- // realMethod = realClass.getMethod(methodName);
- // } catch (Exception e) {
- // throw new IllegalStateException(e);
- // }
for (Annotation annotation : realMethod.getAnnotations()) {
if (annotation.annotationType() == Use.class) {
Use use = (Use) annotation;
@@ -215,7 +192,7 @@
getClassConfigurations(realClass).put(realMethod, configuration);
- return count;
+ return Math.max(1, count);
}
private Map<Method, Configuration> getClassConfigurations(Class<?>
realClass) {
@@ -307,7 +284,7 @@
}
public boolean hasNext() {
- return !lastQueue.isEmpty();
+ return !parameters.isEmpty() && !lastQueue.isEmpty();
}
public void remove() {
Show replies by date