     }
     
     func testIndexBasedInsertionWithDuplicateKey() {
-        var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
-        
-        XCTAssertThrowsError(try orderedDictionary.insert((key: "A", value: 42), at: 3)) { error in
-            XCTAssertEqual(error as? OrderedDictionaryError, OrderedDictionaryError.nonUniqueKey("A"))
-        }
+        let orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
+        let invalidElement = (key: "A", value: 42)
+        
+        XCTAssertFalse(orderedDictionary.canInsert(invalidElement))
     }
     
     // ======================================================= //

    
    func testIndexBasedUpdateMethodByReplacingSameKey() {
        var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
        let previousElement = try! orderedDictionary.update((key: "B", value: 42), at: 1)
        
        XCTAssertEqual(orderedDictionary.count, 3)
        XCTAssertTrue(previousElement! == ("B", 2))

    
    func testIndexBasedInsertionsWithUniqueKeys() {
        var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
        orderedDictionary.insert((key: "T", value: 15), at: 0)
        orderedDictionary.insert((key: "U", value: 16), at: 2)
        orderedDictionary.insert((key: "V", value: 17), at: 5)
        orderedDictionary.insert((key: "W", value: 18), at: 2)
        
        let expected: OrderedDictionary<String, Int> = ["T": 15, "A": 1, "W": 18, "U": 16, "B": 2, "C": 3, "V": 17]
        let actual = orderedDictionary
