SearchResourceImpl implements SearchResource { @Override @Path("/room") @GET @ValidationRequired(processor = RestViolationProcessor.class) @ApiOperation(value = "Get room according to indoor location", httpMethod="GET",response=RoomDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Room belongs to location", response=RoomDTO.class), @ApiResponse(code = 400, message = "Invalid input parameter"), @ApiResponse(code = 404, message = "Room not found"), @ApiResponse(code = 500, message = "Problem in the system")}) public Response getRoomByLocation(@Auth BasicAuth principal, @ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, @ApiParam(value="Longitude of location", required=true) @Min(-180) @Max(180) @NotNull @QueryParam("longitude") Double longitude, @ApiParam(value="Latitude of location", required=true) @Min(-90) @Max(90) @NotNull @QueryParam("latitude") Double latitude, @ApiParam(value = "Floor of location", required = true) @NotNull @QueryParam("floor") Integer floor) throws AssemblyException, RoomNotFoundException{ validations.checkIsNotNullAndNotBlank(appIdentifier); validations.checkMin(-180.0, longitude); validations.checkMax(180.0, longitude); validations.checkMin(-90.0, latitude); validations.checkMax(90.0, latitude); validations.checkIsNotNull(floor); Feature room=searchManager.getRoomByLocation(appIdentifier, longitude, latitude, floor); RoomDTO roomDTO=roomAssembler.createDataTransferObject(room); return Response.ok(roomDTO).build(); }  @Override @POST @ValidationRequired(processor = RestViolationProcessor.class) @ApiOperation(value = "Get features according to query", httpMethod="POST", response=FeatureDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Features were found", response=FeatureDTO.class), @ApiResponse(code = 400, message = "Invalid input parameter (header)"), @ApiResponse(code = 400, message = "Query is not correct")}) Response getFeaturesByQuery(@Auth BasicAuth principal,
			@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, 
			@ApiParam(value = "Query", required = true) @NotBlank @NotNull String query, 
			@ApiParam(required=false,value="Layer",allowableValues="ALL,MAP,FEATURES",defaultValue="ALL") @QueryParam("layer") @DefaultValue("ALL") LayerDTO layer,
			@ApiParam(required=false,value="Index of page",defaultValue="0") @QueryParam("pageIndex") @DefaultValue("0") Integer pageIndex, 
			@ApiParam(required=false,value="Size of page",defaultValue="20") @QueryParam("pageSize") @DefaultValue("20") Integer pageSize,
			@ApiParam(required=false,value="Order field") @QueryParam("orderField") String orderField, 
			@ApiParam(required=false,value="Order",allowableValues="ASC,DESC") @DefaultValue("ASC") @QueryParam("order") String order); @Override @Path("/room") @GET @ValidationRequired(processor = RestViolationProcessor.class) @ApiOperation(value = "Get room according to indoor location", httpMethod="GET",response=RoomDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Room belongs to location", response=RoomDTO.class), @ApiResponse(code = 400, message = "Invalid input parameter"), @ApiResponse(code = 404, message = "Room not found"), @ApiResponse(code = 500, message = "Problem in the system")}) Response getRoomByLocation(@Auth BasicAuth principal,
			@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, 			
			@ApiParam(value="Longitude of location", required=true) @Min(-180) @Max(180) @NotNull @QueryParam("longitude") Double longitude,
			@ApiParam(value="Latitude of location", required=true) @Min(-90) @Max(90) @NotNull @QueryParam("latitude") Double latitude,
			@ApiParam(value = "Floor of location", required = true) @NotNull  @QueryParam("floor") Integer floor);  }
@Test public void getRoomByLocationTest() throws AssemblyException, RoomNotFoundException{ Double longitude=60.0; Double latitude=70.0; Integer floor=3; Mockito.when(searchManagerImpl.getRoomByLocation(APP_IDENTIFIER, longitude, latitude, floor)).thenReturn(room); Mockito.when(roomAssembler.createDataTransferObject(room)).thenReturn(roomDTO); Response response = searchResourceImpl.getRoomByLocation(principal, APP_IDENTIFIER, longitude, latitude, floor); Mockito.verify(validations).checkIsNotNullAndNotBlank(APP_IDENTIFIER); Mockito.verify(validations).checkMin(-180.0,longitude); Mockito.verify(validations).checkMax(180.0,longitude); Mockito.verify(validations).checkMin(-90.0,latitude); Mockito.verify(validations).checkMax(90.0,latitude); Mockito.verify(validations).checkIsNotNull(floor); Mockito.verify(searchManagerImpl).getRoomByLocation(APP_IDENTIFIER, longitude, latitude, floor); Mockito.verify(roomAssembler).createDataTransferObject(room); assertNotNull("Response must not be null",response); assertEquals("The Status response is not the expected", 200, response.getStatus()); RoomDTO roomResponseDTO=(RoomDTO)response.getEntity(); assertEquals("Response must be equals", roomDTO, roomResponseDTO); }