title: How to Unit Test Cache Control header using JUnit?
body: <p>I just created a CacheControl to use on the response from REST services, it is a ResponseBuilder which takes a ResponseBuilder as parameter on which i set the no cache options. The code is shown below.</p>
  
  <pre><code>        /**
   * Cacheless method to control the Cache Header in REST responses.
   * @param builder the response builder
   * @return Cache Control Header for REST Responses
   */
  private ResponseBuilder setCacheControlHeader(final ResponseBuilder builder) {
      CacheControl control = new CacheControl();
      control.setNoCache(true);
      control.setNoStore(true);
      control.setMaxAge(0);
      control.setPrivate(true);
      control.setMustRevalidate(true);
      control.setNoTransform(true);
      builder.cacheControl(control);
      builder.header("Pragma", "no-cache");
      builder.header("Expires", 0);
  
      return builder;
  }
  </code></pre>
  
  <p>As I am just working on on the methods I am using PostMan to test the headers which seems to be fine. 
  Now I am trying to create a JUnit test to test if the Response builder passed on to the method is getting assigned the parameters on the method such as "noCache, "noStore" and "expires".</p>
  
  <p>I would need to test it for each of my RestServices which is using this method.
  Can someone suggest how to test it?  </p>
  
  <p>Regards</p>