Homework 23: Programmatic Tests

Submit this homework using Gradescope. You can type up your answers, or write legibly and scan them. Do not attempt to submit a paper copy in class, as it will not be accepted.


Write JUnit-style test methods for each of the following (one method per test, please) (1 point each):

  • Collections.rotate correctly rotates an ArrayList with a distance of zero
  • Collections.rotate correctly rotates an ArrayList with a distance of one
  • ArrayList.subList can correctly return a sublist containing just the last element of the list

The ArrayList instance you use in your tests should be an ascending list of the first thousand even Integers, starting from 0.