title: Expectations unmatched : Golang unit test error
body: <p>I am new to Golang,I am getting below error when I try to run below testcase. Can someone please suggest what am I doing wrong here?</p>
  <pre><code>db, mock, _ := sqlmock.New()
  
      dbConnect, _ := services.DB.Connect(services.Config.Database)
      defer db.Close()
  
      rows := sqlmock.NewRows([]string{&quot;id&quot;, &quot;txid&quot;, &quot;nounce&quot;, &quot;amount&quot;, &quot;confirmations&quot;, &quot;fromAddress&quot;, &quot;toAddress&quot;, &quot;toAccountId&quot;, &quot;currencyId&quot;,
          &quot;processStateId&quot;, &quot;transactionTypeId&quot;, &quot;transactionFees&quot;, &quot;gasPrice&quot;, &quot;gasLimit&quot;, &quot;transactionIndex&quot;, &quot;logIndex&quot;, &quot;gasUsed&quot;,
          &quot;status&quot;, &quot;blockNumber&quot;, &quot;createdAt&quot;, &quot;updatedAt&quot;}).
          AddRow(&quot;039f79c1-dbb3-4439-b9f7-361c7db6e03f&quot;, &quot;0x642ec5ca327d0e64e958b1f9a6ef1feb61f0e541629b3769e854608d00d89744&quot;, 0, 0.01, 12, &quot;0x3ee9f8c6a2676f2b0ebc324747253a23b7dbd1b3&quot;,
              &quot;0x06fcd7f32e155be895ed9282446864e7397ae40d&quot;, &quot;77c93121-5a9a-48fa-8c2f-23ff1debc3df&quot;, 2, 3, 2, 0.001, 0.001, 210000, 0, 0, 0, 0, 0, &quot;2021-10-30 07:38:03.299+00&quot;, &quot;2021-10-30 07:38:03.299+00&quot;).
          AddRow(&quot;039f79c1-dbb3-4439-b9f7-361c7db6e03f&quot;, &quot;0x642ec5ca327d0e64e958b1f9a6ef1feb61f0e541629b3769e854608d00d89744&quot;, 0, 0.01, 12, &quot;0x3ee9f8c6a2676f2b0ebc324747253a23b7dbd1b3&quot;,
              &quot;0x06fcd7f32e155be895ed9282446864e7397ae40d&quot;, &quot;77c93121-5a9a-48fa-8c2f-23ff1debc3df&quot;, 2, 3, 2, 0.001, 0.001, 210000, 0, 0, 0, 0, 0, &quot;2021-10-30 07:38:03.299+00&quot;, &quot;2021-10-30 07:38:03.299+00&quot;)
  
      GetTransactionsQuery(dbConnect, &quot;25&quot;, &quot;0&quot;)
      mock.ExpectQuery(&quot;SELECT * FROM BlockchainTransactions limit $1 offset $2&quot;).WithArgs(&quot;25&quot;, &quot;0&quot;).WillReturnRows(rows)
  
      if err := mock.ExpectationsWereMet(); err != nil {
          t.Errorf(&quot;there were unfulfilled expectations: %s&quot;, err)
      }
  </code></pre>
  <pre><code>--- FAIL: Test_GetTransactionsQuery (7.79s)
      ethtransactions_test.go:51: there were unfulfilled expectations: there is a remaining expectation which was not matched: ExpectedQuery =&gt; expecting Query, QueryContext or QueryRow which:
            - matches sql: 'SELECT * FROM BlockchainTransactions limit $1 offset $2'
            - is with arguments:
              0 - 25
              1 - 0
            - should return rows:
              row 0 - [039f79c1-dbb3-4439-b9f7-361c7db6e03f 0x642ec5ca327d0e64e958b1f9a6ef1feb61f0e541629b3769e854608d00d89744 0 0.01 12 0x3ee9f8c6a2676f2b0ebc324747253a23b7dbd1b3 0x06fcd7f32e155be895ed9282446864e7397ae40d 77c93121-5a9a-48fa-8c2f-23ff1debc3df 2 3 2 0.001 0.001 210000 0 0 0 0 0 2021-10-30 07:38:03.299+00 2021-10-30 07:38:03.299+00]
              row 1 - [039f79c1-dbb3-4439-b9f7-361c7db6e03f 0x642ec5ca327d0e64e958b1f9a6ef1feb61f0e541629b3769e854608d00d89744 0 0.01 12 0x3ee9f8c6a2676f2b0ebc324747253a23b7dbd1b3 0x06fcd7f32e155be895ed9282446864e7397ae40d 77c93121-5a9a-48fa-8c2f-23ff1debc3df 2 3 2 0.001 0.001 210000 0 0 0 0 0 2021-10-30 07:38:03.299+00 2021-10-30 07:38:03.299+00]
  FAIL
  </code></pre>
  <p>Below is the Function I am trying to mock:</p>
  <pre><code>
  func GetTransactionsQuery(db *sqlx.DB, limit string, offset string) ([]Transactions, error) {
  
      transactions := []Transactions{}
      Query := `SELECT *
      FROM &quot;BlockchainTransactions&quot;
      LIMIT :limit
      OFFSET :offset`
      params := map[string]interface{}{
          &quot;limit&quot;:  limit,
          &quot;offset&quot;: offset,
      }
  
      rows, err := db.NamedQuery(Query, params)
  
      for rows.Next() {
          transaction := Transactions{}
          rows.StructScan(&amp;transaction)
          transactions = append(transactions, transaction)
      }
      rows.Close()
  
      if err != nil {
          log.Fatalln(`GetTransactionsQuery: Failed to execute query`, err)
          return transactions, err
      }
  
      return transactions, nil
  }
  </code></pre>
  <p>Edit:
  I am calling an actual function before I mock data; I am still getting same error.</p>