11/**
22 * Copyright (c) 2025 Beyond The Cloud Sp. z o.o. (BeyondTheCloud.Dev)
33 * Licensed under the MIT License (https://github.com/beyond-the-cloud-dev/soql-lib/blob/main/LICENSE)
4- *
5- * v6.0.0
6- *
4+ *
5+ * v6.0.1
6+ *
77 **/
88@IsTest
99private class SOQLEvaluator_Test {
@@ -118,7 +118,7 @@ private class SOQLEvaluator_Test {
118118 static void sObjectsToIdsOfRelationshipField () {
119119 // Setup
120120 insertAccountsWithParents ();
121-
121+
122122 // Test
123123 Set <Id > createdByIds = SOQLEvaluator .of ([SELECT Id , Parent.CreatedById FROM Account WHERE ParentId != null ]).toIdsOf (' Parent' , Account .CreatedById );
124124
@@ -133,10 +133,10 @@ private class SOQLEvaluator_Test {
133133 new Account (Name = ' Test 1' , Parent = new Account (ParentId = SOQL .IdGenerator .get (Account .SObjectType ))),
134134 new Account (Name = ' Test 2' , Parent = new Account (ParentId = SOQL .IdGenerator .get (Account .SObjectType )))
135135 });
136-
136+
137137 // Test
138138 Set <Id > parentIds = SOQLEvaluator .of ([SELECT Id , Parent.ParentId FROM Account WHERE ParentId != null ]).mockId (' mockingQuery' ).toIdsOf (' Parent' , Account .ParentId );
139-
139+
140140 // Verify
141141 Assert .areEqual (2 , parentIds .size (), ' The size of the returned set should be 2, because the accounts have a parent.' );
142142 }
@@ -157,7 +157,7 @@ private class SOQLEvaluator_Test {
157157 static void sObjectDoExistWithMocking () {
158158 // Setup
159159 SOQLEvaluator .mock (' mockingQuery' ).thenReturn (new Account (Name = ' Test Account' ));
160-
160+
161161 // Test
162162 Boolean doesExist = SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).mockId (' mockingQuery' ).doExist ();
163163
@@ -181,7 +181,7 @@ private class SOQLEvaluator_Test {
181181 static void sObjectToValueOfWithMocking () {
182182 // Setup
183183 SOQLEvaluator .mock (' mockingQuery' ).thenReturn (new Account (Name = ' Test Account' ));
184-
184+
185185 // Test
186186 String accountName = (String )SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).mockId (' mockingQuery' ).toValueOf (Account .Name );
187187
@@ -193,7 +193,7 @@ private class SOQLEvaluator_Test {
193193 static void sObjectsToValuesOf () {
194194 // Setup
195195 insertAccounts ();
196-
196+
197197 // Test
198198 Set <String > accountNames = SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).toValuesOf (Account .Name );
199199
@@ -220,7 +220,7 @@ private class SOQLEvaluator_Test {
220220 static void sObjectToObject () {
221221 // Setup
222222 insertAccount ();
223-
223+
224224 // Test
225225 Account account = (Account ) SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).toObject ();
226226
@@ -234,7 +234,7 @@ private class SOQLEvaluator_Test {
234234 insertAccounts ();
235235 Exception queryException = null ;
236236
237- // Test
237+ // Test
238238 try {
239239 Account account = (Account ) SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).toObject ();
240240 } catch (Exception e ) {
@@ -249,7 +249,7 @@ private class SOQLEvaluator_Test {
249249 static void sObjectToObjectWithMocking () {
250250 // Setup
251251 SOQLEvaluator .mock (' mockingQuery' ).thenReturn (new Account (Name = ' Test Account' ));
252-
252+
253253 // Test
254254 Account account = (Account ) SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).mockId (' mockingQuery' ).toObject ();
255255
@@ -270,13 +270,13 @@ private class SOQLEvaluator_Test {
270270 static void sObjectsToList () {
271271 // Setup
272272 insertAccounts ();
273-
273+
274274 // Test
275275 List <Account > accounts = SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).toList ();
276276
277277 // Verify
278278 Assert .areEqual (2 , accounts .size (), ' The size of the returned list should be 2.' );
279- }
279+ }
280280
281281 @IsTest
282282 static void sObjectsToListWithMocking () {
@@ -292,12 +292,12 @@ private class SOQLEvaluator_Test {
292292 // Verify
293293 Assert .areEqual (2 , accounts .size (), ' The size of the returned list should be 2.' );
294294 }
295-
295+
296296 @IsTest
297297 static void sObjectsToListWhenNoRecords () {
298298 // Test
299299 List <Account > accounts = SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).toList ();
300-
300+
301301 // Verify
302302 Assert .areEqual (0 , accounts .size (), ' The size of the returned list should be 0.' );
303303 }
@@ -306,7 +306,7 @@ private class SOQLEvaluator_Test {
306306 static void sObjectsToMap () {
307307 // Setup
308308 insertAccounts ();
309-
309+
310310 // Test
311311 Map <Id , Account > accounts = (Map <Id , Account >) SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).toMap ();
312312
@@ -321,7 +321,7 @@ private class SOQLEvaluator_Test {
321321 new Account (Name = ' Test 1' ),
322322 new Account (Name = ' Test 2' )
323323 });
324-
324+
325325 // Test
326326 Map <Id , Account > accounts = (Map <Id , Account >) SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).mockId (' mockingQuery' ).toMap ();
327327
@@ -357,7 +357,7 @@ private class SOQLEvaluator_Test {
357357 new Account (Name = ' Test 1' ),
358358 new Account (Name = ' Test 2' )
359359 });
360-
360+
361361 // Test
362362 Map <String , Account > accounts = (Map <String , Account >) SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).mockId (' mockingQuery' ).toMap (Account .Name );
363363
@@ -378,7 +378,7 @@ private class SOQLEvaluator_Test {
378378 static void sObjectsToMapWithRelatedKeyField () {
379379 // Setup
380380 insertAccountsWithParents ();
381-
381+
382382 // Test
383383 Map <String , Account > accounts = (Map <String , Account >) SOQLEvaluator .of ([SELECT Id , Parent.Name FROM Account WHERE ParentId != null ]).toMap (' Parent' , Account .Name );
384384
@@ -393,10 +393,10 @@ private class SOQLEvaluator_Test {
393393 new Account (Name = ' Test 1' , Parent = new Account (Name = ' Parent 1' )),
394394 new Account (Name = ' Test 2' , Parent = new Account (Name = ' Parent 2' ))
395395 });
396-
396+
397397 // Test
398398 Map <String , Account > accounts = (Map <String , Account >) SOQLEvaluator .of ([SELECT Id , Parent.Name FROM Account WHERE ParentId != null ]).mockId (' mockingQuery' ).toMap (' Parent' , Account .Name );
399-
399+
400400 // Verify
401401 Assert .areEqual (2 , accounts .size (), ' The size of the returned map should be 2.' );
402402 }
@@ -429,7 +429,7 @@ private class SOQLEvaluator_Test {
429429 new Account (Name = ' Test 1' , Description = ' Description 1' ),
430430 new Account (Name = ' Test 2' , Description = ' Description 2' )
431431 });
432-
432+
433433 // Test
434434 Map <String , String > nameToDescription = SOQLEvaluator .of ([SELECT Id , Name , Description FROM Account ]).mockId (' mockingQuery' ).toMap (Account .Name , Account .Description );
435435
@@ -450,7 +450,7 @@ private class SOQLEvaluator_Test {
450450 static void sObjectsToAggregatedMap () {
451451 // Setup
452452 insertAccounts ();
453-
453+
454454 // Test
455455 Map <String , List <Account >> nameToAccounts = SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).toAggregatedMap (Account .Name );
456456
@@ -465,7 +465,7 @@ private class SOQLEvaluator_Test {
465465 new Account (Name = ' Test 1' , Industry = ' IT' ),
466466 new Account (Name = ' Test 2' , Industry = ' IT' )
467467 });
468-
468+
469469 // Test
470470 Map <String , List <Account >> industryToAccounts = SOQLEvaluator .of ([SELECT Id , Name , Industry FROM Account ]).mockId (' mockingQuery' ).toAggregatedMap (Account .Industry );
471471
@@ -486,7 +486,7 @@ private class SOQLEvaluator_Test {
486486 static void sObjectsToAggregatedMapWithRelatedKeyField () {
487487 // Setup
488488 insertAccountsWithParents ();
489-
489+
490490 // Test
491491 Map <String , List <Account >> parentNameToAccounts = SOQLEvaluator .of ([SELECT Id , Parent.Name FROM Account WHERE ParentId != null ]).toAggregatedMap (' Parent' , Account .Name );
492492
@@ -501,7 +501,7 @@ private class SOQLEvaluator_Test {
501501 new Account (Name = ' Test 1' , Parent = new Account (Name = ' Parent 1' )),
502502 new Account (Name = ' Test 2' , Parent = new Account (Name = ' Parent 2' ))
503503 });
504-
504+
505505 // Test
506506 Map <String , List <Account >> parentNameToAccounts = SOQLEvaluator .of ([SELECT Id , Parent.Name FROM Account WHERE ParentId != null ]).mockId (' mockingQuery' ).toAggregatedMap (' Parent' , Account .Name );
507507
@@ -522,7 +522,7 @@ private class SOQLEvaluator_Test {
522522 static void sObjectsToAggregatedMapWithKeyAndValueFields () {
523523 // Setup
524524 insertAccounts ();
525-
525+
526526 // Test
527527 Map <String , List <String >> nameToDescriptions = SOQLEvaluator .of ([SELECT Id , Name , Description FROM Account ]).toAggregatedMap (Account .Name , Account .Description );
528528
@@ -537,7 +537,7 @@ private class SOQLEvaluator_Test {
537537 new Account (Name = ' Test 1' , Description = ' Description 1' ),
538538 new Account (Name = ' Test 2' , Description = ' Description 2' )
539539 });
540-
540+
541541 // Test
542542 Map <String , List <String >> nameToDescriptions = SOQLEvaluator .of ([SELECT Id , Name , Description FROM Account ]).mockId (' mockingQuery' ).toAggregatedMap (Account .Name , Account .Description );
543543
@@ -560,7 +560,7 @@ private class SOQLEvaluator_Test {
560560 SOQLEvaluator .mock (' mockingQuery' ).thenReturn (new Account (Name = ' Test 1' ));
561561 SOQLEvaluator .mock (' mockingQuery' ).thenReturn (new Account (Name = ' Test 2' ));
562562 SOQLEvaluator .mock (' mockingQuery' ).thenReturn (new Account (Name = ' Test 3' ));
563-
563+
564564 // Test
565565 Account account1 = (Account ) SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).mockId (' mockingQuery' ).toObject ();
566566 Account account2 = (Account ) SOQLEvaluator .of ([SELECT Id , Name FROM Account ]).mockId (' mockingQuery' ).toObject ();
@@ -624,4 +624,4 @@ private class SOQLEvaluator_Test {
624624 return [SELECT Id , Subject , Type FROM Task WITH SYSTEM_MODE ];
625625 }
626626 }
627- }
627+ }
0 commit comments