@Override public boolean equals(Object obj) { if (!(obj instanceof UserCredentials)) { return false; } UserCredentials other = (UserCredentials) obj; return super.equals(other) && Objects.equals(this.clientId, other.clientId) && Objects.equals(this.clientSecret, other.clientSecret) && Objects.equals(this.refreshToken, other.refreshToken) && Objects.equals(this.tokenServerUri, other.tokenServerUri) && Objects.equals(this.transportFactoryClassName, other.transportFactoryClassName); }
@Override public boolean equals(Object obj) { if (!(obj instanceof UserCredentials)) { return false; } UserCredentials other = (UserCredentials) obj; return super.equals(other) && Objects.equals(this.clientId, other.clientId) && Objects.equals(this.clientSecret, other.clientSecret) && Objects.equals(this.refreshToken, other.refreshToken) && Objects.equals(this.tokenServerUri, other.tokenServerUri) && Objects.equals(this.transportFactoryClassName, other.transportFactoryClassName); }
@Test public void equals_true() throws IOException { GoogleCredentials credentials = new TestAppEngineCredentials(SCOPES); GoogleCredentials otherCredentials = new TestAppEngineCredentials(SCOPES); assertTrue(credentials.equals(credentials)); assertTrue(credentials.equals(otherCredentials)); assertTrue(otherCredentials.equals(credentials)); }
@Test public void equals_true() throws IOException { GoogleCredentials credentials = CloudShellCredentials.newBuilder() .setAuthPort(42) .build(); GoogleCredentials otherCredentials = CloudShellCredentials.newBuilder() .setAuthPort(42) .build(); assertTrue(credentials.equals(otherCredentials)); assertTrue(otherCredentials.equals(credentials)); }
@Test public void equals_false_authPort() throws IOException { GoogleCredentials credentials = CloudShellCredentials.newBuilder() .setAuthPort(42) .build(); GoogleCredentials otherCredentials = CloudShellCredentials.newBuilder() .setAuthPort(43) .build(); assertFalse(credentials.equals(otherCredentials)); assertFalse(otherCredentials.equals(credentials)); }