public void testSetValueWithWrongType() {
   // rejects illegal type?
   try {
     _attributeInt.setDataElems("5");
     fail("IllegalArgumentException expected");
   } catch (IllegalArgumentException e) {
   }
 }
  public void testSetData() {

    try {
      _attributeInt.setDataElems(null);
      fail("IllegalArgumentException expected because data is null");
    } catch (IllegalArgumentException e) {
    }

    // null --> new value: is modified ?
    _attributeInt.setDataElems(new int[] {1, 2, 3});
    assertEquals(true, Arrays.equals(new int[] {1, 2, 3}, (int[]) _attributeInt.getDataElems()));
    assertEquals(true, _attributeInt.isModified());

    // old value == new value?
    _attributeInt.setDataElems(new int[] {1, 2, 3});
    assertEquals(true, Arrays.equals(new int[] {1, 2, 3}, (int[]) _attributeInt.getDataElems()));
    assertEquals(true, _attributeInt.isModified());
  }
 /**
  * Adds a new coding value to this sample coding.
  *
  * @param name the coding name
  * @param values the values
  * @param description the description text
  * @throws IllegalArgumentException if <code>name</code> is null
  * @return A new attribute representing the coded sample.
  */
 public MetadataAttribute addSamples(String name, int[] values, String description) {
   Guardian.assertNotNull("name", name);
   final ProductData productData =
       ProductData.createInstance(ProductData.TYPE_INT32, values.length);
   MetadataAttribute attribute = new MetadataAttribute(name, productData, false);
   attribute.setDataElems(values);
   if (description != null) {
     attribute.setDescription(description);
   }
   addAttribute(attribute);
   return attribute;
 }