Looks like this can help with testing toasts in our espresso automation. Thanks for sharing it.
Satyajit Malugu

If you’re using a snackbar, then there are callbacks for show and dismiss events, maybe you can use something similar for toast, or wrap the object and try to mirror its internal state in your wrapper.

Snackbar sb = TextToSpeechSnackbarFactory.genericErrorSnackbar(container);
sb.addCallback(new BaseTransientBottomBar.BaseCallback<Snackbar>() {
public void onDismissed(Snackbar transientBottomBar, int event) {
super.onDismissed(transientBottomBar, event);

public void onShown(Snackbar transientBottomBar) {