beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Test Rotate String

Geoffrey Challen // 2020.10.0

Declare a method named testRotateString. testRotateString receives an instance of RotateString as a parameter, which has a single method rotate. rotate takes a String and an int as arguments, and rotates the passed string by the passed amount. If the amount is positive, the rotation is to the right; if negative, to the left. If the String is null, rotate should return null.

Your testRotateString method should test the passed implementation using assert. Here's an example to get you started:

As you create your test suite, consider the various kinds of mistakes that you might make when implementing rotate. Maybe getting the direction wrong, or using the modulus improperly? There are lots of ways to mess this up! You need to catch all of them. Good luck!