**Description**
Access restriction: The type Test is not accessible due to restriction on required library
**Resource**
/Applications/Eclipse Java/plugins/org.junit_4.11.0.v201303080030/junit.jar
**Path**
AdditionTest2.java
**Location**
/Practice/src/testing line 5
**Type**
Java Problem
I've seen the answers to these other SO threads:
Access restriction on class due to restriction on required library
Access restriction on class due to restriction on required library rt.jar?
and I've applied the fix - Build Path --> Remove System Library --> Add it back in, and it works. However, I still have two problems:
1.Why is the code still highlighted in red?
Btw, the code is as follows
package testing;
import static org.junit.Assert.*;
import org.junit.Test;
public class AdditionTest2 {
// @Test is underlined red
@Test
public void testAddition() {
Addition add = new Addition();
int[] numbers = {1, 2};
// this line is underlined red
assertEquals("1 + 2 must be 3", 3, Addition.add(numbers));
}
}
2.What caused this error? Again, I've read the two threads, but I still don't understand it.
Thanks!
Baggio
EDIT: Actually, I stand corrected - it DOESN'T work. I'm not too familiar with testing in eclipse, but under the JUnit tab, nothing happens.
EDIT 2: Build Path image if that helps any
EDIT 3: Build Path image for JUnit 3 and JUnit 4
EDIT 4 + Solution: Actually, the testing code with JUnit 4 doesn't run at all - when I click Run --> Run As it didn't run - I tried to remove JUnit 3 from the Build Path, and it works now! Except now I have the other problem of not knowing why the test failed, but that's another problem.