I'm trying to test if an exception with a customized message is thrown when a division by zero is attempted.
Here's the method:
public static int getMultiplesOfGivenNumber(int number, int[] array){
    int multiples = 0;
    if (number == 0) {
        throw new ArithmeticException("Number cannot be zero");
    }else{
        for (int i = 0; i < array.length; i++) {
            if (array[i] % number == 0) {
                multiples += 1;
            }
        }
    }
After searching some solutions, I found this as a way to do the thing, but my IDE can't recognize 'expected' ...
@Test(expected=java.lang.ArithmeticException.class)
public void testDivideByZero(){
    //arrange
    int number = 0;
    //act
    int result = B3_E2.getMultiplesOfGivenNumber(number, intervalFromOneToTen());
    //assert
    assertEquals(expected, result);
}
I'm just unaware why my IDE is not recognizing 'expected'. Don't know if this has something to do with Junit version, or if there's some issue with the syntax I'm using.
In every other tests I used so far I never put nothing after @Test. I just found out this solution in another thread for a similar problem.
 
    