package cfvbaibai.cardfantasy.test;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

import cfvbaibai.cardfantasy.Randomizer;
import cfvbaibai.cardfantasy.StaticRandomizer;
import cfvbaibai.cardfantasy.engine.GameEngine;
import cfvbaibai.cardfantasy.game.DeckBuilder;
import cfvbaibai.cardfantasy.game.DeckStartupInfo;

@RunWith(Suite.class)
@SuiteClasses({
    RacialBufferTest.class, AttackBuffTest.class, SpecialStatusTest.class,
    DelayTest.class
})
public class FeatureValidationTests {
    public static FeatureTestContext prepare(int playerALevel, int playerBLevel, String ... cards) {
        GameEngine engine = TestGameBuilder.buildEmptyGameForTest(50, 50);
        DeckStartupInfo dsi = DeckBuilder.build(cards);
        FeatureTestContext context = new FeatureTestContext();
        context.setEngine(engine);
        context.setDsi(dsi);
        return context;
    }
    
    private static StaticRandomizer random;
    public static StaticRandomizer getRandom() {
        return random;
    }
    static {
        random = new StaticRandomizer();
        Randomizer.registerRandomizer(random);
    }
}

@@ -943,13 +943,9 @@
   %7D%0A
-    
 %0A
+
     
@@ -1045,42 +1045,34 @@
     
-return random;%0A    %7D%0A    static %7B%0A
+if (random == null) %7B%0A    
     
@@ -1104,24 +1104,28 @@
 ndomizer();%0A
+    
         Rand
@@ -1159,16 +1159,49 @@
 andom);%0A
+        %7D%0A        return random;%0A
     %7D%0A%7D%0A

Load test Randomizer lazily to avoid confliction in prod runtime.