Gq implements Identifiable, Group<Gq> { @Override public Group.Element<Gq> getRandomElement() { Z field = new Z(q); return getGenerator().exponentiate(field.getRandomElement()); } Gq(GqSetup setup); @Override Group.Element<Gq> getIdentityElement(); @Override Group.Element<Gq> getGenerator(); @Override String getIdentity(); @Override Group.Element<Gq> getRandomElement();  }
@Test public void shouldBeAbleToReturnARandomElementOfTheGroup() { Group.Element<Gq> element = group.getRandomElement(); assertEquals(group, element.getGroup()); }