assertEquals("baz", args.getRequestOption("quux"));
}
@Test
public void testParseUseToken() throws Exception {
FakeHttpServletRequest req = new FakeHttpServletRequest();
req.setParameter("OAUTH_USE_TOKEN", "ALWAYS");
OAuthArguments args = new OAuthArguments(AuthType.SIGNED, req);
assertEquals(UseToken.ALWAYS, args.getUseToken());
req.setParameter("OAUTH_USE_TOKEN", "if_available");
args = new OAuthArguments(AuthType.SIGNED, req);
assertEquals(UseToken.IF_AVAILABLE, args.getUseToken());
req.setParameter("OAUTH_USE_TOKEN", "never");
args = new OAuthArguments(AuthType.SIGNED, req);
assertEquals(UseToken.NEVER, args.getUseToken());
req.setParameter("OAUTH_USE_TOKEN", "");
args = new OAuthArguments(AuthType.SIGNED, req);
assertEquals(UseToken.NEVER, args.getUseToken());
req.setParameter("OAUTH_USE_TOKEN", "");
args = new OAuthArguments(AuthType.OAUTH, req);
assertEquals(UseToken.ALWAYS, args.getUseToken());
try {
req.setParameter("OAUTH_USE_TOKEN", "stuff");
new OAuthArguments(AuthType.OAUTH, req);
fail("Should have thrown");
} catch (GadgetException e) {
// good.
}