added 'debug' method to service builder

This commit is contained in:
Pablo Fernandez committed 2011-12-16 16:13:57 -03:00
1 parent 61c0b4cc9f
commit 0a63f935d2
8 files changed
+136 -42

No files matched your search

@@ -63,8 +63,7 @@ public class ServiceBuilderTest
public static class ApiMock implements Api
{
public static OAuthConfig config;
@Override
public OAuthService createService(OAuthConfig config)
{
ApiMock.config = config;
@@ -1,28 +0,0 @@
package org.scribe.model;
import static org.junit.Assert.*;
import org.junit.*;
public class OAuthConfigTest
{
@Test
public void shouldReturnDefaultValuesIfNotSet()
{
OAuthConfig config = new OAuthConfig("key", "secret");
assertEquals(OAuthConstants.OUT_OF_BAND, config.getCallback());
assertEquals(SignatureType.Header, config.getSignatureType());
assertFalse(config.hasScope());
}
@Test
public void shouldOverrideDefaultsIfSet()
{
OAuthConfig config = new OAuthConfig("key", "secret", "http://callback", SignatureType.Header, "scope");
assertEquals("http://callback", config.getCallback());
assertEquals("key", config.getApiKey());
assertEquals("secret", config.getApiSecret());
}
}
@@ -0,0 +1,35 @@
package org.scribe.utils;
import java.util.*;
import org.junit.*;
/**
* @author: Pablo Fernandez
*/
public class MapUtilsTest
{
@Test
public void shouldPrettyPrintMap()
{
Map<Integer, String> map = new HashMap<Integer, String>();
map.put(1, "one");
map.put(2, "two");
map.put(3, "three");
map.put(4, "four");
Assert.assertEquals("{ 1 -> one , 2 -> two , 3 -> three , 4 -> four }", MapUtils.toString(map));
}
@Test
public void shouldHandleEmptyMap()
{
Map<Integer, String> map = new HashMap<Integer, String>();
Assert.assertEquals("{}", MapUtils.toString(map));
}
@Test
public void shouldHandleNullInputs()
{
Assert.assertEquals("", MapUtils.toString(null));
}
}