title: How to call a method from a helper class?
body: <p>I have a class with the name CommonSteps.java which contains the following method:</p>
  
  <pre><code>    @Then("^the following error is displayed: \"([^\"]*)\"$")
  public void the_error_is_displayed(String message) throws Exception {
      // although using the login page to retrieve - these will return if visible from any page!
      message = errorHelper.generateErrorMessage(message);
      assertThat(runtimeState.loginPage.getErrors(), hasItem(containsString(message)));
  }
  </code></pre>
  
  <p>I would like to call this method into another class in an assertion. I have written the following code so far :</p>
  
  <pre><code>    @Then("^an upload invoice error message is displayed$")
  public void an_upload_invoice_error_message_is_displayed() throws Throwable {
      List&lt;Map&lt;String, Object&gt;&gt; invoiceDocuments = dbHelperInvoices.getInvoiceDocumentsFilePath(testData.getInt("orderRef"));
      if (invoiceDocuments.get(0).get("jobSheetFilePath") == null &amp;&amp; invoiceDocuments.get(0).get("invoiceFilePath") != null) {
          assertTrue("Unexpected error message displayed", commonSteps.the_error_is_displayed(message));
  </code></pre>
  
  <p>My question is what should i use in the place of message variable ? Or what do I need to add to get message variable to work ? As this code is throwing an error. Hope this is enough information. I am new to coding so apologies if this is a daft question.</p>
  
  <p>EDIT: My previous code for this was </p>
  
  <pre><code>public void an_upload_invoice_error_message_is_displayed() throws Throwable {
      List&lt;Map&lt;String, Object&gt;&gt; invoiceDocuments = dbHelperInvoices.getInvoiceDocumentsFilePath(testData.getInt("orderRef"));
      if (invoiceDocuments.get(0).get("jobSheetFilePath") == null &amp;&amp; invoiceDocuments.get(0).get("invoiceFilePath") != null) {
          assertTrue("Unexpected error message displayed", runtimeState.uploadInvoiceDocumentPage.isUploadJobSheetErrorDisplayed());
          outputHelper.takeScreenshot();
      } else if (invoiceDocuments.get(0).get("invoiceFilePath") == null &amp;&amp; invoiceDocuments.get(0).get("jobSheetFilePath") != null) {
          assertTrue("Unexpected error message displayed", runtimeState.uploadInvoiceDocumentPage.isUploadInvoiceErrorDisplayed());
          outputHelper.takeScreenshot();
      } else if (invoiceDocuments.get(0).get("invoiceFilePath") == null &amp;&amp; invoiceDocuments.get(0).get("jobSheetFilePath") == null){
          assertTrue("Unexpected error message displayed", runtimeState.uploadInvoiceDocumentsPage.isUploadInvoiceErrorDisplayed());
          assertTrue("Unexpected error message displayed", runtimeState.uploadInvoiceDocumentsPage.isUploadJobsheetErrorDisplayed());
          outputHelper.takeScreenshot();
      }
  }
  </code></pre>
  
  <p>However, I was told to change the code to call the method from CommonSteps.java above</p>