AuthenticatedElement implements Addable<AuthenticatedElement> { @Override public AuthenticatedElement add(AuthenticatedElement other) { return new AuthenticatedElement(share.add(other.share), mac.add(other.mac)); } AuthenticatedElement(FieldElement share, FieldElement mac); @Override AuthenticatedElement add(AuthenticatedElement other); AuthenticatedElement add(
      FieldDefinition fieldDefinition,
      FieldElement other, int partyId, FieldElement macKeyShare); AuthenticatedElement subtract(AuthenticatedElement other); AuthenticatedElement multiply(FieldElement constant); FieldElement getMac(); FieldElement getShare(); @Override String toString();  }
@Test public void testAddPublicFieldElement() { FieldElement macKeyShare = definition.createElement(111); AuthenticatedElement element = new AuthenticatedElement( definition.createElement(2), definition.createElement(222)); FieldElement publicElement = definition.createElement(44); AuthenticatedElement actualPartyOne = element.add(definition, publicElement, 1, macKeyShare); AuthenticatedElement expectedPartyOne = new AuthenticatedElement( definition.createElement(46), definition.createElement(86)); AuthenticatedElement actualPartyTwo = element.add(definition, publicElement, 2, macKeyShare); AuthenticatedElement expectedPartyTwo = new AuthenticatedElement( definition.createElement(2), definition.createElement(86)); CustomAsserts.assertEquals(definition, actualPartyOne, expectedPartyOne); CustomAsserts.assertEquals(definition, actualPartyTwo, expectedPartyTwo); }