55import com .iab .gpp .encoder .error .EncodingException ;
66import com .iab .gpp .encoder .section .HeaderV1 ;
77import com .iab .gpp .encoder .section .TcfEuV2 ;
8- import com .iab .gpp .encoder .section .UsNat ;
98import com .iab .gpp .encoder .section .UspV1 ;
109import org .junit .jupiter .api .Test ;
1110
1211import java .util .Comparator ;
13- import java .util .List ;
1412
1513import static org .assertj .core .api .Assertions .assertThat ;
16- import static org .assertj .core .api .Assertions .assertThatExceptionOfType ;
17- import static org .assertj .core .api .Assertions .assertThatNoException ;
1814
1915public class GppModelWrapperTest {
2016
@@ -39,7 +35,7 @@ public class GppModelWrapperTest {
3935 + "1YN-" ;
4036
4137 @ Test
42- public void wrapperShouldStoreSomeOfOriginalSections () throws DecodingException , EncodingException {
38+ public void test () throws DecodingException , EncodingException {
4339 // given and when
4440 final GppModel originalGpp = new GppModel (GPP_STRING );
4541 final GppModel wrappedGpp = new GppModelWrapper (GPP_STRING );
@@ -52,73 +48,6 @@ public void wrapperShouldStoreSomeOfOriginalSections() throws DecodingException,
5248 assertThat (wrappedGpp .encodeSection (UspV1 .ID )).isEqualTo (originalGpp .encodeSection (UspV1 .ID ));
5349 }
5450
55- @ Test
56- public void wrapperShouldPadSectionsIfNeeded () {
57- // given
58- final List <String > samples = List .of (
59- "DBABLA~BVQqAAAAAg" ,
60- "DBABLA~BVVqCAAACg" ,
61- "DBABLA~BVVVBAAABg" ,
62- "DBABLA~BVVqCACACg" ,
63- "DBABLA~BVQVAAAAAg" ,
64- "DBABLA~BVVVBABABg" );
65-
66- for (String sample : samples ) {
67- // when
68- final GppModel originalGpp = new GppModel (sample );
69- final GppModel wrappedGpp = new GppModelWrapper (sample );
70-
71- // then
72- assertThatExceptionOfType (DecodingException .class )
73- .isThrownBy (() -> originalGpp .getUsNatSection ().getMspaCoveredTransaction ());
74- assertThatNoException ()
75- .isThrownBy (() -> wrappedGpp .getUsNatSection ().getMspaCoveredTransaction ());
76- }
77- }
78-
79- @ Test
80- public void wrapperShouldNotModifyValidBase64SubsectionsWithPadChars () {
81- // given
82- final String gpp = "DBABLA~BVVVQAAARlA=.QA==" ;
83-
84- // when
85- final GppModel wrappedGpp = new GppModelWrapper (gpp );
86-
87- // then
88- assertThat (wrappedGpp .encodeSection (UsNat .ID )).isEqualTo ("BVVVQAAARlA=.QA==" );
89- }
90-
91- @ Test
92- public void wrapperShouldNotModifyValidBase64SubsectionsWithoutPadChars () {
93- // given
94- final String gpp = "DBABLA~CqqqgAAAAIJo.YA==" ;
95-
96- // when
97- final GppModel wrappedGpp = new GppModelWrapper (gpp );
98-
99- // then
100- assertThat (wrappedGpp .encodeSection (UsNat .ID )).isEqualTo ("CqqqgAAAAIJo.YA==" );
101- assertThatNoException ()
102- .isThrownBy (() -> wrappedGpp .getUsNatSection ().getMspaCoveredTransaction ());
103- }
104-
105- @ Test
106- public void wrapperShouldPadSubsections () {
107- // given
108- final String gpp = "DBABLA~BVVVQAAARl.Q" ;
109-
110- // when
111- final GppModel originalGpp = new GppModel (gpp );
112- final GppModel wrappedGpp = new GppModelWrapper (gpp );
113-
114- // then
115- assertThat (wrappedGpp .encodeSection (UsNat .ID )).isEqualTo ("BVVVQAAARlA.QA" );
116- assertThatExceptionOfType (DecodingException .class )
117- .isThrownBy (() -> originalGpp .getUsNatSection ().getMspaCoveredTransaction ());
118- assertThatNoException ()
119- .isThrownBy (() -> wrappedGpp .getUsNatSection ().getMspaCoveredTransaction ());
120- }
121-
12251 public static String normalizeEncodedTcfEuV2Section (String encodedSection ) {
12352 try {
12453 final GppModel normalizer = new GppModel ();
0 commit comments