Scan QR Code UI Automation using Espresso

I am trying to test QR code scanning using espresso by passing QR Code image using espresso UI Automation.

How it works for me ->
When user scan right QR code then a new activity open to show scanned text where in case of wrong Qr,simple a toast is visible on same screen.

Note 1 – Here I am using for scanning QR code.

Note 2 – When I scan manually by showing Qr Code while espresso test is running, it works fine but I want to do it automatically.

Source: Android Questions