Ich habe versucht, eine Ausnahmeklasse zu schreiben, und hier ist mein Code:Warum ruft die JUnit "Objekt" und nicht "Ausnahme"?
public class DealWithMeException {
public DealWithMeException(String message){
message="To make a class a checked exception it needs be a subclass of the appropriate Java class";
}
}
Wenn ich meine JUnit Test ausführen, immer der Fehler kommt und sagt „Aufruf Java.long.object statt Java.long .exceptions“
und hier ist meine JUnit-Testcode:
public class ExceptionsTest {
@Test
public final void testCheckedException() {
Class<DealWithMeException> cut = DealWithMeException.class;
assertEquals("To make a class a checked exception it needs be a subclass of the appropriate Java class",
Exception.class, cut.getSuperclass());
}
}
Was ist passiert?
Vielen Dank! – Yang