Skip to content

Commit e48dd73

Browse files
committed
KernelConvolverFactoryTest: remove redundant tests
The tests are no longer needed, because they test the same functionality as ConvolverTest.
1 parent 63b4ea9 commit e48dd73

File tree

1 file changed

+1
-54
lines changed

1 file changed

+1
-54
lines changed

src/test/java/net/imglib2/algorithm/convolution/kernel/KernelConvolverFactoryTest.java

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -22,66 +22,13 @@
2222
public class KernelConvolverFactoryTest
2323
{
2424

25-
@Test
26-
public void testDoubleConvolver()
27-
{
28-
testConvolver( DoubleConvolverRealType.class );
29-
}
30-
31-
@Test
32-
public void testFloatConvolver()
33-
{
34-
testConvolver( FloatConvolverRealType.class );
35-
}
36-
37-
@Test
38-
public void testNativeConvolver()
39-
{
40-
testConvolver( ConvolverNativeType.class );
41-
}
42-
43-
@Test
44-
public void testNumericConvolver()
45-
{
46-
testConvolver( ConvolverNumericType.class );
47-
}
48-
49-
public void testConvolver( Class< ? extends Runnable > expectedConvolverClass )
50-
{
51-
try
52-
{
53-
double[] halfKernel = { 3, 2, 1 };
54-
double[] in = { 5, 0, 1, 0, 0, 0, 0, 0, 0, 0 };
55-
double[] expected = { 8, 2, 1, 0, 0, 0 };
56-
int lineLength = in.length - 2 * ( halfKernel.length - 1 );
57-
double[] actual = new double[ lineLength ];
58-
59-
Img< DoubleType > inImg = ArrayImgs.doubles( in, in.length );
60-
Img< DoubleType > outImg = ArrayImgs.doubles( actual, actual.length );
61-
Runnable convolver = expectedConvolverClass
62-
.getConstructor( Kernel1D.class, RandomAccess.class, RandomAccess.class, int.class, long.class )
63-
.newInstance( Kernel1D.symmetric( halfKernel ), inImg.randomAccess(), outImg.randomAccess(), 0, lineLength );
64-
convolver.run();
65-
assertArrayEquals( expected, actual, 0.0001 );
66-
}
67-
catch ( NoSuchMethodException e )
68-
{
69-
fail( "The class " + expectedConvolverClass.getSimpleName() + " misses the constructor needed for KernelConvolverFactory." );
70-
}
71-
catch ( IllegalAccessException | InstantiationException | InvocationTargetException e )
72-
{
73-
fail( "The constructor of class " + expectedConvolverClass.getSimpleName() + " must be public for class copying." );
74-
}
75-
}
76-
7725
@Test
7826
public void test()
7927
{
8028
testFactoryTypeMatching( DoubleConvolverRealType.class, ArrayImgs.doubles( 1 ) );
8129
testFactoryTypeMatching( FloatConvolverRealType.class, ArrayImgs.bytes( 1 ) );
8230
testFactoryTypeMatching( ConvolverNativeType.class, ArrayImgs.argbs( 1 ) );
83-
ListImg< ? extends NumericType< ? > > image = createImageOfNumericType();
84-
testFactoryTypeMatching( ConvolverNumericType.class, image );
31+
testFactoryTypeMatching( ConvolverNumericType.class, createImageOfNumericType() );
8532
}
8633

8734
private ListImg< ? extends NumericType< ? > > createImageOfNumericType()

0 commit comments

Comments
 (0)