Class AbstractTestRest


  • public abstract class AbstractTestRest
    extends AbstractRestRefLog
    Base test class for Nessie REST APIs.

    Base class organization

    (See below for reasons)

    This abstract test class represents the base test class for Jersey based tests and tests in Quarkus.

    Every base class must extend each other, as a rule of thumb, maintain alphabetical order.

    Another rule of thumb: when a class reaches ~ 500 LoC, split it, when it makes sense.

    Reasons for the "chain of base classes"

    Tests have been moved to base classes so that this class is not a "monster of couple thousand lines of code".

    Splitting AbstractTestRest into separate classes and including those via @Nested with plain JUnit 5 works fine. But it does not work as a @QuarkusTest for several reasons.

    Using @Nested test classes like this does not work, because Quarkus considers the non-static inner classes as a separate test classes and fails horribly, mostly complaining that the inner test class is not in one of the expected class folders.

    Even worse is that the whole Quarkus machinery is started for each nested test class and not just for the actual test class.

    As an alternative it felt doable to refactor the former inner classes to interfaces (so test methods become default methods), but that does not work as well due to an NPE, when QuarkusSecurityTestExtension.beforeEach tries to find the @TestSecurity annotation - it just asserts whether the current Class is != Object.class, but Class.getSuperclass() returns null for interfaces - hence the NPE there.

    The "solution" here is to keep the separate classes but let each extend another - so different groups of tests are kept in a single class.

    • Constructor Detail

      • AbstractTestRest

        public AbstractTestRest()