AutoRegisteredBaseAuthValve extends BaseAuthValve implements InitializingBean, DisposableBean { public void afterPropertiesSet() { initialize(); removeValve(authPipeline); addValve(authPipeline, position, positionAfter, positionBefore); }  void afterPropertiesSet(); @Override void destroy(); void setAuthPipeline(GenericPipeline authPipeline); void setPosition(int position); void setPositionAfter(String positionAfter); void setPositionBefore(String positionBefore);  }
@Test public void testPositionAtTheEnd() { int count = pipeline.getValves().length; MyAuthValve myValve = new MyAuthValve("myAuthValve1", pipeline); myValve.afterPropertiesSet(); assertEquals("Valve count is wrong", count + 1, pipeline.getValves().length); assertEquals("Valve is not appended to the end", pipeline.getValves().length - 1, getPosition(myValve.getId())); count = pipeline.getValves().length; myValve.afterPropertiesSet(); assertEquals("Valve count is wrong", count, pipeline.getValves().length); assertEquals("Valve is not at the end", count - 1, getPosition(myValve.getId())); }