/**
   * Test method for {@link
   * at.ac.tuwien.auto.calimero.dptxlator.DPTXlatorString#setValues(java.lang.String[])}.
   *
   * @throws KNXFormatException
   */
  public final void testSetValues() throws KNXFormatException {
    t.setValues(strings);
    String[] ret = t.getAllValues();
    assertArrayEquals(strings, ret);

    String[] buf = new String[] {t.getValue(), t.getValue()};
    t.setValues(buf);
    ret = t.getAllValues();
    assertArrayEquals(buf, ret);

    buf = new String[] {empty, max};
    t.setValues(buf);
    ret = t.getAllValues();
    assertArrayEquals(buf, ret);

    try {
      t.setValues(new String[] {"ok", "tooooooooo long"});
    } catch (final KNXFormatException e) {
    }
    assertArrayEquals(buf, t.getAllValues());
  }
  /**
   * Test method for {@link at.ac.tuwien.auto.calimero.dptxlator.DPTXlatorString#setData(byte[],
   * int)}.
   */
  public final void testSetDataByteArrayInt() {
    t.setData(data, 0);
    t.setData(new byte[] {}, 0);
    assertTrue(Arrays.equals(data, t.getData()));
    final byte[] dataOffset = new byte[28];
    System.arraycopy(data1, 0, dataOffset, 3, data1.length);
    t.setData(dataOffset, 3);
    byte[] d = t.getData();
    assertEquals(14, d.length);
    assertTrue(Arrays.equals(data1, d));

    final byte[] array = new byte[data.length + 8];
    System.arraycopy(data, 0, array, 1, data.length);
    t.setData(array, 1);
    d = t.getData();
    assertEquals(data.length, d.length);
    assertTrue(Arrays.equals(data, d));
    assertArrayEquals(strings, t.getAllValues());
  }
  /**
   * Test method for {@link at.ac.tuwien.auto.calimero.dptxlator.DPTXlatorString#getData(byte[],
   * int)}.
   *
   * @throws KNXFormatException
   */
  public final void testGetDataByteArrayInt() throws KNXFormatException {
    assertEquals(25, t.getData(new byte[25], 4).length);
    final byte[] buf = new byte[20];
    assertTrue(Arrays.equals(buf, t.getData(new byte[20], 3)));

    t.setData(data);
    byte[] d = new byte[45];
    Arrays.fill(d, (byte) 0xCC);
    t.getData(d, 2);
    for (int i = 0; i < 2; i++) assertEquals((byte) 0xCC, d[i]);
    for (int i = 2; i < 44; i++) assertEquals(data[i - 2], d[i]);
    for (int i = 44; i < 45; i++) assertEquals((byte) 0xCC, d[i]);

    for (int i = 0; i < strings.length; i++) {
      t.setValue(strings[i]);
      d = t.getData(new byte[14 + i], i);
      for (int k = 0; k < 14; ++k) assertEquals(data[14 * i + k], d[i + k]);
    }
  }
 /** Test method for {@link at.ac.tuwien.auto.calimero.dptxlator.DPTXlatorString#getSubTypes()}. */
 public final void testGetSubTypes() {
   assertEquals(2, t.getSubTypes().size());
   t.getSubTypes().containsKey(DPTXlatorString.DPT_STRING_ASCII.getID());
   t.getSubTypes().containsKey(DPTXlatorString.DPT_STRING_8859_1.getID());
 }
  /**
   * Test method for {@link
   * at.ac.tuwien.auto.calimero.dptxlator.DPTXlatorString#setValue(java.lang.String)}.
   *
   * @throws KNXFormatException
   */
  public final void testSetValue() throws KNXFormatException {
    t.setValue(string1);
    assertEquals(string1, t.getValue());
    final String s = t.getValue();
    t.setValue(s);
    assertEquals(string1, t.getValue());
    assertEquals(s, t.getValue());
    t.setValue(empty);
    assertEquals(empty, t.getValue());
    assertTrue(Arrays.equals(dataEmpty, t.getData()));
    t.setValue(max);
    assertEquals(max, t.getValue());

    try {
      t.setValue("tooooooooo long");
    } catch (final KNXFormatException e) {
    }
    assertEquals(max, t.getValue());

    final DPTXlatorString t2 = new DPTXlatorString(DPTXlatorString.DPT_STRING_ASCII);
    t2.setValue(nonASCII);
    assertEquals("ab?cd?ef", t2.getValue());
    final byte[] nonAsciiData = t2.getData();
    final byte[] expected = {
      (byte) 'a',
      (byte) 'b',
      (byte) '?',
      (byte) 'c',
      (byte) 'd',
      (byte) '?',
      (byte) 'e',
      (byte) 'f',
      0,
      0,
      0,
      0,
      0,
      0
    };
    assertTrue(Arrays.equals(expected, nonAsciiData));

    t.setValue(nonASCII);
    assertEquals(nonASCII, t.getValue());

    t.setValue(nonLatin);
    assertEquals("ab?cd?", t.getValue());

    t2.setValue(nonLatin);
    assertEquals("ab?cd?", t.getValue());
  }
  /**
   * Test method for {@link at.ac.tuwien.auto.calimero.dptxlator.DPTXlatorString#getAllValues()}.
   *
   * @throws KNXFormatException
   */
  public final void testGetAllValues() throws KNXFormatException {
    assertEquals(1, t.getItems());
    assertEquals(t.getItems(), t.getItems());
    assertEquals(empty, t.getAllValues()[0]);

    t.setData(data);
    assertArrayEquals(strings, t.getAllValues());
    assertEquals(t.getItems(), t.getItems());

    t.setValue(string1);
    assertEquals(1, t.getItems());
    assertEquals(string1, t.getAllValues()[0]);
  }