-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add LinkedMapTests.cls to test LinkedMap.cls
- Loading branch information
1 parent
5364b7f
commit cddce6e
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
@isTest | ||
public class LinkedMapTests { | ||
@isTest | ||
static void testPut() { | ||
LinkedMap map = new LinkedMap(); | ||
map.put(new Set<String>{'key1'}, new List<Object>{'value1'}); | ||
System.assertEquals(map.get(new Set<String>{'key1'}), new List<Object>{'value1'}); | ||
|
||
map.put(new Set<String>{'key1'}, new List<Object>{'value2'}); | ||
System.assertEquals(map.get(new Set<String>{'key1'}), new List<Object>{'value1', 'value2'}); | ||
} | ||
|
||
@isTest | ||
static void testGet() { | ||
LinkedMap map = new LinkedMap(); | ||
map.put(new Set<String>{'key1'}, new List<Object>{'value1'}); | ||
System.assertEquals(map.get(new Set<String>{'key1'}), new List<Object>{'value1'}); | ||
System.assertEquals(map.get(new Set<String>{'key2'}), null); | ||
} | ||
|
||
@isTest | ||
static void testRemove() { | ||
LinkedMap map = new LinkedMap(); | ||
map.put(new Set<String>{'key1'}, new List<Object>{'value1'}); | ||
System.assertEquals(map.remove(new Set<String>{'key1'}), new List<Object>{'value1'}); | ||
System.assertEquals(map.remove(new Set<String>{'key1'}), null); | ||
} | ||
|
||
@isTest | ||
static void testContainsKey() { | ||
LinkedMap map = new LinkedMap(); | ||
map.put(new Set<String>{'key1'}, new List<Object>{'value1'}); | ||
System.assertEquals(map.containsKey(new Set<String>{'key1'}), true); | ||
System.assertEquals(map.containsKey(new Set<String>{'key2'}), false); | ||
} | ||
|
||
@isTest | ||
static void testKeySet() { | ||
LinkedMap map = new LinkedMap(); | ||
map.put(new Set<String>{'key1'}, new List<Object>{'value1'}); | ||
System.assertEquals(map.keySet(), new Set<Set<String>>{new Set<String>{'key1'}}); | ||
} | ||
|
||
@isTest | ||
static void testValues() { | ||
LinkedMap map = new LinkedMap(); | ||
map.put(new Set<String>{'key1'}, new List<Object>{'value1'}); | ||
System.assertEquals(map.values(), new List<List<Object>>{new List<Object>{'value1'}}); | ||
} | ||
} |