Kotlinlearncs.online LogoJava
Return to List

Test Writing: Deadly Animal Ranking

Created By: Geoffrey Challen
/ Version: 2026.2.0

Australia is famous for its dangerous wildlife! Create a method called dangerRating that accepts a String with the name of an Australian animal and returns a String describing how dangerous it is.

Use the following ratings:

  • "box jellyfish""Deadly"
  • "inland taipan""Deadly"
  • "blue-ringed octopus""Deadly"
  • "saltwater crocodile""Very dangerous"
  • "funnel-web spider""Very dangerous"
  • "kangaroo""Caution"
  • "emu""Caution"
  • "platypus""Surprisingly venomous"
  • "koala""Mostly harmless"
  • For any other animal, return "Unknown"

Test Design Challenge

You're challenge is to write tests for this problem described above.

  • Provide a method named test that accepts no arguments and does not return a value.
  • If the implementation of the class described above is incorrect, your test method should throw an exception.
  • If it is correct, do not throw an exception.
  • You may want to use Java's assert method

Related Lessons

Stuck? You may find these lessons helpful:

Report a Problem

Attribution must link to this page: https://www.learncs.online/testtesting/java/deadly-animal-ranking/[email protected]