Validating the incoming message from application

Hey guys, I need your support.
I’m writing a test to check the flow of messages in our application. I have already completed the sending side, unfortunately I encountered a problem with the receiving side. The current test code returns me

java.lang.AssertionError: Message foundWitam serdecznie expected [true] but found [false]
Expected :true
Actual :false.

What’s the problem?

There is full code of receiving side:

public class test_inc_msg_motoE4 {

public AndroidDriver<MobileElement> driver;
public WebDriverWait wait;

public void setUp() throws MalformedURLException {
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability("deviceName", "Moto E (4)");
    caps.setCapability("udid", "ZY32298P3K");
    caps.setCapability("platformName", "Android");
    caps.setCapability("platformVersion", "7.1.1");
    caps.setCapability("skipUnlock", "true");
    caps.setCapability("appPackage", "");
    caps.setCapability("appActivity", "");
    caps.setCapability("noReset", true);
    driver = new AndroidDriver<MobileElement>(new URL(""), caps);
    wait = new WebDriverWait(driver, 10);

private String settingsAppPackageName="";
private String settingsAppActivityName="org.thoughtcrime.securesms.ConversationListActivity";
private String MessageToSend = "abcd";
private String msgFound = "Message found";
private String msgNotFound = "Message not found";

public void IncomingMsg () throws InterruptedException {


    WebElement msg = driver.findElement(By.xpath("//*[@text='develop test and']"));

    boolean msgExists = msg.isDisplayed();

    if(msgExists == true) {
        driver.startActivity(new Activity(settingsAppPackageName, settingsAppActivityName));
        driver.findElementByXPath("//*[@text='develop test and']").click();
        List<MobileElement> list = driver.findElementsById("");
        boolean hasMatchedElement = false;
        for (MobileElement item : list) {
            if (item.getText().equals(MessageToSend)) {
                hasMatchedElement = true;
        Assert.assertTrue(hasMatchedElement, msgFound + MessageToSend);
    } else {
        Assert.assertFalse(false, msgNotFound);

public void teardown(){