title: Junit Test case for httpStatus.OK and httpStatus.Bad_Request
body: <p>How to test my service class which has <code>storeInDb()</code> method and is returning database model and <code>httpstatus.OK</code> and <code>httpstatus.Bad_Request</code> along with body.</p>
  <pre><code>public ResponseEntity storeInDb(ExeEntity model) {
      Validator validation = new Validator();
      Map objValidate = validation.validateInput(model.getLink(), model.getUsername(), model.getPassword(),
              model.getSolution(), model.getDomain());
      if (objValidate.containsKey(&quot;Success&quot;)) {
           return new ResponseEntity(model, HttpStatus.OK);
      }
      else if (objValidate.containsKey(&quot;Fail&quot;)) {
          if (objValidate.containsValue(&quot;Invalid Credentials&quot;)) {
              return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(&quot;Invalid Credentials&quot;);
      } }
      else {
          return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(&quot;Domain does not exist.&quot;);
      } 
  }
  </code></pre>
  <p>Please help me answering this question and writing test cases. Thanks in advance.</p>