@Test void generateConsents() throws IOException { when(parseService.getDataFromFile(any(), any())).thenReturn(Optional.of(Collections.singletonList(getAisConsent()))); when(tppConsentService.generateConsents(any())).thenReturn(Collections.singletonList("consent")); ResponseEntity<List<String>> response = tppConsentController.generateConsents(resolveMultipartFile(FILE_NAME)); assertTrue(response.getStatusCode().is2xxSuccessful()); assertFalse(Objects.requireNonNull(response.getBody()).isEmpty()); }
@Override public ResponseEntity<List<String>> generateConsents(MultipartFile file) { log.info("Update file received"); List<AisConsent> parsed = parseService.getDataFromFile(file, new TypeReference<List<AisConsent>>() { }).orElseThrow(() -> new TppException("Could not parse data", 400)); return ResponseEntity.ok(tppConsentService.generateConsents(parsed)); }
TppConsentController implements TppConsentRestApi { @Override public ResponseEntity<List<String>> generateConsents(MultipartFile file) { log.info("Update file received"); List<AisConsent> parsed = parseService.getDataFromFile(file, new TypeReference<List<AisConsent>>() { }).orElseThrow(() -> new TppException("Could not parse data", 400)); return ResponseEntity.ok(tppConsentService.generateConsents(parsed)); } }
TppConsentController implements TppConsentRestApi { @Override public ResponseEntity<List<String>> generateConsents(MultipartFile file) { log.info("Update file received"); List<AisConsent> parsed = parseService.getDataFromFile(file, new TypeReference<List<AisConsent>>() { }).orElseThrow(() -> new TppException("Could not parse data", 400)); return ResponseEntity.ok(tppConsentService.generateConsents(parsed)); }  }
TppConsentController implements TppConsentRestApi { @Override public ResponseEntity<List<String>> generateConsents(MultipartFile file) { log.info("Update file received"); List<AisConsent> parsed = parseService.getDataFromFile(file, new TypeReference<List<AisConsent>>() { }).orElseThrow(() -> new TppException("Could not parse data", 400)); return ResponseEntity.ok(tppConsentService.generateConsents(parsed)); }  @Override ResponseEntity<List<String>> generateConsents(MultipartFile file); @Override ResponseEntity<Resource> downloadConsentTemplate(); }
TppConsentController implements TppConsentRestApi { @Override public ResponseEntity<List<String>> generateConsents(MultipartFile file) { log.info("Update file received"); List<AisConsent> parsed = parseService.getDataFromFile(file, new TypeReference<List<AisConsent>>() { }).orElseThrow(() -> new TppException("Could not parse data", 400)); return ResponseEntity.ok(tppConsentService.generateConsents(parsed)); }  @Override ResponseEntity<List<String>> generateConsents(MultipartFile file); @Override ResponseEntity<Resource> downloadConsentTemplate();  }