Kotlinlearncs.online LogoJava
Return to List

Test Writing: Mystery Class 1

Created By: Geoffrey Challen
/ Version: 2020.10.0

Ready for another reverse engineering challenge! This one is tough, so good luck! I'll provide a few hints:

  • The class maintains two Int values
  • One is set by the constructor
  • Two methods manipulate the other
  • The third method's return is based on a relationship between the two values

Have fun!

Test Design Challenge

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

  • Provide a public class named TestMystery with a single non-private class 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 Kotlin's assert or check methods