コード例 #1
0
  @Test
  public void verifyEqualsWithTrue() throws Exception {
    final HttpBasedServiceCredential c =
        new HttpBasedServiceCredential(
            new URL("http://www.cnn.com"),
            RegisteredServiceTestUtils.getRegisteredService("https://some.app.edu"));
    final HttpBasedServiceCredential c2 =
        new HttpBasedServiceCredential(
            new URL("http://www.cnn.com"),
            RegisteredServiceTestUtils.getRegisteredService("https://some.app.edu"));

    assertTrue(c.equals(c2));
    assertTrue(c2.equals(c));
  }
コード例 #2
0
  @Test
  public void verifyEqualsWithFalse() throws Exception {
    final HttpBasedServiceCredential c =
        new HttpBasedServiceCredential(
            new URL("http://www.cnn.com"),
            CoreAuthenticationTestUtils.getRegisteredService("https://some.app.edu"));
    final HttpBasedServiceCredential c2 =
        new HttpBasedServiceCredential(
            new URL("http://www.msn.com"),
            CoreAuthenticationTestUtils.getRegisteredService("https://some.app.edu"));

    assertFalse(c.equals(c2));
    assertFalse(c.equals(new Object()));
  }