OAuth1aToken { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof OAuth1aToken)) { return false; } final OAuth1aToken that = (OAuth1aToken) o; boolean equals = Objects.equals(realm, that.realm); equals &= consumerKey.equals(that.consumerKey); equals &= token.equals(that.token); equals &= signatureMethod.equals(that.signatureMethod); equals &= signature.equals(that.signature); equals &= timestamp.equals(that.timestamp); equals &= nonce.equals(that.nonce); equals &= version.equals(that.version); equals &= Objects.equals(additionals, that.additionals); return equals; } OAuth1aToken(String consumerKey, String token, String signatureMethod, String signature,
                 String timestamp, String nonce, String version, Map<String, String> additionals,
                 @Nullable String realm); static OAuth1aTokenBuilder builder(); @Nullable String realm(); String consumerKey(); String token(); String signatureMethod(); String signature(); String timestamp(); String nonce(); String version(); Map<String, String> additionals(); String asHeaderValue(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override String toString();  }
@Test void testEquals() { final OAuth1aToken token = OAuth1aToken.builder() .consumerKey("a") .token("b") .signatureMethod("c") .signature("d") .timestamp("0") .nonce("f") .put("x-others", "g") .build(); final ImmutableMap.Builder<String, String> paramsBuilder = ImmutableMap.builder(); paramsBuilder.put("oauth_consumer_key", "a"); paramsBuilder.put("oauth_token", "b"); paramsBuilder.put("oauth_signature_method", "c"); paramsBuilder.put("oauth_signature", "d"); paramsBuilder.put("oauth_timestamp", "0"); paramsBuilder.put("oauth_nonce", "f"); paramsBuilder.put("x-others", "g"); assertThat(token).isEqualTo(OAuth1aToken.builder().putAll(paramsBuilder.build()).build()); assertThat(token).isNotEqualTo(OAuth1aToken.builder() .consumerKey("a") .token("b") .signatureMethod("c") .signature("d") .timestamp("0") .nonce("f") .build()); assertThat(token).isNotEqualTo(OAuth1aToken.builder() .consumerKey("a") .token("b") .signatureMethod("c") .signature("d") .timestamp("0") .nonce("f") .putAll(ImmutableMap.of("x-others", "g", "x-others-2", "h")) .build()); }