package util.game;

import java.io.File;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import util.gdl.grammar.Gdl;
import util.kif.KifReader;

/**
 * Test game repository that provides rulesheet-only access to games with no
 * associated metadata or other resources, to be used only for unit tests.
 * 
 * @author Sam
 */
public final class TestGameRepository extends GameRepository {
    protected Set<String> getUncachedGameKeys() {
        Set<String> theKeys = new HashSet<String>();
        for(File game : new File("games/test").listFiles()) {
            if(!game.getName().endsWith(".kif")) continue;
            theKeys.add(game.getName().replace(".kif", ""));
        }
        return theKeys;
    }
    
    protected Game getUncachedGame(String theKey) {
    	try {
    		List<Gdl> theRules = KifReader.read(new File("games/test/" + theKey + ".kif").getAbsolutePath());
    		return new Game(theKey, null, null, null, null, theRules);
    	} catch (Exception e) {
    		throw new RuntimeException(e);
    	}        
    }
}
@@ -85,68 +85,14 @@
 til.
-List;%0D%0Aimport java.util.Set;%0D%0A%0D%0Aimport util.gdl.grammar.Gdl;
+Set;%0D%0A
 %0D%0Aim
@@ -782,29 +782,40 @@
   %09%09
-List%3CGdl%3E theRules = 
+return Game.createEphemeralGame(
 KifR
@@ -889,73 +889,8 @@
 h())
-;%0D%0A    %09%09return new Game(theKey, null, null, null, null, theRules
 );%0D%0A

Update the test game repository to make it clear that it only returns ephemeral games (i.e. without metadata or any non-rulesheet resources).