/** Test method for {@link GroupElement#isOnCurve(Curve)}. */
 @Test
 public void testIsOnCurve() {
   assertThat(P2_ZERO.isOnCurve(curve), is(true));
   assertThat(GroupElement.p2(curve, ZERO, ZERO, ONE).isOnCurve(curve), is(false));
   assertThat(GroupElement.p2(curve, ONE, ONE, ONE).isOnCurve(curve), is(false));
   assertThat(GroupElement.p2(curve, TEN, ZERO, ONE).isOnCurve(curve), is(false));
   assertThat(GroupElement.p2(curve, ONE, TEN, ONE).isOnCurve(curve), is(false));
   assertThat(GroupElement.p2(curve, PKR[0], PKR[1], ONE).isOnCurve(curve), is(true));
 }
  @Test
  public void isOnCurveReturnsTrueForPointsOnTheCurve() {
    for (int i = 0; i < 100; i++) {
      // Arrange:
      final GroupElement g = MathUtils.getRandomGroupElement();

      // Assert:
      Assert.assertThat(g.isOnCurve(), IsEqual.equalTo(true));
    }
  }
  @Test
  public void isOnCurveReturnsFalseForPointsNotOnTheCurve() {
    for (int i = 0; i < 100; i++) {
      // Arrange:
      final GroupElement g = MathUtils.getRandomGroupElement();
      final GroupElement h =
          GroupElement.p2(curve, g.getX(), g.getY(), g.getZ().multiply(curve.getField().TWO));

      // Assert (can only fail for 5*Z^2=1):
      Assert.assertThat(h.isOnCurve(), IsEqual.equalTo(false));
    }
  }