NodeType implements Serializable { @Nullable Constructor getConstructor() { for (Constructor constructor : nodeClass.getConstructors()) { Class[] types = constructor.getParameterTypes(); if (types.length < 1) { continue; } int pointer = 0; if(Parameters.class.isAssignableFrom(types[pointer])){ pointer++; } if (!NodeParameters.class.isAssignableFrom(types[pointer])) { continue; } pointer++; boolean validTypes = true; for (int i = pointer; i < types.length; ++i) { if (!isIteratorOrArray(types[i])) { validTypes = false; break; } } if (validTypes) { return constructor; } } return null; } NodeType(Class<? extends BaseIterator> nodeClass); Class<? extends BaseIterator> getIteratorClass(); Class<?>[] getInputs(); Class<?>[] getParameterTypes(int length); boolean isIteratorOrArray(Class c); String toString();  }
@Test public void testGetConstructor() throws Exception { NodeType n = new NodeType(FakeIterator.class); Constructor c = n.getConstructor(); Constructor actual = FakeIterator.class.getConstructor(NodeParameters.class, ExtentIterator.class, new ScoreIterator[0].getClass()); assertEquals(actual, c); }