test won't run, compilation has ended

65 Views Asked by At

I am running a test file for a code we had to run but it won't run the test. It says can't run compilation has ended. I've searched endlessly and can't seem to find the issue. Everything is written the way it should be. Hope you guys can assist me, much appreciated. The error I am receiving is:

ScoreDiceTest.java:7: error: scoreWithNumbers(int,int) has private access in ScoreDice

The test I ran is:

public class ScoreDiceTest{
@Test
`public void testBoth6(){
assertEquals(10, ScoreDice.scoreWithNumbers(6,6));
}

enter image description here

1

There are 1 best solutions below

0
On

I guess that scoreWithNumbers(int,int) method has a private access modifier and it cannot be called outside, so you need to change its access modifier from private to public or protected according to where you put your tests.

By the way, this is going to be my first answer on StackOverflow, hopefully, I understood the question correctly.