OfflineSeActions { @Nullable public List<ApduCommand> getCommands(@OfflineSeActionTypes.Type String type) { SeAction action = getAction(type); return action != null ? action.getApduCommands() : null; } OfflineSeActions(Map<String, SeAction> actions); @Nullable List<ApduCommand> getCommands(@OfflineSeActionTypes.Type String type); @Nullable SeAction getAction(@OfflineSeActionTypes.Type String type);  }
@Test public void ensurePlatformConfigurationIsSetupCorrectly() { final String actionsString = "{\n" + " \"topOfWallet\": {\n" + " \"apduCommands\": [\n" + " {\n" + " \"sequence\": 0,\n" + " \"command\": \"00A4040009A00000015143525300\",\n" + " \"type\": \"SELECT\",\n" + " \"description\": \"Select CRS\"\n" + " },\n" + " {\n" + " \"sequence\": 1,\n" + " \"command\": \"80F002020D4F0BA0000000041010AA030002\",\n" + " \"type\": \"SET_STATUS\",\n" + " \"description\": \"Set Volatile Priority\"\n" + " }\n" + " ]\n" + " },\n" + " \"activate\": {\n" + " \"apduCommands\": [\n" + " {\n" + " \"sequence\": 0,\n" + " \"command\": \"00A4040009A00000015143525300\",\n" + " \"type\": \"SELECT\",\n" + " \"description\": \"Select CRS\"\n" + " },\n" + " {\n" + " \"sequence\": 1,\n" + " \"command\": \"80C3010000\",\n" + " \"type\": \"SET_PARAM\",\n" + " \"description\": \"Deactivate Default Card\"\n" + " },\n" + " {\n" + " \"sequence\": 2,\n" + " \"command\": \"80F002020D4F0BA0000000041010AA030002\",\n" + " \"type\": \"SET_DEFAULT_CARD\",\n" + " \"description\": \"Set Default Card\"\n" + " },\n" + " {\n" + " \"sequence\": 3,\n" + " \"command\": \"80C3010100\",\n" + " \"type\": \"SET_PARAM\",\n" + " \"description\": \"Activate Default Card\"\n" + " }\n" + " ]\n" + " },\n" + " \"deactivate\": {\n" + " \"apduCommands\": [\n" + " {\n" + " \"sequence\": 0,\n" + " \"command\": \"00A4040009A00000015143525300\",\n" + " \"type\": \"SELECT\",\n" + " \"description\": \"Select CRS\"\n" + " },\n" + " {\n" + " \"sequence\": 1,\n" + " \"command\": \"80C3010000\",\n" + " \"type\": \"SET_PARAM\",\n" + " \"description\": \"Deactivate Default Card\"\n" + " }\n" + " ]\n" + " }\n" + " }"; OfflineSeActions actions = Constants.getGson().fromJson(actionsString, OfflineSeActions.class); Assert.assertNotNull("actions is empty", actions); List<ApduCommand> towCommands = actions.getCommands(OfflineSeActionTypes.TOP_OF_WALLET); Assert.assertNotNull("tow commands is empty", towCommands); List<ApduCommand> activate = actions.getCommands(OfflineSeActionTypes.ACTIVATE); Assert.assertNotNull("activate is empty", activate); List<ApduCommand> deactivate = actions.getCommands(OfflineSeActionTypes.DEACTIVATE); Assert.assertNotNull("deactivate is empty", deactivate); }