Skip to content

Commit

Permalink
Add ProtectDebugInfo test
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Sep 10, 2024
1 parent b7359da commit afcf598
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions jpos/src/test/java/org/jpos/transaction/ProtectDebugInfoTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* jPOS Project [http://jpos.org]
* Copyright (C) 2000-2021 jPOS Software SRL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package org.jpos.transaction;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

import org.jpos.core.ConfigurationException;
import org.jpos.core.SimpleConfiguration;
import org.jpos.tlv.TLVList;
import org.junit.jupiter.api.Test;

public final class ProtectDebugInfoTest {

@Test
void test_wipe_tag() throws ConfigurationException {

TLVList tlv = new TLVList();
tlv.append(0x54, "AABBCCDDEEFF");
tlv.append(0x55, "BBDDFFEEDDAA");

SimpleConfiguration cfg = new SimpleConfiguration();
cfg.put("protect-entry", "TEST_ENTRY");
cfg.put("wipe-TLVList", "0x54");

ProtectDebugInfo participant = new ProtectDebugInfo();
participant.setConfiguration(cfg);

Context ctx = new Context();
ctx.put("TEST_ENTRY", tlv);

participant.commit(0, ctx);

ctx.dump(System.out, " ");
assertNotEquals("AABBCCDDEEFF", tlv.getString(0x54));
assertEquals("BBDDFFEEDDAA", tlv.getString(0x55));
}
}

0 comments on commit afcf598

Please sign in to comment.