FeatureResourceImpl implements FeatureResource { @Override @Path("/{idFeature}") @PUT @ValidationRequired(processor = RestViolationProcessor.class) @ApiOperation(value = "Update a feature", httpMethod="PUT", response=FeatureDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Feature was updated", response=FeatureDTO.class), @ApiResponse(code = 400, message = "Latitude range out of index"), @ApiResponse(code = 400, message = "Longitude range out of index"), @ApiResponse(code = 400, message = "Geometry is invalid"), @ApiResponse(code = 400, message = "Mongo GeoJSON format is not correct"), @ApiResponse(code = 400, message = "Invalid input parameter (header)"), @ApiResponse(code = 404, message = "Feature was not found")}) public Response updateFeature(@Auth BasicAuth principal, @ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, @ApiParam(required=true, value="Feature identifier") @NotBlank @NotNull @PathParam("idFeature") String idFeature, @ApiParam(required=true, value="Updated feature") @Valid @NotNull FeatureDTO featureDTO) throws AssemblyException, FeatureNotExistException, MongoGeospatialException { validations.checkIsNotNullAndNotBlank(appIdentifier,idFeature); validations.checkIsNotNull(featureDTO); Feature featureUpdate = featureManager.updateFeature(appIdentifier, idFeature, featureAssembler.createDomainObject(featureDTO)); FeatureDTO featureUpdateDTO=featureAssembler.createDataTransferObject(featureUpdate); return Response.ok(featureUpdateDTO).build(); }  @Override @POST @ValidationRequired(processor = RestViolationProcessor.class) @ApiOperation(value = "Store a feature", httpMethod="POST", response=FeatureDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Feature was stored", response=FeatureDTO.class), @ApiResponse(code = 400, message = "Latitude range out of index"), @ApiResponse(code = 400, message = "Longitude range out of index"), @ApiResponse(code = 400, message = "Geometry is invalid"), @ApiResponse(code = 400, message = "Mongo GeoJSON format is not correct"), @ApiResponse(code = 400, message = "Invalid input parameter (header)")}) Response storeFeature(@Auth BasicAuth principal,
			@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier,
			@ApiParam(required=true, value="Feature") @Valid @NotNull FeatureDTO featureDTO); @Override @Path("/{idFeature}") @DELETE @ValidationRequired(processor = RestViolationProcessor.class) @ApiOperation(value = "Delete a feature", httpMethod="DELETE") @ApiResponses(value = { @ApiResponse(code = 204, message = "Feature was deleted"), @ApiResponse(code = 400, message = "Invalid input parameter (header)"), @ApiResponse(code = 404, message = "Feature was not found")}) Response deleteFeature(@Auth BasicAuth principal,
			@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, 
			@ApiParam(required=true, value="Feature identifier") @NotBlank @NotNull @PathParam("idFeature") String idFeature); @Override @Path("/{idFeature}") @PUT @ValidationRequired(processor = RestViolationProcessor.class) @ApiOperation(value = "Update a feature", httpMethod="PUT", response=FeatureDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Feature was updated", response=FeatureDTO.class), @ApiResponse(code = 400, message = "Latitude range out of index"), @ApiResponse(code = 400, message = "Longitude range out of index"), @ApiResponse(code = 400, message = "Geometry is invalid"), @ApiResponse(code = 400, message = "Mongo GeoJSON format is not correct"), @ApiResponse(code = 400, message = "Invalid input parameter (header)"), @ApiResponse(code = 404, message = "Feature was not found")}) Response updateFeature(@Auth BasicAuth principal,
			@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, 
			@ApiParam(required=true, value="Feature identifier") @NotBlank @NotNull @PathParam("idFeature") String idFeature, 
			@ApiParam(required=true, value="Updated feature") @Valid @NotNull FeatureDTO featureDTO); @Override @Path("/{idFeature}") @GET @ValidationRequired(processor = RestViolationProcessor.class) @ApiOperation(value = "Get a feature by id", httpMethod="GET", response=FeatureDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Feature was found", response=FeatureDTO.class), @ApiResponse(code = 400, message = "Invalid input parameter (header)"), @ApiResponse(code = 404, message = "Feature was not found")}) Response getFeatureByID(@Auth BasicAuth principal,
			@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, 
			@ApiParam(required=true, value="Feature identifier") @NotBlank @NotNull @PathParam("idFeature") String idFeature);  }
@Test public void updateFeature() throws AssemblyException, FeatureNotExistException, MongoGeospatialException{ String idFeature = "1"; Mockito.when(featureAssembler.createDomainObject(featureDTO)).thenReturn(feature); Mockito.when(featureManagerImpl.updateFeature(APP_IDENTIFIER,idFeature, feature)).thenReturn(featureReturn); Mockito.when(featureAssembler.createDataTransferObject(featureReturn)).thenReturn(featureDTOReturn); Response response=featureResourceImpl.updateFeature(principal, APP_IDENTIFIER, idFeature, featureDTO); Mockito.verify(validations).checkIsNotNullAndNotBlank(APP_IDENTIFIER,ID_FEATURE); Mockito.verify(validations).checkIsNotNull(featureDTO); Mockito.verify(featureManagerImpl).updateFeature(APP_IDENTIFIER,idFeature,feature); assertNotNull(response.getEntity()); assertEquals("FeatureDTO is not the expected", featureDTOReturn, (FeatureDTO) response.getEntity()); assertEquals("The Status response is not the expected", 200, response.getStatus()); }