diff --git a/src/MainTest.java b/src/MainTest.java new file mode 100644 index 0000000..73bbcbb --- /dev/null +++ b/src/MainTest.java @@ -0,0 +1,40 @@ +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; + +import card.Card; +import player.BasePlayer; + +public class MainTest { + private static class Opts { + String playerFile; + + Opts(String[] args) { + // TODO dummy + // TODO error handling here, ctor is assumed to never fail + playerFile = "test.json"; + } + } + + public static void main(String[] args) { + Opts opts = new Opts(args); + JSONTokener jt = null; + try { + FileReader fr = new FileReader(new File(opts.playerFile)); + jt = new JSONTokener(fr); + } catch (JSONException | IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + JSONObject o = new JSONObject(jt); + + BasePlayer p = new BasePlayer(o); + + System.out.println(p.toJson().toString(4)); + } + +}