@Test public void tetGetMachines() throws Exception { MachineQueryResult mockResponse = MachineQueryResult.newBuilder() .setPagination(SpringMockMvcUtil.paginationOf(NEXT_PAGE_OF_1)) .addAllItems(asList(MACHINE_1, MACHINE_2)) .build(); QueryRequest stubRequest = QueryRequest.newBuilder() .setPage(NEXT_PAGE_OF_1) .build(); when(serviceMock.getMachines(stubRequest)).thenReturn(Mono.just(mockResponse)); MachineQueryResult entity = SpringMockMvcUtil.doPaginatedGet(mockMvc, "/api/v4/machines", MachineQueryResult.class, NEXT_PAGE_OF_1); assertThat(entity).isEqualTo(mockResponse); }
@ApiOperation("Get all machines") @GetMapping public MachineQueryResult getMachines(@RequestParam MultiValueMap<String, String> queryParameters) { QueryRequest.Builder queryBuilder = QueryRequest.newBuilder(); Page page = RestUtil.createPage(queryParameters); queryBuilder.setPage(page); queryBuilder.putAllFilteringCriteria(RestUtil.getFilteringCriteria(queryParameters)); queryBuilder.addAllFields(RestUtil.getFieldsParameter(queryParameters)); return machineServiceStub.getMachines(queryBuilder.build()).block(TIMEOUT); }
MachineSpringResource { @ApiOperation("Get all machines") @GetMapping public MachineQueryResult getMachines(@RequestParam MultiValueMap<String, String> queryParameters) { QueryRequest.Builder queryBuilder = QueryRequest.newBuilder(); Page page = RestUtil.createPage(queryParameters); queryBuilder.setPage(page); queryBuilder.putAllFilteringCriteria(RestUtil.getFilteringCriteria(queryParameters)); queryBuilder.addAllFields(RestUtil.getFieldsParameter(queryParameters)); return machineServiceStub.getMachines(queryBuilder.build()).block(TIMEOUT); } }
MachineSpringResource { @ApiOperation("Get all machines") @GetMapping public MachineQueryResult getMachines(@RequestParam MultiValueMap<String, String> queryParameters) { QueryRequest.Builder queryBuilder = QueryRequest.newBuilder(); Page page = RestUtil.createPage(queryParameters); queryBuilder.setPage(page); queryBuilder.putAllFilteringCriteria(RestUtil.getFilteringCriteria(queryParameters)); queryBuilder.addAllFields(RestUtil.getFieldsParameter(queryParameters)); return machineServiceStub.getMachines(queryBuilder.build()).block(TIMEOUT); } @Inject  MachineSpringResource(ReactorMachineServiceStub machineServiceStub); }
MachineSpringResource { @ApiOperation("Get all machines") @GetMapping public MachineQueryResult getMachines(@RequestParam MultiValueMap<String, String> queryParameters) { QueryRequest.Builder queryBuilder = QueryRequest.newBuilder(); Page page = RestUtil.createPage(queryParameters); queryBuilder.setPage(page); queryBuilder.putAllFilteringCriteria(RestUtil.getFilteringCriteria(queryParameters)); queryBuilder.addAllFields(RestUtil.getFieldsParameter(queryParameters)); return machineServiceStub.getMachines(queryBuilder.build()).block(TIMEOUT); } @Inject  MachineSpringResource(ReactorMachineServiceStub machineServiceStub); @ApiOperation("Get all machines") @GetMapping MachineQueryResult getMachines(@RequestParam MultiValueMap<String, String> queryParameters); @GetMapping(path = "/{machineId}") @ApiOperation("Get single machine") Machine getMachine(@PathVariable("machineId") String machineId); }
MachineSpringResource { @ApiOperation("Get all machines") @GetMapping public MachineQueryResult getMachines(@RequestParam MultiValueMap<String, String> queryParameters) { QueryRequest.Builder queryBuilder = QueryRequest.newBuilder(); Page page = RestUtil.createPage(queryParameters); queryBuilder.setPage(page); queryBuilder.putAllFilteringCriteria(RestUtil.getFilteringCriteria(queryParameters)); queryBuilder.addAllFields(RestUtil.getFieldsParameter(queryParameters)); return machineServiceStub.getMachines(queryBuilder.build()).block(TIMEOUT); } @Inject  MachineSpringResource(ReactorMachineServiceStub machineServiceStub); @ApiOperation("Get all machines") @GetMapping MachineQueryResult getMachines(@RequestParam MultiValueMap<String, String> queryParameters); @GetMapping(path = "/{machineId}") @ApiOperation("Get single machine") Machine getMachine(@PathVariable("machineId") String machineId);  }