Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Testing Exceptions Practice | Exceptions
Java JUnit Library. Types of Testing

bookTesting Exceptions Practice

I hope you remember how you wrote exception handling in this chapter. It's time to practice writing tests for these assertions.

Task

Your task is to cover two methods from the ExceptionHandlingExercise class with tests using assertThrows() and assertDoesNotThrow() assertions in the unit test class that I have created for you.

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 7

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Suggested prompts:

Can you explain what the checkAge and printLength methods do?

What are assertThrows() and assertDoesNotThrow() used for in unit testing?

Can you give an example of how to write a test using assertThrows()?

Awesome!

Completion rate improved to 4.55

bookTesting Exceptions Practice

Sveip for å vise menyen

I hope you remember how you wrote exception handling in this chapter. It's time to practice writing tests for these assertions.

Task

Your task is to cover two methods from the ExceptionHandlingExercise class with tests using assertThrows() and assertDoesNotThrow() assertions in the unit test class that I have created for you.

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 7
some-alt