I used to only have a default package to do my coursework. Now I am currently learning JUnit testing, so I created another package called test
. However, I was unable to access a public class called QuickSort
in another package.
Below is the structure of the project and the line of the code where the problem occurred
Code:
package test;
import org.junit.Test;
import org.junit.Assert;
public class TestQuickSort {
int[] numbers = new int[] { 1, 5, 3, 6, 7, 84, 2, 4, 3 };
int[] expectedNumbers = new int[] { 1, 2, 3, 3, 4, 5, 6, 7, 84 };
@Test
public void test() {
QuickSort qs = new QuickSort(numbers);
Assert.assertEquals(expectedNumbers, qs.sort());
}
}