title: java.lang.VerifyError: Bad type on operand stack while running JUnit Test cases
body: <p>Hi I'm new to java and I found this error while running my JUnit test cases. I'm getting error in the DAO class of my application, I'm going to call my class 'TestDao' class. I'm using eclipse as my IDE but I get this error when I do 'mvn clean install' which also runs my test cases. The error stack is below from surefire reports: </p>
  
  <blockquote>
    <p>java.lang.VerifyError: Bad type on operand stack</p>
    
    <p>Exception Details:</p>
    
    <p>Location:
            com/services/test/dao/TestDao.deleteAuditLogsForLabel(Ljava/lang/String;)V
    @62: invokespecial</p>
    
    <p>Reason:
            Type org/apache/hadoop/hbase/filter/SubstringComparator (current frame, stack[5]) is not assignable to
    org/apache/hadoop/hbase/filter/ByteArrayComparable</p>
    
    <p>Current Frame:
       bci: @62</p>
    
    <p>flags: { }</p>
    
    <p>locals: { com/services/test/dao/TestDao, java/lang/String, org/apache/hadoop/hbase/client/HTable,
    org/apache/hadoop/hbase/filter/FilterList, java/lang/String,
    java/lang/String, org/apache/hadoop/hbase/filter/SubstringComparator }</p>
    
    <p>stack: { uninitialized 42, uninitialized 42, [B, [B, org/apache/hadoop/hbase/filter/CompareFilter$CompareOp,
    org/apache/hadoop/hbase/filter/SubstringComparator }</p>
  </blockquote>
  
  <p>Below is the TestDao.deleteAuditLogsForLabel method. </p>
  
  <pre><code>public void deleteAuditLogsForLabel(String netElementId) {
      try {
  
          HTable auditlogTable = new HbaseCore()
                  .getHtable(DatabaseConstants.AUDITTABLE);
          FilterList filterList = new FilterList(
                  FilterList.Operator.MUST_PASS_ALL);
          String columnFamily = DatabaseConstants.AUDITTABLE;
          String netId = netElementId;
          SubstringComparator netElementIdComparator = new SubstringComparator(
                  netId);
  
          SingleColumnValueFilter subObjectNameFilter = new SingleColumnValueFilter(
                  Bytes.toBytes(columnFamily),
                  Bytes.toBytes(DatabaseConstants.SUB_OBJECT_NAME),
                  CompareOp.EQUAL, netElementIdComparator);
  
          SingleColumnValueFilter subCategoryFilter = new SingleColumnValueFilter(
                  Bytes.toBytes(columnFamily),
                  Bytes.toBytes(DatabaseConstants.SUB_CATEGORY),
                  CompareOp.EQUAL, Bytes.toBytes(Constants.SYSTEM_LABEL));
  
          SingleColumnValueFilter usernameFilter = new SingleColumnValueFilter(
                  Bytes.toBytes(columnFamily),
                  Bytes.toBytes(DatabaseConstants.USER_NAME),
                  CompareOp.EQUAL, Bytes.toBytes(Constants.MACHINE_NAME));
  
          SingleColumnValueFilter categoryFilter = new SingleColumnValueFilter(
                  Bytes.toBytes(columnFamily),
                  Bytes.toBytes(Constants.CATEGORY), CompareOp.EQUAL,
                  Bytes.toBytes(Constants.LABEL_MODULE));
  
          filterList.addFilter(subObjectNameFilter);
          filterList.addFilter(subCategoryFilter);
          filterList.addFilter(usernameFilter);
          filterList.addFilter(categoryFilter);
  
          Scan scan = new Scan();
          scan.setFilter(filterList);
          ResultScanner resultScanner = auditlogTable.getScanner(scan);
          List&lt;Delete&gt; deletes = new ArrayList&lt;Delete&gt;();
          for (Result result : resultScanner) {
  
              String rowID = Bytes.toString(result.getRow());
  
              Delete delete = new Delete(Bytes.toBytes(rowID));
  
              deletes.add(delete);
  
          }
          auditlogTable.delete(deletes);
      } catch (Exception e) {
          LOGGER.logRuntimeError(e);
      }
  }
  </code></pre>
  
  <p>I read about how to resolve the 'java.lang.VerifyError' error
  <a href="https://examples.javacodegeeks.com/java-basics/exceptions/java-lang-verifyerror-how-to-solve-verifyerror/" rel="nofollow">here</a>. But a VerifyError is thrown where a class has a dependency
  on some other class and that class has incompatibly changed after the compilation. But both the SubstringComparator and ByteArrayComparable classes are part of the same jar file hbase_client[v0.98.3-hadoop2].</p>
  
  <p>Also the application is working fine. Its just the test cases which is throwing this error. Can someone please explain what is the problem? </p>