0

I am just starting my journey in the programming language of Java and I just cannot understand why I got these two errors, when I try to do a Junit test:

Access restriction: The method 'Assert.assertEquals(Object, Object)' is not API (restriction on required library 'C:\eclipse\plugins\org.junit_4.12.0.v201504281640\junit.jar') ConcateTest.java    /TestProject/src/test   line 13 Java Problem
Access restriction: The type 'Test' is not API (restriction on required library 'C:\eclipse\plugins\org.junit_4.12.0.v201504281640\junit.jar')  ConcateTest.java    /TestProject/src/test   line 5  Java Problem

If you wonder what I have written so far I just leave it here:

package test;

import static org.junit.Assert.*;

import org.junit.Test;

public class ConcateTest {


    public void testConcatenate() {
        Junit test = new Junit();
        String result= test.Concatenate("one","two");
        assertEquals("onetwo",result);
    }
}

And this is how my Junit class looks like: package test;

public class Junit {
    public String Concatenate(String one,String two)
    {
        return one+two;
    }

    public int Multiply(int number1,int number2)
    {
        return number1*number2;
    }
}

I would very much appreciate it if somebody would tell me how I can fix this problem, thanks in advance!

acm
  • 2,086
  • 3
  • 16
  • 34
UserMeli
  • 33
  • 1
  • 8
  • 2
    Possible duplicate of [Access restriction: The type 'Application' is not API (restriction on required library rt.jar)](http://stackoverflow.com/questions/25222811/access-restriction-the-type-application-is-not-api-restriction-on-required-l) – Dave Cousineau Oct 21 '16 at 15:50
  • Check this out: http://stackoverflow.com/questions/25222811/access-restriction-the-type-application-is-not-api-restriction-on-required-l – Shreyas Sarvothama Oct 21 '16 at 15:52
  • This other question might have what you need [JUnit Java](http://stackoverflow.com/questions/8751553/how-to-write-a-unit-test) – user7054251 Oct 21 '16 at 16:46

0 Answers0