MachineSpringResource { @GetMapping(path = "/{machineId}") @ApiOperation("Get single machine") public Machine getMachine(@PathVariable("machineId") String machineId) { return machineServiceStub.getMachine(Id.newBuilder().setId(machineId).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);  }
@Test public void testGetMachine() throws Exception { when(serviceMock.getMachine(ArgumentMatchers.any())).thenReturn(Mono.just(MACHINE_1)); Machine entity = SpringMockMvcUtil.doGet(mockMvc, "/api/v4/machines/" + MACHINE_1.getId(), Machine.class); assertThat(entity).isEqualTo(MACHINE_1); }