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());
}
}
Aucun commentaire:
Enregistrer un commentaire