Author: ankon Date: Mon Feb 24 20:00:31 2014 New Revision: 1571418 URL: http://svn.apache.org/r1571418 Log: SHINDIG-1958 [2/1]: Add missing unit test for OAuth2TokenHandler#listToString()
Missed in the previous commit :/ Review: https://reviews.apache.org/r/15958/ Added: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/core/oauth2/OAuth2TokenHandlerTest.java Added: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/core/oauth2/OAuth2TokenHandlerTest.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/core/oauth2/OAuth2TokenHandlerTest.java?rev=1571418&view=auto ============================================================================== --- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/core/oauth2/OAuth2TokenHandlerTest.java (added) +++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/core/oauth2/OAuth2TokenHandlerTest.java Mon Feb 24 20:00:31 2014 @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.shindig.social.core.oauth2; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Collections; + +import org.junit.Test; + +public class OAuth2TokenHandlerTest { + @Test + public void listToStringEmptyIsEmpty() { + assertEquals("", OAuth2TokenHandler.listToString( + Collections.<String>emptyList())); + } + + @Test + public void listToStringNullIsEmpty() { + assertEquals("", OAuth2TokenHandler.listToString(null)); + } + + @Test + public void listToStringSingleValueIsSingleValue() { + assertEquals("foo", OAuth2TokenHandler.listToString( + Collections.singletonList("foo"))); + } + + @Test + public void listToStringMultipleValueIsCommaSeparatedAndOrdered() { + assertEquals("foo bar", OAuth2TokenHandler.listToString( + Arrays.asList("foo", "bar"))); + } +}
