33import androidx .test .ext .junit .runners .AndroidJUnit4 ;
44
55import com .smartdevicelink .protocol .SecurityQueryPayload ;
6- import com .smartdevicelink .protocol .enums .QueryID ;
7- import com .smartdevicelink .protocol .enums .QueryType ;
6+ import com .smartdevicelink .protocol .enums .SecurityQueryID ;
7+ import com .smartdevicelink .protocol .enums .SecurityQueryType ;
88import com .smartdevicelink .util .BitConverter ;
99
1010import org .junit .Test ;
@@ -22,8 +22,8 @@ public class SecurityQueryPayloadTests {
2222 public static SecurityQueryPayload createDummyBqh () {
2323 SecurityQueryPayload bqh = new SecurityQueryPayload ();
2424 bqh .setCorrelationID (123 );
25- bqh .setQueryID (QueryID .SEND_HANDSHAKE_DATA );
26- bqh .setQueryType (QueryType .REQUEST );
25+ bqh .setQueryID (SecurityQueryID .SEND_HANDSHAKE_DATA );
26+ bqh .setQueryType (SecurityQueryType .REQUEST );
2727 bqh .setBulkData (null );
2828 bqh .setJsonSize (0 );
2929 return bqh ;
@@ -54,25 +54,25 @@ public void testCorrectParsing() {
5454 array [11 ] = 0 ;
5555
5656 SecurityQueryPayload parsedBqh = SecurityQueryPayload .parseBinaryQueryHeader (array );
57- assertEquals (parsedBqh .getQueryType (), QueryType .REQUEST );
58- assertEquals (parsedBqh .getQueryID (), QueryID .SEND_INTERNAL_ERROR );
57+ assertEquals (parsedBqh .getQueryType (), SecurityQueryType .REQUEST );
58+ assertEquals (parsedBqh .getQueryID (), SecurityQueryID .SEND_INTERNAL_ERROR );
5959 assertEquals (parsedBqh .getCorrelationID (), 3 );
6060 assertEquals (parsedBqh .getJsonSize (), 0 );
6161 }
6262
6363 @ Test
6464 public void testCorrectHeaderAssembly () {
6565 SecurityQueryPayload dummyBqh = new SecurityQueryPayload ();
66- dummyBqh .setQueryType (QueryType .REQUEST );
67- dummyBqh .setQueryID (QueryID .SEND_HANDSHAKE_DATA );
66+ dummyBqh .setQueryType (SecurityQueryType .REQUEST );
67+ dummyBqh .setQueryID (SecurityQueryID .SEND_HANDSHAKE_DATA );
6868 dummyBqh .setCorrelationID (3 );
6969 dummyBqh .setJsonSize (0 );
7070
7171 byte [] assembledHeader = dummyBqh .assembleHeaderBytes ();
72- assertEquals (dummyBqh .getQueryType (), QueryType .valueOf (assembledHeader [0 ]));
72+ assertEquals (dummyBqh .getQueryType (), SecurityQueryType .valueOf (assembledHeader [0 ]));
7373 byte [] queryIDFromHeader = new byte [3 ];
7474 System .arraycopy (assembledHeader , 1 , queryIDFromHeader , 0 , 3 );
75- assertEquals (dummyBqh .getQueryID (), QueryID .valueOf (queryIDFromHeader ));
75+ assertEquals (dummyBqh .getQueryID (), SecurityQueryID .valueOf (queryIDFromHeader ));
7676 assertEquals (dummyBqh .getCorrelationID (), BitConverter .intFromByteArray (assembledHeader , 4 ));
7777 assertEquals (dummyBqh .getJsonSize (), BitConverter .intFromByteArray (assembledHeader , 8 ));
7878 }
@@ -98,15 +98,10 @@ public void testAssemblyAndParse() {
9898 @ Test
9999 public void testCorruptHeader () {
100100 SecurityQueryPayload bqh = createDummyBqh ();
101- bqh .setJsonSize (5 );
102- bqh .setJsonData (new byte [5 ]);
103- bqh .setJsonSize (Integer .MAX_VALUE );
104-
105- assertNotEquals (bqh .getJsonData ().length , bqh .getJsonSize ());
106101
107102 byte [] bqhBytes = bqh .assembleHeaderBytes ();
108103
109- assertNull (safeParse (bqhBytes ));
104+ assertNotNull (safeParse (bqhBytes ));
110105
111106 int size = bqhBytes .length ;
112107 for (int i = 0 ; i < size ; i ++) {
0 commit comments