### Question:
TppDataUploaderController implements TppDataUploaderRestApi { @Override public ResponseEntity<String> uploadData(MultipartFile file) { log.info("Update file received"); DataPayload parsed = parseService.getDataFromFile(file, new TypeReference<DataPayload>() { }).orElseThrow(() -> new TppException("Could not parse data", 400)); restExecutionService.updateLedgers(parsed); return ResponseEntity.ok("Data successfully updated"); }  @Override ResponseEntity<String> uploadData(MultipartFile file); @Override ResponseEntity<Resource> generateData(boolean generatePayments, String currency); @Override ResponseEntity<String> generateIban(String tppId); @Override ResponseEntity<Map<String, String>> uploadTransactions(MultipartFile file); @Override ResponseEntity<Resource> downloadTransactionTemplate();  }### Answer:
@Test void uploadData() throws IOException { when(parseService.getDataFromFile(any(), any())).thenReturn(Optional.of(getPayload())); ResponseEntity<String> response = uploaderController.uploadData(resolveMultipartFile("transactions_template.csv")); assertTrue(response.getStatusCode().is2xxSuccessful()); }
@Test void uploadData_couldNotParseData() { when(parseService.getDataFromFile(any(), any())).thenReturn(Optional.empty()); assertThrows(TppException.class, () -> uploaderController.uploadData(resolveMultipartFile("transactions_template.csv"))); }