JUnit追踪:
java.lang.NoClassDefFoundError: com.sample.Functions$Floor
at com.sample.test.FunctionsTest.testValidateLocation(FunctionsTest.java:289)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:430)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)
这是我的测试代码:
public class FunctionsTest extends TestCase {
public void testValidateLocation() {
location.setLatitude(-90);
location.setLongitude(-180);
assertTrue(Functions.Location.validateLocation(location));
}
}
这是目标方法:
public static boolean validateLocation(android.location.Location location) {
return location==null?false:Double.compare(location.getLatitude(), MAXIMUM_LATITUDE) <= 0
&& Double.compare(location.getLatitude(), MINIMUM_LATITUDE) >= 0
&& Double.compare(location.getLongitude(), MAXIMUM_LONGITUDE) <= 0
&& Double.compare(location.getLongitude(), MINIMUM_LONGITUDE) >= 0;
}