Program: 33082
Project: 33082
Buggy source:
@Test public void singleMaterialWithRefresh() throws InterruptedException {
  final MostRecentProvider prov=new MostRecentProvider(store,MATERIAL_NAME,100);
  assertNull(methodCalls.get("String_Node_Str"));
  final EncryptionMaterials eMat1=prov.getEncryptionMaterials(ctx);
  assertEquals(1,(int)methodCalls.get("String_Node_Str"));
  methodCalls.clear();
  final EncryptionMaterials eMat2=prov.getEncryptionMaterials(ctx);
  assertTrue(methodCalls.isEmpty());
  assertEquals(0,store.getVersionFromMaterialDescription(eMat1.getMaterialDescription()));
  assertEquals(0,store.getVersionFromMaterialDescription(eMat2.getMaterialDescription()));
  prov.refresh();
  final EncryptionMaterials eMat3=prov.getEncryptionMaterials(ctx);
  assertEquals(1,(int)methodCalls.get("String_Node_Str"));
  assertEquals(1,(int)methodCalls.get("String_Node_Str"));
  assertEquals(0,store.getVersionFromMaterialDescription(eMat3.getMaterialDescription()));
  assertEquals(eMat1.getSigningKey(),eMat2.getSigningKey());
  assertEquals(eMat1.getSigningKey(),eMat3.getSigningKey());
  final MostRecentProvider prov2=new MostRecentProvider(store,MATERIAL_NAME,500);
  final DecryptionMaterials dMat1=prov2.getDecryptionMaterials(ctx(eMat1));
  methodCalls.clear();
  assertEquals(eMat1.getEncryptionKey(),dMat1.getDecryptionKey());
  assertEquals(eMat1.getSigningKey(),dMat1.getVerificationKey());
  final DecryptionMaterials dMat2=prov2.getDecryptionMaterials(ctx(eMat2));
  assertEquals(eMat2.getEncryptionKey(),dMat2.getDecryptionKey());
  assertEquals(eMat2.getSigningKey(),dMat2.getVerificationKey());
  final DecryptionMaterials dMat3=prov2.getDecryptionMaterials(ctx(eMat3));
  assertEquals(eMat3.getEncryptionKey(),dMat3.getDecryptionKey());
  assertEquals(eMat3.getSigningKey(),dMat3.getVerificationKey());
  assertTrue(methodCalls.isEmpty());
}

Fixed version (ground truth):
@Test public void singleMaterialWithRefresh() throws InterruptedException {
  final MostRecentProvider prov=new MostRecentProvider(store,MATERIAL_NAME,500);
  assertNull(methodCalls.get("String_Node_Str"));
  final EncryptionMaterials eMat1=prov.getEncryptionMaterials(ctx);
  assertEquals(1,(int)methodCalls.get("String_Node_Str"));
  methodCalls.clear();
  final EncryptionMaterials eMat2=prov.getEncryptionMaterials(ctx);
  assertTrue(methodCalls.isEmpty());
  assertEquals(0,store.getVersionFromMaterialDescription(eMat1.getMaterialDescription()));
  assertEquals(0,store.getVersionFromMaterialDescription(eMat2.getMaterialDescription()));
  prov.refresh();
  final EncryptionMaterials eMat3=prov.getEncryptionMaterials(ctx);
  assertEquals(1,(int)methodCalls.get("String_Node_Str"));
  assertEquals(1,(int)methodCalls.get("String_Node_Str"));
  assertEquals(0,store.getVersionFromMaterialDescription(eMat3.getMaterialDescription()));
  prov.refresh();
  assertEquals(eMat1.getSigningKey(),eMat2.getSigningKey());
  assertEquals(eMat1.getSigningKey(),eMat3.getSigningKey());
  prov.getEncryptionMaterials(ctx);
  Thread.sleep(700);
  prov.getEncryptionMaterials(ctx);
  methodCalls.clear();
  assertEquals(eMat1.getSigningKey(),prov.getEncryptionMaterials(ctx).getSigningKey());
  assertEquals(eMat1.getSigningKey(),prov.getEncryptionMaterials(ctx).getSigningKey());
  assertEquals(eMat1.getSigningKey(),prov.getEncryptionMaterials(ctx).getSigningKey());
  assertEquals(eMat1.getSigningKey(),prov.getEncryptionMaterials(ctx).getSigningKey());
  assertEquals(eMat1.getSigningKey(),prov.getEncryptionMaterials(ctx).getSigningKey());
  assertTrue(methodCalls.isEmpty());
  final MostRecentProvider prov2=new MostRecentProvider(store,MATERIAL_NAME,500);
  final DecryptionMaterials dMat1=prov2.getDecryptionMaterials(ctx(eMat1));
  methodCalls.clear();
  assertEquals(eMat1.getEncryptionKey(),dMat1.getDecryptionKey());
  assertEquals(eMat1.getSigningKey(),dMat1.getVerificationKey());
  final DecryptionMaterials dMat2=prov2.getDecryptionMaterials(ctx(eMat2));
  assertEquals(eMat2.getEncryptionKey(),dMat2.getDecryptionKey());
  assertEquals(eMat2.getSigningKey(),dMat2.getVerificationKey());
  final DecryptionMaterials dMat3=prov2.getDecryptionMaterials(ctx(eMat3));
  assertEquals(eMat3.getEncryptionKey(),dMat3.getDecryptionKey());
  assertEquals(eMat3.getSigningKey(),dMat3.getVerificationKey());
  assertTrue(methodCalls.isEmpty());
}