@@ -0,0 +1,2440 @@
+// Copyright 2011 Twitter, Inc.%0A//%0A// Licensed under the Apache License, Version 2.0 (the %22License%22); you may not use this%0A// file except in compliance with the License. You may obtain a copy of the License at%0A//%0A//     http://www.apache.org/licenses/LICENSE-2.0%0A//%0A// Unless required by applicable law or agreed to in writing, software distributed%0A// under the License is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR%0A// CONDITIONS OF ANY KIND, either express or implied. See the License for the%0A// specific language governing permissions and limitations under the License.%0A%0Apackage com.twitter.joauth.keyvalue;%0A%0Aimport com.twitter.joauth.Request;%0Aimport org.junit.Test;%0Aimport static org.mockito.Mockito.*;%0A%0Aimport java.util.ArrayList;%0A%0Apublic class KeyValueParserTest  %7B%0A%0A  KeyValueHandler handler = mock(KeyValueHandler.class);%0A  ArrayList%3CKeyValueHandler%3E handlers = initKeyValueHandlers();%0A%0A  private ArrayList%3CKeyValueHandler%3E initKeyValueHandlers() %7B%0A    ArrayList%3CKeyValueHandler%3E list = new ArrayList%3CKeyValueHandler%3E();%0A    list.add(handler);%0A    return list;%0A  %7D%0A%0A  @Test%0A  public void testConstKeyValueParser() %7B%0A    ArrayList%3CRequest.Pair%3E requestPairs = new ArrayList%3CRequest.Pair%3E();%0A    requestPairs.add(new Request.Pair(%22a%22, %22b%22));%0A    requestPairs.add(new Request.Pair(%22c%22, %22d%22));%0A%0A    KeyValueParser.ConstKeyValueParser parser = new KeyValueParser.ConstKeyValueParser(requestPairs);%0A    parser.parse(%22foo%22, handlers);%0A    verify(handler, atLeast(1)).handle(%22a%22, %22b%22);%0A    verify(handler, atLeast(1)).handle(%22c%22, %22d%22);%0A  %7D%0A%0A  @Test%0A  public void testStandardKeyValueParser() %7B%0A    KeyValueParser parser = KeyValueParser.QueryKeyValueParser;%0A%0A    //%22not blow up on null string%22 in %7B%0A    parser.parse(null, handlers);%0A    verify(handler, never()).handle(anyString(), anyString());%0A%0A%0A    //%22not blow up on empty string%22 in %7B%0A    parser.parse(%22%22, handlers);%0A    verify(handler, never()).handle(anyString(), anyString());%0A%0A    //%22parse simple string%22 in %7B%0A    parser.parse(%22foo%22, handlers);%0A    verify(handler, atLeastOnce()).handle(%22foo%22, %22%22);%0A%0A    //%22parse valid pairs%22 in %7B%0A    parser.parse(%22foo=bar&baz%22, handlers);%0A    verify(handler, atLeast(1)).handle(%22foo%22, %22bar%22);%0A    verify(handler, atLeast(1)).handle(%22baz%22, %22%22);%0A%0A    //%22parse malformed pairs%22 in %7B%0A    parser.parse(%22foo=bar&&baz&%22, handlers);%0A    verify(handler, atLeast(1)).handle(%22foo%22, %22bar%22);%0A    verify(handler, atLeast(1)).handle(%22baz%22, %22%22);%0A  %7D%0A%7D%0A

move KeyValueHandlerSpec.scala to Java