Buggy code:
public class TestDataCacheBehavesIdentical extends AbstractTestCase { private static OpenJPAEntityManagerFactorySPI emfWithDataCache ; private static OpenJPAEntityManagerFactorySPI emfWithoutDataCache ; private static final boolean WITH_DATACACHE = true ; private static final boolean CONSISTENT = true ; private static final boolean DIRTY = true ; private static final boolean REFRESH_FROM_DATACACHE = true ; private static final LockModeType NOLOCK = null ; private static final Class ENTITY_NOT_FOUND_ERROR = EntityNotFoundException . class ; private static final Class NO_ERROR = null ; private static final String MARKER_DATACACHE = "in<seq2seq4repair_space>DataCache" ; private static final String MARKER_DATABASE = "in<seq2seq4repair_space>Database" ; private static final String MARKER_CACHE = "in<seq2seq4repair_space>Object<seq2seq4repair_space>Cache" ; private static final String MARKER_DIRTY_CACHE = "in<seq2seq4repair_space>Object<seq2seq4repair_space>Cache<seq2seq4repair_space>(dirty)" ; private static long ID_COUNTER = System . currentTimeMillis ( ) ; public void setUp ( ) throws Exception { } boolean isDataCacheActive ( OpenJPAEntityManagerFactorySPI emf ) { } public void createBidirectionalRelation ( EntityManager em , long id , boolean consistent ) { } public void verifyBidirectionalRelation ( boolean useDataCache , boolean createConsistent , boolean expectConsistent ) { } public void testConsitentBidirectionalRelationIsPreservedWithDataCache ( ) { } public void testConsitentBidirectionalRelationIsPreservedWithoutDataCache ( ) { } public void testInconsitentBidirectionalRelationIsPreservedWithDataCache ( ) { } public void testInconsitentBidirectionalRelationIsNotPreservedWithoutDataCache ( ) { } public void verifyRefresh ( boolean useDataCache , LockModeType lock , boolean makeDirtyBeforeRefresh , boolean refreshFromDataCache , String expected ) { OpenJPAEntityManagerFactorySPI emf = ( useDataCache ) ? TestDataCacheBehavesIdentical . emfWithDataCache : TestDataCacheBehavesIdentical . emfWithoutDataCache ; emf . getConfiguration ( ) . setRefreshFromDataCache ( refreshFromDataCache ) ; OpenJPAEntityManagerSPI em = emf . createEntityManager ( ) ; em . getTransaction ( ) . begin ( ) ; PObject pc = new PObject ( ) ; pc . setName ( ( useDataCache ? TestDataCacheBehavesIdentical . MARKER_DATACACHE : TestDataCacheBehavesIdentical . MARKER_CACHE ) ) ; em . persist ( pc ) ; em . getTransaction ( ) . commit ( ) ; Object oid = pc . getId ( ) ; StoreCache dataCache = emf . getStoreCache ( ) ; assertEquals ( useDataCache , dataCache . contains ( PObject . class , oid ) ) ; em . getTransaction ( ) . begin ( ) ; <START_BUG> String sql = ( ( "UPDATE<seq2seq4repair_space>POBJECT<seq2seq4repair_space>SET<seq2seq4repair_space>NAME='" + ( TestDataCacheBehavesIdentical . MARKER_DATABASE ) ) + "'<seq2seq4repair_space>WHERE<seq2seq4repair_space>id=" ) + oid ; <END_BUG> em . createNativeQuery ( sql ) . executeUpdate ( ) ; em . getTransaction ( ) . commit ( ) ; assertEquals ( ( useDataCache ? TestDataCacheBehavesIdentical . MARKER_DATACACHE : TestDataCacheBehavesIdentical . MARKER_CACHE ) , pc . getName ( ) ) ; em . getTransaction ( ) . begin ( ) ; if ( makeDirtyBeforeRefresh ) { pc . setName ( TestDataCacheBehavesIdentical . MARKER_DIRTY_CACHE ) ; } assertEquals ( makeDirtyBeforeRefresh , em . isDirty ( pc ) ) ; if ( lock != null ) { ( ( org . apache . openjpa . persistence . EntityManagerImpl ) ( em ) ) . getFetchPlan ( ) . setReadLockMode ( lock ) ; } em . refresh ( pc ) ; assertEquals ( expected , pc . getName ( ) ) ; em . getTransaction ( ) . commit ( ) ; } String getExpectedMarker ( boolean useDataCache , LockModeType lock , boolean makeDirtyBeforeRefresh ) { } public void testDirtyRefreshWithNoLockHitsDatabase ( ) { } public void testDirtyRefreshWithNoLockHitsDataCache ( ) { } public void testCleanRefreshWithNoLockDoesNotHitDatabase ( ) { } public void testCleanRefreshWithNoLockHitsDataCache ( ) { } public void testDirtyRefreshWithReadLockHitsDatabase ( ) { } public void testCleanRefreshWithReadLockDoesNotHitDatabase ( ) { } public void testDirtyRefreshWithWriteLockHitsDatabase ( ) { } public void testCleanRefreshWithWriteLockDoesNotHitDatabase ( ) { } public void testDirtyRefreshWithoutDataCacheAlwaysHitsDatabase ( ) { } public void testCleanRefreshWithoutDataCacheDoesNotHitDatabase ( ) { } public void verifyDeleteDetectionOnRefresh ( boolean useDataCache , boolean dirty , LockModeType lock , Class expectedExceptionType ) { } public void testDeleteIsNotDetectedOnCleanRefreshWithoutLockWithDataCache ( ) { } public void testDeleteIsDetectedOnCleanRefreshWithLockWithDataCache ( ) { } public void testDeleteIsNotDetectedOnDirtyRefreshWithoutLockWithDataCache ( ) { } public void testDeleteIsDetectedOnDirtyRefreshWithLockWithDataCache ( ) { } public void testDeleteIsDetectedOnDirtyRefreshWitDataCache ( ) { } public void testDeleteIsDetectedOnCleanRefreshWithoutLockWithoutDataCache ( ) { } public void testDeleteIsDetectedOnCleanRefreshWithLockWithoutDataCache ( ) { } }

Fix:
String sql = ( ( "UPDATE<seq2seq4repair_space>PObject<seq2seq4repair_space>SET<seq2seq4repair_space>NAME='" + ( TestDataCacheBehavesIdentical . MARKER_DATABASE ) ) + "'<seq2seq4repair_space>WHERE<seq2seq4repair_space>id=" ) + oid ;