JBBPFieldArrayUShort extends JBBPAbstractArrayField<JBBPFieldUShort> implements JBBPNumericArray { @Override public JBBPFieldUShort getElementAt(final int index) { final JBBPFieldUShort result = new JBBPFieldUShort(this.fieldNameInfo, this.array[index]); result.payload = this.payload; return result; } JBBPFieldArrayUShort(final JBBPNamedFieldInfo name, final short[] array); short[] getArray(); @Override int size(); @Override JBBPFieldUShort getElementAt(final int index); @Override int getAsInt(final int index); @Override long getAsLong(final int index); @Override boolean getAsBool(final int index); @Override Object getValueArrayAsObject(final boolean reverseBits); @Override String getTypeAsString();  }
@Test public void testGetElementAt() { final int[] etalon = new int[] {-27834 & 0xFFFF, 23423, 0, -2 & 0xFFFF, 3}; final Serializable payload = new FakePayload(); test.setPayload(payload); for (int i = 0; i < etalon.length; i++) { final JBBPFieldUShort f = test.getElementAt(i); assertSame(payload, f.getPayload()); assertEquals(etalon[i], f.getAsInt()); } }