Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel
// Necessary to maintain backwards compatibility when sensitive data processing changed from a
// length of 12 to 16 and known child sensitive data consents changed from a length of 2 to 3 in the
// DE, IA, NE, NH, NJ, TN release
if (bitString.length() == 66) {
if (bitString.length() == 60) {
bitString =
bitString.substring(0, 48) + "00000000" + bitString.substring(48, 52) + "00" + bitString.substring(52, 60) + "00";
}
else if (bitString.length() == 66) {
bitString =
bitString.substring(0, 48) + "00000000" + bitString.substring(48, 52) + "00" + bitString.substring(52, 62);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,28 @@ public void testDecodeWithGpcSegmentExcluded() throws DecodingException {
Assertions.assertEquals(2, usNat.getMspaServiceProviderMode());
Assertions.assertEquals(false, usNat.getGpcSegmentIncluded());
}

@Test
public void testDecodeBackwardsCompatibility() throws DecodingException {
UsNat usNat = new UsNat("BVQqAAAACg");

Assertions.assertEquals(1, usNat.getSharingNotice());
Assertions.assertEquals(1, usNat.getSaleOptOutNotice());
Assertions.assertEquals(1, usNat.getSharingOptOutNotice());
Assertions.assertEquals(1, usNat.getTargetedAdvertisingOptOutNotice());
Assertions.assertEquals(0, usNat.getSensitiveDataProcessingOptOutNotice());
Assertions.assertEquals(0, usNat.getSensitiveDataLimitUseNotice());
Assertions.assertEquals(2, usNat.getSaleOptOut());
Assertions.assertEquals(2, usNat.getSharingOptOut());
Assertions.assertEquals(2, usNat.getTargetedAdvertisingOptOut());
Assertions.assertEquals(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), usNat.getSensitiveDataProcessing());
Assertions.assertEquals(Arrays.asList(0, 0, 0), usNat.getKnownChildSensitiveDataConsents());
Assertions.assertEquals(2, usNat.getPersonalDataConsents());
Assertions.assertEquals(2, usNat.getMspaCoveredTransaction());
Assertions.assertEquals(0, usNat.getMspaOptOutOptionMode());
Assertions.assertEquals(0, usNat.getMspaServiceProviderMode());
Assertions.assertEquals(false, usNat.getGpc());
}

@Test()
public void testDecodeGarbage() {
Expand Down