Eclipse – debugger doesn’t stop at breakpoint
Fix could be as simple as clicking run/skip all breakpoints. Worked for me.
Fix could be as simple as clicking run/skip all breakpoints. Worked for me.
You could use a pattern as well, for example mvn ‘-Dtest=de.mypackage.*Test’ test runs all tests in classes from package de.mypackage ending on *Test. [update 2017/12/18]: Since this became the accepted answer, here’s some further information: Maven uses the Maven Surefire plugin to execute tests. The syntax used above (qualified package name) requires Surefire version 2.19.1 … Read more
In Maven you can configure the surefire plugin <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.9</version> <configuration> <argLine>-Xmx256M</argLine> </configuration> </plugin> If you use Maven for builds then this configuration will be carried in the source tree and applied when tests are carried out. See the Maven Surefire Plugin documentation.
import org.junit.runners.Suite; import org.junit.runner.RunWith; @RunWith(Suite.class) @Suite.SuiteClasses({TestClass1.class, TestClass2.class}) public class TestSuite { //nothing }
To create a test case template: “New” -> “JUnit Test Case” -> Select “Class under test” -> Select “Available methods“. I think the wizard is quite easy for you.
This worked out for me. I’m only using JUnit and I was able to mock up the Log class without any third party lib very easy. Just create a file Log.java inside app/src/test/java/android/util with contents: package android.util; public class Log { public static int d(String tag, String msg) { System.out.println(“DEBUG: ” + tag + “: … Read more
The interesting thing about assertAll is that it always checks all of the assertions that are passed to it, no matter how many fail. If all pass, all is fine – if at least one fails you get a detailed result of all that went wrong (and right for that matter). It is best used … Read more
The method assertEquals(Object, Object) is ambiguous for the type … What this error means is that you’re passing a double and and Double into a method that has two different signatures: assertEquals(Object, Object) and assertEquals(double, double) both of which could be called, thanks to autoboxing. To avoid the ambiguity, make sure that you either call … Read more
You can make a custom, barebones JUnit runner fairly easily. Here’s one that will run a single test method in the form com.package.TestClass#methodName: import org.junit.runner.JUnitCore; import org.junit.runner.Request; import org.junit.runner.Result; public class SingleJUnitTestRunner { public static void main(String… args) throws ClassNotFoundException { String[] classAndMethod = args[0].split(“#”); Request request = Request.method(Class.forName(classAndMethod[0]), classAndMethod[1]); Result result = new JUnitCore().run(request); … Read more
Epsilon is your “fuzz factor,” since doubles may not be exactly equal. Epsilon lets you describe how close they have to be. If you were expecting 3.14159 but would take anywhere from 3.14059 to 3.14259 (that is, within 0.001), then you should write something like double myPi = 22.0d / 7.0d; //Don’t use this in … Read more