### Question:
InMemorySessionStore implements SessionStore { public java.io.Serializable create(ProtocolId pid, ConversationId cid, Serializable session) { if (pid == null) { throw new IllegalArgumentException("Protocol id not specified"); } else if (cid == null) { throw new IllegalArgumentException("Conversation instance id not specified"); } addSession(pid, cid, session); return(session); }  void setConfiguration(Configuration config); java.io.Serializable create(ProtocolId pid, ConversationId cid, Serializable session); java.io.Serializable find(ProtocolId pid, ConversationId cid); void remove(ProtocolId pid, ConversationId cid); void update(ProtocolId pid, ConversationId cid, java.io.Serializable session); void close();  }### Answer:
@Test public void testCreateSessionNoConversationInstanceId() { InMemorySessionStore store=new InMemorySessionStore(); try { store.create(new ProtocolId("name","role"), null, null); fail("Should have thrown IllegalArgumentException"); } catch(IllegalArgumentException iae) { } catch(Exception e) { fail("Not expecting: "+e); } }
@Test public void testCreateSessionNoProtocolId() { InMemorySessionStore store=new InMemorySessionStore(); try { store.create(null, new ConversationId("id"), null); fail("Should have thrown IllegalArgumentException"); } catch(IllegalArgumentException iae) { } catch(Exception e) { fail("Not expecting: "+e); } }
@Test public void testCreateSessionDuplicateInvalidId() { InMemorySessionStore store=new InMemorySessionStore(); DefaultSession session = new DefaultSession(); try { ProtocolId pid=new ProtocolId("p","r"); ConversationId id=new ConversationId("1"); try { store.create(pid, id, session); } catch(Exception inner) { fail("Should not have failed"); } store.create(pid, id, session); fail("Should have thrown IllegalArgumentException"); } catch(IllegalArgumentException iae) { } catch(Exception e) { fail("Not expecting: "+e); } }
@Test public void testCreateSession() { InMemorySessionStore store=new InMemorySessionStore(); DefaultSession s = new DefaultSession(); try { ProtocolId pid=new ProtocolId("p","r"); ConversationId id=new ConversationId("1"); if (store.create(pid, id, s) == null) { fail("No context created"); } } catch(Exception e) { fail("Not expecting: "+e); } }