use of com.jcabi.github.PublicMembers in project jcabi-github by jcabi.
the class MkPublicMembersTest method checkPublicMembership.
/**
* MkPublicMembers can check whether a user is a public member.
* @throws Exception If some problem inside
*/
@Test
public void checkPublicMembership() throws Exception {
final MkOrganization org = organization();
final PublicMembers members = org.publicMembers();
final User user = org.github().users().get("agent99");
MatcherAssert.assertThat(members.iterate(), Matchers.emptyIterableOf(User.class));
org.addMember(user);
MatcherAssert.assertThat("The newly-added user is not a public member", !members.contains(user));
members.publicize(user);
MatcherAssert.assertThat("The user has been made a public member", members.contains(user));
MatcherAssert.assertThat(members.iterate(), Matchers.hasItem(user));
members.conceal(user);
MatcherAssert.assertThat("The concealed user is not a public member", !members.contains(user));
}
use of com.jcabi.github.PublicMembers in project jcabi-github by jcabi.
the class MkPublicMembersTest method iteratesPublicMembers.
/**
* MkPublicMembers can iterate over all public members.
* @throws Exception If some problem inside
*/
@Test
public void iteratesPublicMembers() throws Exception {
final MkOrganization org = organization();
final PublicMembers members = org.publicMembers();
final User user = org.github().users().get("jasmine");
MatcherAssert.assertThat(members.iterate(), Matchers.emptyIterableOf(User.class));
org.addMember(user);
MatcherAssert.assertThat(members.iterate(), Matchers.emptyIterableOf(User.class));
members.publicize(user);
MatcherAssert.assertThat(members.iterate(), Matchers.<User>iterableWithSize(1));
MatcherAssert.assertThat(members.iterate(), Matchers.hasItem(user));
members.conceal(user);
MatcherAssert.assertThat(members.iterate(), Matchers.emptyIterableOf(User.class));
}
use of com.jcabi.github.PublicMembers in project jcabi-github by jcabi.
the class MkPublicMembersTest method changesPublicityOfMembershipOfUsers.
/**
* MkPublicMembers can publicize/conceal a member's membership.
* @throws Exception If some problem inside
*/
@Test
public void changesPublicityOfMembershipOfUsers() throws Exception {
final MkOrganization org = organization();
final PublicMembers members = org.publicMembers();
final User user = org.github().users().get("johnny5");
org.addMember(user);
MatcherAssert.assertThat("Newly-added user is not a public member", !members.contains(user));
members.publicize(user);
MatcherAssert.assertThat("User has been made a public member", members.contains(user));
members.conceal(user);
MatcherAssert.assertThat("Concealed user is not a public member", !members.contains(user));
members.publicize(user);
MatcherAssert.assertThat("User has been made a public member again", members.contains(user));
}
Aggregations