Question: Which CODE1, CODE2, CODE3 replacement set completes this JUnit test so that the test passes if and only if a DuplicateKeyException occurs while attempting to
WhichCODE1, CODE2, CODE3replacement set completes this JUnit test so that the test passes if and only if aDuplicateKeyExceptionoccurs while attempting to insert an existing key into aHashTable?
// assumes ht is an empty hash table @Test public void test_DuplicateKeyException { try { ht.insert(1011); CODE1 fail("expected DuplicateKeyException"); } catch ( CODE2 ) { /* expected */ } catch ( CODE3 ) { fail("unexpected exception"); } }
Group of answer choices
A)
CODE1: ht.insert(11); CODE2: Exception e CODE3: DuplicateKeyException e
B)
CODE1: ht.insert(11); CODE2: DuplicateKeyException e CODE3: Exception e
C)
CODE1: ht.insert(1011); CODE2: Exception e CODE3: DuplicateKeyException e
D)
CODE1: ht.insert("B"); CODE2: Exception e CODE3: DuplicateKeyException e
E)
CODE1: ht.insert(1011); CODE2: DuplicateKeyException e CODE3: Exception e
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
