@@ -212,11 +212,15 @@ public void testGetJarVersionWithNoVersion() throws Exception {
212212 */
213213 @ Test
214214 public void testServerInfoOutputWithApr () throws Exception {
215- // Only run this test if APR is available
216- Assume .assumeTrue ("APR not available" , AprLifecycleListener .isAprAvailable ());
217-
218215 String output = captureServerInfoOutput ();
219216
217+ /*
218+ * APR is not initialised (if present) until the version info is captured. Therefore, this test needs to made
219+ * after the Server info has been collected.
220+ */
221+ // Only run this test if APR is available - only know this after ServerInfo has nee
222+ Assume .assumeTrue ("APR not available" , AprLifecycleListener .isAprAvailable ());
223+
220224 // Check for APR-specific output
221225 Assert .assertTrue ("Should contain 'APR loaded: true'" , output .contains ("APR loaded: true" ));
222226 Assert .assertTrue ("Should contain APR Version" , output .contains ("APR Version:" ));
@@ -276,11 +280,14 @@ public void testServerInfoOutputWithoutNativeLibraries() throws Exception {
276280 */
277281 @ Test
278282 public void testAprVersionInfo () throws Exception {
279- // Only run if APR is available
280- Assume .assumeTrue ("APR not available" , AprLifecycleListener .isAprAvailable ());
281-
282283 String output = captureServerInfoOutput ();
283284
285+ /*
286+ * APR is not initialised (if present) until the version info is captured. Therefore, this test needs to made
287+ * after the Server info has been collected.
288+ */
289+ Assume .assumeTrue ("APR not available" , AprLifecycleListener .isAprAvailable ());
290+
284291 // Verify version info format (should contain version numbers)
285292 String [] lines = output .split ("\n " );
286293 boolean foundAprVersion = false ;
@@ -313,7 +320,12 @@ public void testAprVersionInfo() throws Exception {
313320 */
314321 @ Test
315322 public void testTomcatNativeVersionWarningWithRealVersion () throws Exception {
316- // Only run if APR is available
323+ captureServerInfoOutput ();
324+
325+ /*
326+ * APR is not initialised (if present) until the version info is captured. Therefore, this test needs to made
327+ * after the Server info has been collected.
328+ */
317329 Assume .assumeTrue ("APR not available" , AprLifecycleListener .isAprAvailable ());
318330
319331 // If APR is available, getTcnVersionWarning() should return non-null if version is old,
0 commit comments