I have written a multi thread code which will verify data in database and assert accordingly. But the assertions are not working in this environment.
Code to create threads
Runnable r = new WorkerThread(subasscociation);
new Thread(r).start();
new Thread(r).start();
The code for thread start function is
   public class WorkerThread implements Runnable {
    ArrayList<Association> alInsertedAssociations;
    public WorkerThread(ArrayList<Association> alInsertedAssociations) {
        this.alInsertedAssociations = alInsertedAssociations;
    }
    public void run() {
        SecondLevelVerification slv = new SecondLevelVerification();
        slv.verify(alInsertedAssociations,"add", false);
    }
}
The function which asserts
public void verify(...)
{
  //Code to check database
 org.testng.Assert.assertNotEquals(label, 0);
}
But the code doesn't seem to work ie it doesnt assert correctly if the database doesn't have that entry.
 
     
    