Program: 162944
Project: 162944
Buggy source:
@Test public void testOnheapAcquireUsingLocked() throws IOException {
  ChronicleMapBuilder<CharSequence,LongValue> builder=ChronicleMapBuilder.of(CharSequence.class,LongValue.class).entries(1000).averageKeySize("String_Node_Str".length());
  File tmpFile=File.createTempFile("String_Node_Str","String_Node_Str");
  tmpFile.deleteOnExit();
  final ChronicleMap<CharSequence,LongValue> map=builder.createPersistedTo(tmpFile);
  LongValue value=DataValueClasses.newDirectReference(LongValue.class);
  try (MapKeyContext<LongValue> context=map.context("String_Node_Str")){
    assertEquals(false,context.containsKey());
    assertEquals(null,context.get());
  }
   try (MapKeyContext<LongValue> context=map.acquireContext("String_Node_Str",value)){
    value.setValue(10);
  }
   try (MapKeyContext<LongValue> context=map.acquireContext("String_Node_Str",value)){
    LongValue value1=context.get();
    value1.addValue(1);
  }
   try (MapKeyContext<LongValue> context=map.context("String_Node_Str")){
    assertEquals(true,context.containsKey());
    assertEquals(11,context.get().getValue());
  }
   try (MapKeyContext<LongValue> context=map.acquireContext("String_Node_Str",value)){
    context.remove();
  }
   try (MapKeyContext<LongValue> context=map.context("String_Node_Str")){
    assertEquals(false,context.containsKey());
    assertEquals(null,context.get());
  }
   try (MapKeyContext<LongValue> context=map.acquireContext("String_Node_Str",value)){
    assertEquals(0,context.get().getValue());
  }
   value.setValue(1);
  try (MapKeyContext<LongValue> lockedEntry=map.context("String_Node_Str")){
    assertEquals(1,lockedEntry.get().getValue());
  }
   try (MapKeyContext<LongValue> context=map.acquireContext("String_Node_Str",value)){
    LongValue value1=context.get();
    value1.addValue(1);
  }
   try (MapKeyContext<LongValue> context=map.context("String_Node_Str")){
    LongValue value1=context.get();
    assertEquals(2,value1.getValue());
  }
   map.close();
}

Fixed version (ground truth):
@Test public void testOnheapAcquireUsingLocked() throws IOException {
  ChronicleMapBuilder<CharSequence,LongValue> builder=ChronicleMapBuilder.of(CharSequence.class,LongValue.class).entries(1000).averageKeySize("String_Node_Str".length());
  File tmpFile=File.createTempFile("String_Node_Str","String_Node_Str");
  tmpFile.deleteOnExit();
  final ChronicleMap<CharSequence,LongValue> map=builder.createPersistedTo(tmpFile);
  LongValue value=DataValueClasses.newDirectReference(LongValue.class);
  try (MapKeyContext<LongValue> context=map.context("String_Node_Str")){
    assertEquals(false,context.containsKey());
    assertEquals(null,context.get());
  }
   try (MapKeyContext<LongValue> context=map.acquireContext("String_Node_Str",value)){
    value.setValue(10);
  }
   try (MapKeyContext<LongValue> context=map.acquireContext("String_Node_Str",value)){
    LongValue value1=context.get();
    value1.addValue(1);
  }
   try (MapKeyContext<LongValue> context=map.context("String_Node_Str")){
    assertEquals(true,context.containsKey());
    assertEquals(11,context.get().getValue());
  }
   try (MapKeyContext<LongValue> context=map.context("String_Node_Str")){
    context.remove();
  }
   try (MapKeyContext<LongValue> context=map.context("String_Node_Str")){
    assertEquals(false,context.containsKey());
    assertEquals(null,context.get());
  }
   try (MapKeyContext<LongValue> context=map.acquireContext("String_Node_Str",value)){
    assertEquals(0,context.get().getValue());
  }
   value.setValue(1);
  try (MapKeyContext<LongValue> lockedEntry=map.context("String_Node_Str")){
    assertEquals(1,lockedEntry.get().getValue());
  }
   try (MapKeyContext<LongValue> context=map.acquireContext("String_Node_Str",value)){
    LongValue value1=context.get();
    value1.addValue(1);
  }
   try (MapKeyContext<LongValue> context=map.context("String_Node_Str")){
    LongValue value1=context.get();
    assertEquals(2,value1.getValue());
  }
   map.close();
}