SessionAgent { static void readArguments(String agentArgs) { if (agentArgs == null) { return; } String[] args = agentArgs.split(","); for (String arg : args) { parseArgument(agentArgs, arg.trim()); } if (!agentArgs.isEmpty() && System.getProperty(REPOSITORY_CONF_PROPERTY) == null) { System.setProperty(REPOSITORY_CONF_PROPERTY, agentArgs); } } private  SessionAgent(); static void premain(String agentArgs, Instrumentation inst); static void debug(String format, Object... args); static void error(String format, Object... args); static boolean isDebugMode();  }
@Test(expected=IllegalArgumentException.class) public void testInvalidDebugMode() { SessionAgent.readArguments("log=debg"); }
@Test(expected=IllegalArgumentException.class) public void testInvalidArgument() { SessionAgent.readArguments("log=debug,provider=d,something=bad"); }
@Test public void testReadTimeoutAndFactory() { SessionAgent.readArguments("timeout=200,provider=redis"); assertEquals("200", System.getProperty(SessionAgent.SESSION_TIMEOUT)); assertEquals("timeout=200,provider=redis", System.getProperty(SessionAgent.REPOSITORY_CONF_PROPERTY)); assertEquals("redis", System.getProperty(SessionAgent.SESSION_FACTORY)); assertNull(System.getProperty(SessionAgent.SESSION_DISTRIBUTABLE)); assertNull(System.getProperty(SessionAgent.SESSION_MANAGEMENT_DISABLED)); }