private AttributeModifier getModifierCopy(WrappedAttributeModifier modifier) {
   return new AttributeModifier(
       modifier.getUUID(),
       modifier.getName(),
       modifier.getAmount(),
       modifier.getOperation().getId());
 }
  @Test
  public void testAttribute() {
    assertEquals(attribute, WrappedAttribute.fromHandle(getAttributeCopy(attribute)));

    assertTrue(attribute.hasModifier(doubleModifier.getUUID()));
    assertTrue(attribute.hasModifier(constantModifier.getUUID()));
  }
  @Before
  public void setUp() {
    // Create a couple of modifiers
    doubleModifier =
        WrappedAttributeModifier.newBuilder()
            .name("Double Damage")
            .amount(1)
            .operation(Operation.ADD_PERCENTAGE)
            .build();
    constantModifier =
        WrappedAttributeModifier.newBuilder()
            .name("Damage Bonus")
            .amount(5)
            .operation(Operation.ADD_NUMBER)
            .build();

    // Create attribute
    attribute =
        WrappedAttribute.newBuilder()
            .attributeKey("generic.attackDamage")
            .baseValue(2)
            .packet(new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES))
            .modifiers(Lists.newArrayList(constantModifier, doubleModifier))
            .build();
  }
  @Test
  public void testEquality() {
    // Check wrapped equality
    assertEquals(doubleModifier, doubleModifier);
    assertNotSame(constantModifier, doubleModifier);

    assertEquals(doubleModifier.getHandle(), getModifierCopy(doubleModifier));
    assertEquals(constantModifier.getHandle(), getModifierCopy(constantModifier));
  }
  /**
   * Retrieve the equivalent NMS attribute.
   *
   * @param attribute - the wrapped attribute.
   * @return The equivalent NMS attribute.
   */
  private AttributeSnapshot getAttributeCopy(WrappedAttribute attribute) {
    List<AttributeModifier> modifiers = Lists.newArrayList();

    for (WrappedAttributeModifier wrapper : attribute.getModifiers()) {
      modifiers.add((AttributeModifier) wrapper.getHandle());
    }

    PacketPlayOutUpdateAttributes accessor = new PacketPlayOutUpdateAttributes();
    return accessor
    .new AttributeSnapshot(attribute.getAttributeKey(), attribute.getBaseValue(), modifiers);
  }