Tests for WICKET-4831

Added unit test with expected output