### Question:
MolrMoleRestService { @GetMapping(path = MISSION_REPRESENTATION_PATH) public Mono<MissionRepresentationDto> representationOf(@PathVariable(MISSION_NAME) String missionName) { return mole.representationOf(new Mission(missionName)).map(MissionRepresentationDto::from); } MolrMoleRestService(Mole mole); @GetMapping(path = "/states", produces = MediaType.TEXT_EVENT_STREAM_VALUE) Flux<AgencyStateDto> states(); @GetMapping(path = MISSION_REPRESENTATION_PATH) Mono<MissionRepresentationDto> representationOf(@PathVariable(MISSION_NAME) String missionName); @GetMapping(path = MISSION_PARAMETER_DESCRIPTION_PATH) Mono<MissionParameterDescriptionDto> parameterDescriptionOf(@PathVariable(MISSION_NAME) String missionName); @GetMapping(path = INSTANCE_STATES_PATH, produces = MediaType.TEXT_EVENT_STREAM_VALUE) Flux<MissionStateDto> statesFor(@PathVariable(MISSION_HANDLE) String missionHandle); @GetMapping(path = INSTANCE_OUTPUTS_PATH, produces = MediaType.TEXT_EVENT_STREAM_VALUE) Flux<MissionOutputDto> outputsFor(@PathVariable(MISSION_HANDLE) String missionHandle); @GetMapping(path = INSTANCE_REPRESENTATIONS_PATH, produces = MediaType.TEXT_EVENT_STREAM_VALUE) Flux<MissionRepresentationDto> representationsFor(@PathVariable(MISSION_HANDLE) String missionHandle); @GetMapping(path = "/test-stream/{count}", produces = MediaType.TEXT_EVENT_STREAM_VALUE) Flux<TestValueDto> testResponse(@PathVariable("count") int count); @PostMapping(path = INSTANTIATE_MISSION_PATH) Mono<MissionHandleDto> instantiate(@PathVariable(MISSION_NAME) String missionName, @RequestBody String paramsJson); @PostMapping(path = INSTANCE_INSTRUCT_MISSION_PATH) void instructMission(@PathVariable(MISSION_HANDLE) final String missionHandle,
            @PathVariable(COMMAND_NAME) final String commandName); @PostMapping(path = INSTANCE_INSTRUCT_PATH) void instruct(@PathVariable(MISSION_HANDLE) String missionHandle, @PathVariable(STRAND_ID) String strandId, @PathVariable(COMMAND_NAME) String commandName); @PostMapping(path = INSTANCE_INSTRUCT_ROOT_PATH) void instructRoot(@PathVariable(MISSION_HANDLE) String missionHandle, @PathVariable(COMMAND_NAME) String commandName); @PostMapping(path = INSTANCE_INSTRUCT_BLOCK_PATH) void instructBlock(@PathVariable(MISSION_HANDLE) String missionHandle, @PathVariable(BLOCK_ID) String blockId, @PathVariable(COMMAND_NAME) String commandName); @ExceptionHandler({Exception.class}) @ResponseBody ResponseEntity<?> handleException(Exception e);  }### Answer:
@Test public void testErrorIsThrownWhenMoleThrows() { String uri = "mission/aMission/representation"; MissionRepresentationDto representation; WebClient client = WebClient.create(baseUrl); when(mole.representationOf(any(Mission.class))).thenThrow(new IllegalArgumentException("No mission of that name for this mole")); HttpStatus responseStatus = client.get().uri(uri) .accept(MediaType.APPLICATION_JSON) .exchange() .map(ClientResponse::statusCode).block(); assertThat(responseStatus).isEqualTo(HttpStatus.BAD_REQUEST); }