Skip to content

Chapter Ten Lab

jrupiper edited this page Jul 7, 2017 · 1 revision

Pork & Beans 2

In the previous labs, we created a set of controller methods following best practices and strong TDD paradigms. We will now add an easter egg to the HeartbeatController /upper method and add the ability to serve a file from the controller. These two labs are standalone and are not required for any additional functionality.

Instructions

Lab 1

  1. Add an "easter egg" to the upper method of Heartbeat controller where the application responds with a 418 (I_AM_A_TEAPOT) status when given "teapot" as the message.
  • Create a new test within HeartbeatControllerTest called upperTeapot that verifies the correct status is returned for "teapot" - we need to test our easter egg after all...
  • Be sure to test that the status is returned correctly via Postman or another POST utility.

Lab 2

In this lab you will add a new method to HeartbeatController that serves a file to a client (you choose the file, can be an image, text file, etc).

  1. Add a GET method named whatever you like that serves a file of your choosing in the HeartbeatController.
  • For example, a getPokemonNames method could return a text file with a list of pokemon names (this wouldn't be dynamic) or a getPokemonLogo method could return an image with the pokemon logo.
  • There are lots of ways to do this lab... use google to help you find at least one example
  1. (Extra Credit) Add a test to HeartbeatControllerTest to test the method.

Clone this wiki locally