@@ -0,0 +1,1850 @@
+package org.webbitserver.handler.authentication;%0D%0A%0D%0Aimport static org.junit.Assert.assertEquals;%0D%0A%0D%0Aimport org.junit.Test;%0D%0Aimport org.webbitserver.handler.authentication.PasswordAuthenticator.ResultCallback;%0D%0A%0D%0Apublic class InMemoryPasswordsTest %7B%0D%0A%0D%0A%09@Test%0D%0A%09public void authenticateWithEmptyUsernamePassword() %7B%0D%0A%09%09TestResultCallback callback = new TestResultCallback();%0D%0A%0D%0A%09%09InMemoryPasswords target = new InMemoryPasswords();%0D%0A%09%09target.authenticate(null, null, null, callback, null);%0D%0A%0D%0A%09%09assertEquals(false, callback.getResult());%0D%0A%09%7D%0D%0A%09%0D%0A%09@Test%0D%0A%09public void authenticateWithBadUsernamePassword() %7B%0D%0A%09%09TestResultCallback callback = new TestResultCallback();%0D%0A%0D%0A%09%09InMemoryPasswords target = new InMemoryPasswords();%0D%0A%09%09target.authenticate(null, %22non%22, %22existent%22, callback, null);%0D%0A%0D%0A%09%09assertEquals(false, callback.getResult());%0D%0A%09%7D%0D%0A%09%0D%0A%09@Test%0D%0A%09public void authenticateWithBadPassword() %7B%0D%0A%09%09TestResultCallback callback = new TestResultCallback();%0D%0A%0D%0A%09%09InMemoryPasswords target = new InMemoryPasswords();%0D%0A%09%09target.add(%22non%22, %22empty%22);%0D%0A%09%09target.authenticate(null, %22non%22, %22existent%22, callback, null);%0D%0A%0D%0A%09%09assertEquals(false, callback.getResult());%0D%0A%09%7D%0D%0A%09%0D%0A%09@Test%0D%0A%09public void authenticateWithGoodUsernamePassword() %7B%0D%0A%09%09String username = %22top%22;%0D%0A%09%09String password = %22secret%22;%0D%0A%09%09TestResultCallback callback = new TestResultCallback();%0D%0A%09%09%0D%0A%09%09InMemoryPasswords target = new InMemoryPasswords();%0D%0A%09%09target.add(username, password);%0D%0A%09%09target.authenticate(null, username, password, callback, null);%0D%0A%0D%0A%09%09assertEquals(true, callback.getResult());%0D%0A%09%7D%0D%0A%0D%0A%09class TestResultCallback implements ResultCallback %7B%0D%0A%09%09private boolean result = false;%0D%0A%09%09%0D%0A%09%09@Override%0D%0A%09%09public void success() %7B%0D%0A%09%09%09result = true;%0D%0A%09%09%7D%0D%0A%0D%0A%09%09@Override%0D%0A%09%09public void failure() %7B%0D%0A%09%09%09result = false;%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09public boolean getResult() %7B%0D%0A%09%09%09return result;%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%7D%0D%0A

Add tests for InMemoryPasswords class