vendredi 11 septembre 2020

Test cannot be resolved to a type error on JUnit Jupiter and Java SE-11

I'm trying to test the constructor of a PhD class, but on the line where I type @Test, it gives an error that says, "Test cannot be resolved to a type". What does this mean and how do I fix it?

    //PhD.java
    
        package a1;
    
    public class PhD {
        private String name;

        PhD(String n, int m, int y) {
            assert !(n.length() >= 1);
            name = n;
        }
    
        public String name() {
            return name;
        }
    }
//PhDTest.java
package a1;

import static org.junit.jupiter.api.Assertions.assertEquals;

class PhDTest {

    @Test
    void testConstructor1() {
        PhD person1 = new PhD("My Name", 6, 2030);
        assertEquals("My Name", person1.name());
    }

}

enter image description here

Aucun commentaire:

Enregistrer un commentaire