Open mchhil-incomm opened 9 months ago
@mchhil-incomm at your convenience, please check f66f287 sent against next
. If you think it solves the issue, we can back port it to master
. I also took the opportunity to remove a few tests that would break with this change, but made no sense.
@ar your protect0 is what I have implemented and is being used by other projects here internally. As for the protect method, I believe your test case covers it.
Should there be a test case to make sure results of protect0 and protect yield identical results?
Oh... protect0
was just placed as a reference while coding the protect
:) — I'll take it away.
@ar The test case does not look right. For clarity you can try "=====^apr/apr^====^==="
@Test
public void testProtect10() throws Throwable {
String result = ISOUtil.protect("=====^===========^====^===");
assertEquals("=====^===========^====^===", result, "result");
}
The name is not masked in it, unless its a special kind of track data that I am not aware of. The data after the first ^
has not changed because the following check
if (firstSeparatorIndex < 6) {
return s; // nothing to do
}
The old method would have returned
=====^___________^________
for an input of "=====^===========^====^==="
For regression, it would be good to test the old output equals the new one.
@mchhil-incomm the track1 "=====^apr/apr^====^===" looks invalid to me to start with. That would be a six digits card number, which looks invalid.
For regression, it would be good to test the old output equals the new one. I think some of the old tests were just wrong, hence adjusted.
Output
John/Doe is not protected.
Change
https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/iso/ISOUtil.java#L929-L938
to
Output