Buggy code:
public abstract class PersistenceTestCase extends TestCase { private static PersistenceTestCase . FixedMap _emfs = new PersistenceTestCase . FixedMap ( ) ; public static final String FRESH_EMF = "Creates<seq2seq4repair_space>new<seq2seq4repair_space>EntityManagerFactory" ; protected static final Object CLEAR_TABLES = new Object ( ) ; protected static final Object DROP_TABLES = new Object ( ) ; protected TestResult testResult ; protected OpenJPAEntityManagerFactorySPI createEMF ( Object ... props ) { } protected String getPersistenceUnitName ( ) { } protected OpenJPAEntityManagerFactorySPI createNamedEMF ( String pu , Object ... props ) { Map map = new HashMap ( ) ; List < Class > types = new ArrayList < Class > ( ) ; boolean prop = false ; boolean fresh = false ; for ( int i = 0 ; i < ( props . length ) ; i ++ ) { if ( ( props [ i ] ) == ( PersistenceTestCase . FRESH_EMF ) ) { fresh = true ; continue ; } if ( prop ) { map . put ( props [ ( i - 1 ) ] , props [ i ] ) ; prop = false ; } else if ( ( props [ i ] ) == ( PersistenceTestCase . CLEAR_TABLES ) ) { map . put ( "openjpa.jdbc.SynchronizeMappings" , ( "buildSchema(ForeignKeys=true," + "SchemaAction='add,deleteTableContents')" ) ) ; } else if ( ( props [ i ] ) == ( PersistenceTestCase . DROP_TABLES ) ) { map . put ( "openjpa.jdbc.SynchronizeMappings" , ( "buildSchema(ForeignKeys=true," + "SchemaAction='drop,add')" ) ) ; } else if ( ( props [ i ] ) instanceof Class ) types . add ( ( ( Class ) ( props [ i ] ) ) ) ; else if ( ( props [ i ] ) != null ) prop = true ; } if ( ! ( types . isEmpty ( ) ) ) { StringBuffer buf = new StringBuffer ( ) ; for ( Class c : types ) { if ( ( buf . length ( ) ) > 0 ) buf . append ( ";" ) ; buf . append ( c . getName ( ) ) ; } String oldValue = ( map . containsKey ( "openjpa.MetaDataFactory" ) ) ? "," + ( map . get ( "openjpa.MetaDataFactory" ) . toString ( ) ) : "" ; map . put ( "openjpa.MetaDataFactory" , ( ( ( "jpa(Types=" + ( buf . toString ( ) ) ) + oldValue ) + ")" ) ) ; } PersistenceTestCase . EMFKey key = new PersistenceTestCase . EMFKey ( pu , map ) ; OpenJPAEntityManagerFactorySPI oemf = PersistenceTestCase . _emfs . get ( key ) ; <START_BUG> if ( fresh || ( oemf == null ) ) { <END_BUG> Map config = new HashMap ( System . getProperties ( ) ) ; config . putAll ( map ) ; oemf = ( ( OpenJPAEntityManagerFactorySPI ) ( Persistence . createEntityManagerFactory ( pu , config ) ) ) ; if ( oemf == null ) { throw new NullPointerException ( ( ( ( "Expected<seq2seq4repair_space>an<seq2seq4repair_space>entity<seq2seq4repair_space>manager<seq2seq4repair_space>factory<seq2seq4repair_space>" + "for<seq2seq4repair_space>the<seq2seq4repair_space>persistence<seq2seq4repair_space>unit<seq2seq4repair_space>named:<seq2seq4repair_space>\"" ) + pu ) + "\"" ) ) ; } else if ( ! fresh ) { PersistenceTestCase . _emfs . put ( key , oemf ) ; } } return oemf ; } @ Override public void run ( TestResult testResult ) { } @ Override public void tearDown ( ) throws Exception { } protected boolean closeEMF ( EntityManagerFactory emf ) { } protected void closeAllOpenEMs ( EntityManagerFactory emf ) { } protected void clear ( EntityManagerFactory emf , Class ... types ) { } protected void clear ( EntityManagerFactory emf ) { } private void clear ( EntityManagerFactory emf , boolean closeEMs , ClassMetaData ... types ) { } protected String entityName ( EntityManagerFactory emf , Class c ) { } private boolean isBaseManagedInterface ( ClassMetaData meta , ClassMetaData ... types ) { } private boolean isExtendedManagedInterface ( ClassMetaData meta , ClassMetaData ... types ) { } public static void assertNotEquals ( Object o1 , Object o2 ) { } public static Object roundtrip ( Object o ) throws IOException , ClassNotFoundException { } protected void assertException ( final Throwable actual , Class targetType ) { } protected void assertException ( final Throwable actual , Class targetType , Class nestedTargetType ) { } protected void assertMessage ( Throwable actual , String ... keys ) { } public void printException ( Throwable t ) { } public void printException ( Throwable t , int tab ) { } @ Override public void runBare ( ) throws Throwable { } protected boolean allowFailure ( ) { } private static class FixedMap extends LinkedHashMap < PersistenceTestCase . EMFKey , OpenJPAEntityManagerFactorySPI > { public boolean removeEldestEntry ( Map . Entry < PersistenceTestCase . EMFKey , OpenJPAEntityManagerFactorySPI > entry ) { } } private static class EMFKey { final String unit ; final Map config ; EMFKey ( String unit , Map config ) { } public int hashCode ( ) { } public boolean equals ( Object other ) { } } }

Fix:
if ( ( fresh || ( oemf == null ) ) || ( ! ( oemf . isOpen ( ) ) ) ) {