title: How to write Resource Test in Dropwizard?
body: <p>My test is currently failing. This is the first time I am writing a test in dropwizard. The code works fine but test does not. Here is what the service looks like.</p>
  <pre><code>public BaseResponse&lt;Object&gt; updateStaffProfile(String id, StaffUpdateDTO staffUpdateDTO) throws RecordNotFoundException{
  //        UserProfile user = getSingleUser(id);
          List&lt;Role&gt; roles = new ArrayList&lt;&gt;();
          if (Objects.nonNull(staffUpdateDTO.getRoleIds()) &amp;&amp; (!staffUpdateDTO.getRoleIds().isEmpty())){
  
              for (String roleId: staffUpdateDTO.getRoleIds()) {
                  Role role = roleService.getById(roleId);
                  roles.add(role);
              }
              staffUpdateDTO.setRoles(roles);
              staffUpdateDTO.setRoleIds(null);
          }
  
          ObjectMapper mapper = new ObjectMapper();
  
          // remove null field
          mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
          Map&lt;String, Object&gt; map =
                  mapper.convertValue(staffUpdateDTO, new TypeReference&lt;Map&lt;String, Object&gt;&gt;() {
                  });
          UserProfile updatedProfile = userProfileRepository.update(id, map);
          return BaseResponse.builder().status(true).message(&quot;success&quot;).data(updatedProfile).build();
      }
  </code></pre>
  <p>This is the resource code here</p>
  <pre><code>@PATCH
  @Path(&quot;staff/{id}&quot;)
  @Timed
  @PermitAll
  public Response updateStaff(@PathParam(&quot;id&quot;)
                              @NotNull final String id, @Valid StaffUpdateDTO staffUpdateDTO) throws Exception{
      return Response.status(Response.Status.OK).entity(
              userProfileService.updateStaffProfile(id, staffUpdateDTO)
      ).build();
  }
  </code></pre>
  <p>and here is the resource that keeps failing. Help with this will help me understand better how to write more tests</p>
  <pre><code>@Test
  void editStaffProfileSuccessfully() throws DuplicateRecordException, Exception{
      when(userProfileService.updateStaffProfile(userProfile.getId(), staffUpdateDTO));
  
      final Response response = EXT.target(&quot;api/v1/users/staff&quot; + userProfile.getId()).request()
              .put(Entity.json(staffUpdateDTO));
      assertThat(response.getStatusInfo().getStatusCode()).isEqualTo(HttpStatus.OK_200);
  }
  </code></pre>