test: output users array on anonymous failure

See elastic/elasticsearch#2773

Original commit: elastic/x-pack-elasticsearch@24871ee1ea
This commit is contained in:
jaymode 2016-07-11 09:49:26 -04:00
parent 9dab9eb762
commit c364a71310
1 changed files with 3 additions and 2 deletions

View File

@ -91,10 +91,11 @@ public class TransportGetUsersActionTests extends ESTestCase {
assertThat(throwableRef.get(), is(nullValue()));
assertThat(responseRef.get(), is(notNullValue()));
final User[] users = responseRef.get().users();
if (anonymousEnabled) {
assertThat(responseRef.get().users(), arrayContaining(AnonymousUser.INSTANCE));
assertThat("expected array with anonymous but got: " + Arrays.toString(users), users, arrayContaining(AnonymousUser.INSTANCE));
} else {
assertThat(responseRef.get().users(), emptyArray());
assertThat("expected an empty array but got: " + Arrays.toString(users), users, emptyArray());
}
verifyZeroInteractions(usersStore);
}