I created a simple service that consumes xml (i generated model with jaxb from https://krankenhausstandorte.de/storage/templates/xsds/Standortverzeichnis.xsd)
Using WebClient i can easily read into desired Object:
public Standortverzeichnis getAll() {
return this.client.get()
.uri(config.getPathfull())
.retrieve()
.bodyToMono(Standortverzeichnis.class)
.block(Duration.ofSeconds(config.getSecondsTimeout()));
So there seems to be an ObjectMapper in place that is deserializing to Standortverzeichnis.class.
How to get this mapper injected into a test? For json i just use @JsonTest
and inject "ObjectMapper" into my test. But using this and reading xml i get:
Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
So how to get the same mapper (with same configuration) injected into my test?
Aucun commentaire:
Enregistrer un commentaire