提交 9b179c48 编写于 作者: B Brian Showers

[ACT-1844] ActivitiRule fails if test methods are declared in a super class

上级 088280bc
......@@ -85,7 +85,7 @@ public abstract class TestHelper {
String deploymentId = null;
Method method = null;
try {
method = testClass.getDeclaredMethod(methodName, (Class<?>[])null);
method = testClass.getMethod(methodName, (Class<?>[]) null);
} catch (Exception e) {
log.warn("Could not get method by reflection. This could happen if you are using @Parameters in combination with annotations.", e);
return null;
......@@ -130,7 +130,7 @@ public abstract class TestHelper {
// Get method
Method method = null;
try {
method = testClass.getDeclaredMethod(methodName, (Class<?>[])null);
method = testClass.getMethod(methodName, (Class<?>[]) null);
} catch (Exception e) {
log.warn("Could not get method by reflection. This could happen if you are using @Parameters in combination with annotations.", e);
return;
......
package org.activiti.standalone.testing;
/**
* This test is explicitly empty.
*
* The purpose of this test is to make sure that ActivitiRule works with tests methods
* that are defined in a parent class.
*
* When running the test suite over this class, JUnit will execute the test from
* {@link ActivitiRuleJunit4Test}. This means that the code in
* {@link org.activiti.engine.impl.test.TestHelper} needs to be able to find the
* test method even when it's not declared on the test class itself.
*
* Specifically, {@link org.activiti.engine.impl.test.TestHelper} needs to call getMethod()
* rather than getDeclaredMethod() since the method is declared in a parent of the
* actual test class.
*/
public class ActivitiRuleJunit4SubclassTest extends ActivitiRuleJunit4Test {
}
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="ruleUsage">
<startEvent id="start" />
<sequenceFlow id="flow1" sourceRef="start" targetRef="theTask" />
<userTask id="theTask" name="My Task" />
<sequenceFlow id="flow2" sourceRef="theTask" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册