}
public void testMethod3(TestHarness harness)
{
harness.checkPoint("(int, int, int, int, int, double[], DataBuffer)");
SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10,
20, new int[] { 224, 28, 3 });
DataBuffer db = m.createDataBuffer();
double[] samples = new double[6];
m.getSamples(1, 2, 2, 3, 1, samples, db);
harness.check(Arrays.equals(samples, new double[] {0, 0, 0, 0, 0, 0}));
m.setPixels(1, 2, 2, 3, new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18}, db);
m.getSamples(1, 2, 2, 3, 0, samples, db);
harness.check(Arrays.equals(samples, new double[] {1, 4, 7, 2, 5, 0}));
m.getSamples(1, 2, 2, 3, 1, samples, db);
harness.check(Arrays.equals(samples, new double[] {2, 5, 0, 3, 6, 1}));
m.getSamples(1, 2, 2, 3, 2, samples, db);
harness.check(Arrays.equals(samples, new double[] {3, 2, 1, 0, 3, 2}));
// if the incoming array is null, a new one is created
samples = m.getSamples(1, 2, 2, 3, 2, (double[]) null, db);
harness.check(Arrays.equals(samples, new double[] {3, 2, 1, 0, 3, 2}));
// try invalid band
boolean pass = false;
try
{
m.getSamples(1, 2, 2, 3, 3, samples, db);
}
catch (ArrayIndexOutOfBoundsException e)
{
pass = true;
}
harness.check(pass);
// try null data buffer
pass = false;
try
{
m.getSamples(1, 2, 2, 3, 0, samples, null);
}
catch (NullPointerException e)
{
pass = true;
}