@@ -92,6 +92,9 @@ public void runTests() throws Exception {
9292 testConstructParamsValidityPeriodTTL ();
9393 testConstructParamsContentId ();
9494 testConstructParamsEntityId ();
95+ testConstructParamsTrustedNumberTrue ();
96+ testConstructParamsTrustedNumberFalse ();
97+ testConstructParamsTrustedNumberNull ();
9598 testParseResponse ();
9699 testParseResponseInvalidStatus ();
97100 testParseResponseError ();
@@ -228,6 +231,47 @@ void testConstructParamsEntityId() {
228231 assertRequestContainsParams (params , message );
229232 }
230233
234+ void testConstructParamsTrustedNumberTrue () {
235+ Message message = new TextMessage ("TestSender" , "not-a-number" , "Test" );
236+ message .setTrustedNumber (true );
237+ assertEquals (true , message .getTrustedNumber ());
238+
239+ Map <String , String > params = new LinkedHashMap <>();
240+ params .put ("from" , "TestSender" );
241+ params .put ("to" , "not-a-number" );
242+ params .put ("type" , "text" );
243+ params .put ("text" , "Test" );
244+ params .put ("trusted-number" , "true" );
245+ assertRequestContainsParams (params , message );
246+ }
247+
248+ void testConstructParamsTrustedNumberFalse () {
249+ Message message = new TextMessage ("TestSender" , "not-a-number" , "Test" );
250+ message .setTrustedNumber (false );
251+ assertEquals (false , message .getTrustedNumber ());
252+
253+ Map <String , String > params = new LinkedHashMap <>();
254+ params .put ("from" , "TestSender" );
255+ params .put ("to" , "not-a-number" );
256+ params .put ("type" , "text" );
257+ params .put ("text" , "Test" );
258+ params .put ("trusted-number" , "false" );
259+ assertRequestContainsParams (params , message );
260+ }
261+
262+ void testConstructParamsTrustedNumberNull () {
263+ Message message = new TextMessage ("TestSender" , "not-a-number" , "Test" );
264+ assertNull (message .getTrustedNumber ());
265+
266+ Map <String , String > params = new LinkedHashMap <>();
267+ params .put ("from" , "TestSender" );
268+ params .put ("to" , "not-a-number" );
269+ params .put ("type" , "text" );
270+ params .put ("text" , "Test" );
271+ // trusted-number should not be in params when null
272+ assertRequestParams (params , message );
273+ }
274+
231275 void testParseResponse () throws Exception {
232276 SmsSubmissionResponse rs = parseResponse (
233277 """
0 commit comments