JoyOfCoding icon indicating copy to clipboard operation
JoyOfCoding copied to clipboard

Small improvements to the REST project

Open DavidWhitlock opened this issue 2 years ago • 2 comments

REST project mockito tests should reference constants for parameter names

In the unit tests for the projects servlets, the name of the parameter ("word") is used.

https://github.com/DavidWhitlock/PortlandStateJava/blob/770136581e8fcd84662bf5549defe3890beddce9/projects-parent/originals-parent/phonebill-web/src/test/java/edu/pdx/cs410J/phonebillweb/PhoneBillServletTest.java#L49

We should reference the constant in the Servlet class instead: WORD_PARAMETER.

DavidWhitlock avatar Jul 15 '22 02:07 DavidWhitlock

Also, based on https://github.com/DavidWhitlock/PortlandStateJavaSummer2022/commit/c438e5a7fd5081cdd6eab04f580408b46400563c, I should do the following:

  • In Project4IT, assert that nothing is written to standard error when invoking the main method successfully
    • This replaces the assertion that the exit code was zero
  • Call throwExceptionIfNotOkayHttpStatus() in the getAllDictionaryEntries()
    • Or maybe I should move throwExceptionIfNotOkayHttpStatus() to the get(), etc. methods of HttpRequestHelper
  • Make the output of the PrettyPrinter distinct from the TextDumper
  • When printing the exception in the error() method in Project4, call ex.getMessage()
  • Remove the checkResponseCode() method from Project4

DavidWhitlock avatar Jul 22 '22 03:07 DavidWhitlock

Also, in the REST project assignment the description of the -search option isn't strictly correct:

If the -search option is provided, only the customer, begin and end are required

It is valid to only have the customer name with -search

DavidWhitlock avatar Jul 22 '22 03:07 DavidWhitlock