@Test public void serviceReturnsDigest() throws Exception { String digest = LocalDigestValidator.SHA(SHARED_SECRET + TICKET, ENCODING, HASH_FUNCTION); String result = client.validateDigest(digest, TICKET, "myserviceurl", USER); String responsedigest = LocalDigestValidator.SHA(SHARED_SECRET + TICKET + USER, ENCODING, HASH_FUNCTION); assertEquals(responsedigest, result); }
@Test(expected = InvalidDigestException.class) public void serviceReturnsError() throws Exception { client.validateDigest("BAD_DIGEST", TICKET, "myserviceurl", USER); }
@Before public void setUp() { client.setHttpClient(new HttpClientMock()); }