OAuthToken { public EncodedPair getAttribute(String name) { if(attributes.containsKey(name)) { return Pairs.toPreEncodedPair(name, attributes.get(name)); }else{ return null; } } OAuthToken(String token, String secret);  OAuthToken(String token, String secret, Map<String,String> attributes); String getToken(); String getSecret(); EncodedPair getAttribute(String name); Map<String,String> getAttributes(); @Override String toString();  }
@Test public void shouldReturnNullPairIfAttributeNotFound() { assertNull(toTest.getAttribute("attr3")); }
@Test public void shouldReturnPairIfAttributeFound() { EncodedPair actual = toTest.getAttribute("attr2"); assertNotNull(actual); assertEquals("attr2", actual.getName()); assertEquals("val%202", actual.getValue()); }