Added URLDecoding to verifier
This commit is contained in:
1 parent
806d548629
commit
cf84381127
2 files changed
+25
-1
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package org.scribe.model;
|
||||
|
||||
import org.scribe.utils.*;
|
||||
|
||||
/**
|
||||
* Represents an OAuth verifier code.
|
||||
*
|
||||
@@ -7,6 +9,7 @@ package org.scribe.model;
|
||||
*/
|
||||
public class Verifier
|
||||
{
|
||||
|
||||
private final String value;
|
||||
|
||||
/**
|
||||
@@ -16,7 +19,7 @@ public class Verifier
|
||||
*/
|
||||
public Verifier(String value)
|
||||
{
|
||||
this.value = value;
|
||||
this.value = URLUtils.percentDecode(value);
|
||||
}
|
||||
|
||||
public String getValue()
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.scribe.model;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
public class VerifierTest
|
||||
{
|
||||
@Test
|
||||
public void shouldParse()
|
||||
{
|
||||
Verifier verifier = new Verifier("p8k%2BGIjIL9PblXq%2BpH6LmT9l");
|
||||
assertEquals(verifier.getValue(), "p8k+GIjIL9PblXq+pH6LmT9l");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void shouldThrowErrorForNullString()
|
||||
{
|
||||
new Verifier(null);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user