@Test public void testUpdate() throws Throwable { Feature f = new FeatureMicLevel(null); byte data[] = new byte[] {1, 2, 3}; UpdateFeatureUtil.callUpdate(f, 1, data, 0); Assert.assertEquals( new Feature.Sample(1, new Byte[] {data[0], data[1], data[2]}, new Field[] {}), f.getSample()); Assert.assertEquals(data.length, f.getFieldsDesc().length); }
@Test public void testUpdateOffset() throws Throwable { Feature f = new FeatureMicLevel(null); byte data[] = new byte[] {0, 0, 0, 1, 2, 3}; UpdateFeatureUtil.callUpdate(f, 2, data, 3); Assert.assertEquals( new Feature.Sample(2, new Byte[] {data[3], data[4], data[5]}, new Field[] {}), f.getSample()); Assert.assertEquals(data.length - 3, f.getFieldsDesc().length); }
@Test(expected = IllegalArgumentException.class) public void updateWithInvalidSizeWithOffset() throws Throwable { Feature f = new FeatureMicLevel(null); UpdateFeatureUtil.callUpdate(f, 100, new byte[] {1, 2, 3}, 3); }