### Question:
DefaultOAuthStore implements OAuthStore { @Override public ConsumerInfo getConsumerKeyAndSecret(SecurityToken securityToken, String serviceName, OAuthServiceProvider provider) throws GadgetException { String gadgetUri = securityToken.getAppUrl(); OAuthConsumerStore consumerStore = consumerStoreService.findByUriAndServiceName(gadgetUri, serviceName); if (consumerStore == null) { return null; } OAuthConsumer consumer = createOAuthConsumer(provider, consumerStore); String callbackUrl = (consumerStore.getCallbackUrl() != null ? consumerStore.getCallbackUrl() : defaultCallbackUrl); return new ConsumerInfo(consumer, consumerStore.getKeyName(), callbackUrl); } DefaultOAuthStore(String defaultCallbackUrl,
                             String pathToPrivateKey,
                             String privateKeyName); @Override ConsumerInfo getConsumerKeyAndSecret(SecurityToken securityToken, String serviceName,
                                                OAuthServiceProvider provider); @Override TokenInfo getTokenInfo(SecurityToken securityToken, ConsumerInfo consumerInfo, String serviceName,
                                  String tokenName); @Override void setTokenInfo(SecurityToken securityToken, ConsumerInfo consumerInfo, String serviceName,
                             String tokenName, TokenInfo tokenInfo); @Override void removeToken(SecurityToken securityToken, ConsumerInfo consumerInfo, String serviceName,
                            String tokenName);  }### Answer:
@Test public void testGetConsumerKeyAndSecret() throws Exception { OAuthConsumerStore consumerStore = new OAuthConsumerStoreImpl(); consumerStore.setGadgetUri(GADGET_URI); consumerStore.setConsumerKey("gadgetConsumer"); consumerStore.setConsumerSecret(CONSUMER_SECRET); consumerStore.setKeyType(OAuthConsumerStore.KeyType.HMAC_SYMMETRIC); OAuthServiceProvider provider = new OAuthServiceProvider(null, null, null); expect(consumerStoreService.findByUriAndServiceName(GADGET_URI, SERVICE_NAME)) .andReturn(consumerStore); replay(consumerStoreService); final OAuthStore.ConsumerInfo keyAndSecret = oAuthStore.getConsumerKeyAndSecret(token, SERVICE_NAME, provider); assertNotNull(keyAndSecret); assertEquals(OAuth.HMAC_SHA1, keyAndSecret.getConsumer().getProperty( OAuth.OAUTH_SIGNATURE_METHOD)); verify(consumerStoreService); }