flags in IT.java base classes like protected boolean subclassHasFeatureX = true;
+
tests for that flag in the base class e.g. assumeTrue("Test huge row key write", hugeRowKey)
+
setting of said flag in concrete subclasses e.g. this.subclassHasFeatureX = false;
with:
remove the flag
keep the test in the base class but move the body of the test to a virtual method e.g.
@Test
public void FeatureXTest() {
FeatureXTestImpl();
}
public void FeatureXTestImpl() {
// test guts
}
1. in subclasses that ***do not*** support FeatureX, override `FeatureTestImpl` to be a no-op:
```java
@Override
public void FeatureXTestImpl() { /* no-op */ }
et voila
no more flags or run time exceptions if the developer forgets that the subclass doesn't support feature X.
or in more mechanical terms:
replace:
flags in IT.java base classes like
protected boolean subclassHasFeatureX = true;
+ tests for that flag in the base class e.g.assumeTrue("Test huge row key write", hugeRowKey)
+ setting of said flag in concrete subclasses e.g.this.subclassHasFeatureX = false;
with:
public void FeatureXTestImpl() { // test guts }
et voila
no more flags or run time exceptions if the developer forgets that the subclass doesn't support feature X.
See the original comment here.