Edit 3
I installed a new version of eclipse (Mars - 4.5.0), and everything works. However, when I reinstall Scala via the Eclipse Marketplace, the issue reappeared. So perhaps it's something with the scala plugin?
EDIT 2
I was playing around with it more and found that if I delete certain packages, the functionality returns. Specifically, if I delete packages functional and io
, the ability to run the whole project's testing returns. Renaming the packages does not help, only deleting them. Furthermore, if I add JUnit tests in those packages, I am still unable to run that test via the package explorer by running the whole package.
I'm having an issue with a particular Java project in Eclipse. When I attempt to run all JUnit tests from the project explorer (via [right click on project folder] --> run as --> JUnit Test
), I get the error message a lot of people seem to be seeing:
Problem Launching JUnit Tests: No tests found with test runner 'JUnit 4'
Clicking OK on the message brings up the Run configurations dialogue.
What's strange is that the problem seems very isolated to this project at full project scope. I am able to do the following without trouble:
- Run any single test within this project by opening it and clicking the green run button at top.
- Run any single test within this project by right clicking on the class within the project explorer and selecting run as JUnit Test
- Run all tests within any package within this project by the same method.
- Run all tests within any other project by the same method.
I've tried the standard stuff mentioned in similar posts, nothing seems to work. Specifically, I've tried:
- Restarting eclipse
- Restarting my computer
- Cleaning and rebuilding the project
- Deleting the project and recloning from git, then re-adding to eclipse
- Adding the @RunWith annotation to my test cases
- Making sure all of my test cases start with "test"
- Using JUnit3 instead
- Deleting all JUnit run configurations and recreating this run configuration
Additionally, I distinctly remember this functionality working a little while ago for this project, but don't remember exactly when. So I must have added/changed/deleted something that has caused the error to appear.
EDIT @ Durron597's suggestions: None of the suggestions worked, unfortunately. I also tried deleting every JUnit run configuration and trying the create configuration process again, still no luck.
My eclipse version is: Luna Service Release 2 (4.4.2)
My JUnit version is: 4.11
Here's the code from one test:
package common;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.HashSet;
import org.junit.Test;
public class UtilTest {
@Test
public void testWrappers(){
short[] s = {1,2,3,4};
Short[] s2 = Util.boxArr(s);
short[] s3 = Util.unboxArr(s2);
assertEquals(s.length, s2.length);
assertEquals(s.length, s3.length);
for(int i = 0; i < s.length; i++){
assertEquals(s[i], s2[i].shortValue());
assertEquals(s[i], s3[i]);
}
int[] i = {1,2,3,4, Integer.MAX_VALUE, Integer.MIN_VALUE};
Integer[] i2 = Util.boxArr(i);
int[] i3 = Util.unboxArr(i2);
assertEquals(i.length, i2.length);
assertEquals(i.length, i3.length);
for(int x = 0; x < s.length; x++){
assertEquals(i[x], i2[x].intValue());
assertEquals(i[x], i3[x]);
}
long[] l = {1,2,3,4, Integer.MAX_VALUE, Integer.MIN_VALUE, Long.MAX_VALUE, Long.MIN_VALUE};
Long[] l2 = Util.boxArr(l);
long[] l3 = Util.unboxArr(l2);
assertEquals(l.length, l2.length);
assertEquals(l.length, l3.length);
for(int x = 0; x < s.length; x++){
assertEquals(l[x], l2[x].longValue());
assertEquals(l[x], l3[x]);
}
float[] f = {1,2,3,4, 0.4f, 0.1f, Float.MAX_VALUE, Float.MIN_NORMAL};
Float[] f2 = Util.boxArr(f);
float[] f3 = Util.unboxArr(f2);
assertEquals(f.length, f2.length);
assertEquals(f.length, f3.length);
for(int x = 0; x < s.length; x++){
assertEquals(f[x], f2[x].floatValue(), 0.00001);
assertEquals(f[x], f3[x], 0.00001);
}
double[] d = {1,2,3,4, 0.4, 0.1, Float.MAX_VALUE, Float.MIN_VALUE, Double.MAX_VALUE, Double.MIN_NORMAL};
Double[] d2 = Util.boxArr(d);
double[] d3 = Util.unboxArr(d2);
assertEquals(d.length, d2.length);
assertEquals(d.length, d3.length);
for(int x = 0; x < s.length; x++){
assertEquals(d[x], d2[x].doubleValue(), 0.00001);
assertEquals(d[x], d3[x], 0.00001);
}
char[] c = {1,2,3,4, 'a', 'b', '.', Character.MAX_VALUE, Character.MIN_VALUE};
Character[] c2 = Util.boxArr(c);
char[] c3 = Util.unboxArr(c2);
assertEquals(c.length, c2.length);
assertEquals(c.length, c3.length);
for(int x = 0; x < s.length; x++){
assertEquals(c[x], c2[x].charValue());
assertEquals(c[x], c3[x]);
}
}
@Test
public void testRandElement(){
assertTrue(null==Util.randomElement(null));
HashSet<Integer> s = new HashSet<>();
assertTrue(null==Util.randomElement(s));
for(int i = 0; i < 10; i++){
s.add(i);
}
HashSet<Integer> s2 = new HashSet<>();
while(! s2.equals(s)){
Integer i = Util.randomElement(s);
s2.add(i);
assertTrue(s.contains(i));
}
}
@Test
public void testPermute(){
ArrayList<Integer[]> a = Util.permute(new Integer[]{1,2,3,4});
assertEquals(a.size(), 24);
for(Integer[] i : a){
assertEquals(i.length, 4);
assertEquals(10, i[0] + i[1] + i[2] + i[3]);
}
HashSet<Integer[]> s = new HashSet<>(a);
assertEquals(s.size(), 24);
a = Util.permute(new Integer[]{});
assertEquals(a.size(), 1);
}
}
The whole project is at https://github.com/Mshnik/UsefulThings if that helps as well.