Java Codepro Analytix-JUnit-ClassNotFoundException
我正在尝试使用Java Codepro Analytix-JUnit-ClassNotFoundException,java,junit,codepro,Java,Junit,Codepro,我正在尝试使用rad7.5中的codeproanalytixv7.1生成JUnit测试用例 即使是一个简单的源代码,我也会得到ClassNotFoundException 源代码: package com.tmp; public class General { public int getPriceRate(){ Calculation calc = new CalculationImpl(); return calc.getPrice(20); } }
rad7.5
中的codeproanalytixv7.1
生成JUnit测试用例即使是一个简单的源代码,我也会得到
ClassNotFoundException
源代码:
package com.tmp;
public class General {
public int getPriceRate(){
Calculation calc = new CalculationImpl();
return calc.getPrice(20);
}
}
package com.tmp;
import org.junit.*;
import static org.junit.Assert.*;
/**
* The class <code>GeneralTest</code> contains tests for the class <code>{@link General}</code>.
*
* @generatedBy CodePro at 3/8/12 5:10 AM
*/
public class GeneralTest {
/**
* Run the int getPriceRate() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 3/8/12 5:10 AM
*/
@Test
public void testGetPriceRate_1()
throws Exception {
General fixture = new General();
int result = fixture.getPriceRate();
// add additional test code here
// An unexpected exception was thrown in user code while executing this test:
// java.lang.ClassNotFoundException: com.tmp.General
// at java.net.URLClassLoader.findClass(Unknown Source)
// at java.lang.ClassLoader.loadClass(Unknown Source)
// at com.instantiations.assist.eclipse.junit.execution.core.UserDefinedClassLoader.loadClass(Unknown Source)
// at java.lang.ClassLoader.loadClass(Unknown Source)
// at com.instantiations.assist.eclipse.junit.execution.core.ExecutionContextImpl.getClass(Unknown Source)
// at com.instantiations.eclipse.analysis.expression.model.SimpleTypeExpression.execute(Unknown Source)
// at com.instantiations.eclipse.analysis.expression.model.MethodInvocationExpression.execute(Unknown Source)
// at com.instantiations.assist.eclipse.junit.execution.core.ExecutionRequest.execute(Unknown Source)
// at com.instantiations.assist.eclipse.junit.execution.communication.LocalExecutionClient$1.run(Unknown Source)
// at java.lang.Thread.run(Unknown Source)
assertEquals(0, result);
}
}
生成的测试代码:
package com.tmp;
public class General {
public int getPriceRate(){
Calculation calc = new CalculationImpl();
return calc.getPrice(20);
}
}
package com.tmp;
import org.junit.*;
import static org.junit.Assert.*;
/**
* The class <code>GeneralTest</code> contains tests for the class <code>{@link General}</code>.
*
* @generatedBy CodePro at 3/8/12 5:10 AM
*/
public class GeneralTest {
/**
* Run the int getPriceRate() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 3/8/12 5:10 AM
*/
@Test
public void testGetPriceRate_1()
throws Exception {
General fixture = new General();
int result = fixture.getPriceRate();
// add additional test code here
// An unexpected exception was thrown in user code while executing this test:
// java.lang.ClassNotFoundException: com.tmp.General
// at java.net.URLClassLoader.findClass(Unknown Source)
// at java.lang.ClassLoader.loadClass(Unknown Source)
// at com.instantiations.assist.eclipse.junit.execution.core.UserDefinedClassLoader.loadClass(Unknown Source)
// at java.lang.ClassLoader.loadClass(Unknown Source)
// at com.instantiations.assist.eclipse.junit.execution.core.ExecutionContextImpl.getClass(Unknown Source)
// at com.instantiations.eclipse.analysis.expression.model.SimpleTypeExpression.execute(Unknown Source)
// at com.instantiations.eclipse.analysis.expression.model.MethodInvocationExpression.execute(Unknown Source)
// at com.instantiations.assist.eclipse.junit.execution.core.ExecutionRequest.execute(Unknown Source)
// at com.instantiations.assist.eclipse.junit.execution.communication.LocalExecutionClient$1.run(Unknown Source)
// at java.lang.Thread.run(Unknown Source)
assertEquals(0, result);
}
}
您能帮我解决这个错误吗?我希望您的类文件尚未生成。。。尝试清理并运行测试用例。