Question: Suppose you were about to write a method called encrypt(), that will take a string as a parameter and return an encrypted version of the

 Suppose you were about to write a method called encrypt(), that

will take a string as a parameter and return an "encrypted" version

Suppose you were about to write a method called encrypt(), that will take a string as a parameter and return an "encrypted" version of the string. The encrypted string is achieved in two steps: First, the last four letters of the original string are moved to the front (If there are less than five letters, this step is skipped). Then, the back half of the resulting string is reversed. If the string is odd, the middle letter is included in the reversed back half. Before we write the code, however, we want to create a set of tests that will thoroughly exercise this method. One test case might be: assertEquals("DDEIHN", enerypt( "HIDDEN" ) ); Select all of the additional test cases (that is, assume that the above example is already included), if any, you would also need to write in order to check the behavior of encrypt(). You may find it helpful to write out the code or psuedocode you would use to implement the encrypt method, and imagine the different scenarios that could occur with it. Check that encrypt(null) behaves properly Check that encrypt("") returns Check that encrypt ( "DOG") returns "DGO" Check that encrypt ("HAPPY") returns "APHYP" Check that encrypt ( "VIRGINIA") returns "INIAGRIV" Check that encrypt ( "BOWL") returns "BOLW" Check that encrypt ("A") returns "A

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!