0

I have an application in spring boot where I am fetching multiple files from GCS and then iterate to read file content. I am able to mock gcs storage but not able to mock the file content. I want to use some dummy xml file from test source folder to read the content. Following is the code snippet.

for(Blob blob: blobs.iterateAll(){

Source xmlinput = new StreamSource(Channels.newInputStream(blob.reader());
Source xsl =new StreamSource(new File("filepath"));
Result intXml = new StreamResult(new File("somepath"));
Transformer tr = TransformerFactory.newInstance().newTransformer(xsl);
transformer.transform(xmlinput, intXml);

return new String(Files.readAllBytes(Paths.get(intXml));
}

I didnt find any way to mock this part. Can anyone help in this regards

I tried to mock gcp storage which is working but didnt find any way to mock ReadChannel object

0