when(dfs.getDelegationToken(eq(new Text(LONG_NAME)))).thenReturn(t);
// Now, actually let the TokenFetcher go fetch the token.
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
out = new DataOutputStream(baos);
new DelegationTokenFetcher(dfs, out, ugi, conf).go();
// now read the data back in and verify correct values
Credentials ts = new Credentials();
DataInputStream dis =
new DataInputStream(new ByteArrayInputStream(baos.toByteArray()));