|
23 | 23 | import java.lang.annotation.Annotation; |
24 | 24 | import java.lang.reflect.InvocationTargetException; |
25 | 25 | import java.lang.reflect.Method; |
26 | | -import java.net.MalformedURLException; |
27 | | -import java.net.URL; |
| 26 | +import java.net.URI; |
28 | 27 | import java.nio.file.Files; |
29 | 28 | import java.nio.file.Path; |
30 | 29 | import java.nio.file.Paths; |
@@ -460,11 +459,7 @@ public ApplicationContainer withMpRestClient(Class<?> restClientClass, String ho |
460 | 459 | if (!restClientClass.isInterface()) { |
461 | 460 | throw new IllegalArgumentException("Provided restClientClass " + restClientClass.getCanonicalName() + " must be an interface"); |
462 | 461 | } |
463 | | - try { |
464 | | - new URL(hostUrl); |
465 | | - } catch (MalformedURLException e) { |
466 | | - throw new IllegalArgumentException(e); |
467 | | - } |
| 462 | + URI.create(hostUrl); |
468 | 463 | String configToken = readMpRestClientConfigKey(restClientClass); |
469 | 464 | if (configToken == null || configToken.isEmpty()) |
470 | 465 | configToken = restClientClass.getCanonicalName(); |
@@ -524,14 +519,20 @@ public ApplicationContainer withMpRestClient(String restClientClass, String host |
524 | 519 | } else { |
525 | 520 | restClientClass += "/mp-rest/url"; |
526 | 521 | } |
527 | | - try { |
528 | | - new URL(hostUrl); |
529 | | - } catch (MalformedURLException e) { |
530 | | - throw new IllegalArgumentException(e); |
531 | | - } |
| 522 | + URI.create(hostUrl); |
532 | 523 | return withEnv(restClientClass, hostUrl); |
533 | 524 | } |
534 | 525 |
|
| 526 | + @Override |
| 527 | + public ApplicationContainer withReuse(boolean reusable) { |
| 528 | + if (reusable) { |
| 529 | + throw new UnsupportedOperationException("Container reuse is not supported for ApplicationContainer. " + |
| 530 | + "Instead, see HollowTestContainersConfiguration documentation: " + |
| 531 | + "https://microshed.org/microshed-testing/features/ApplicationEnvironment.html"); |
| 532 | + } |
| 533 | + return super.withReuse(reusable); |
| 534 | + } |
| 535 | + |
535 | 536 | /** |
536 | 537 | * @return The URL where the application is currently running at. The application URL is comprised |
537 | 538 | * of the baseURL (as defined by {@link #getBaseURL()}) concatenated with the appContextRoot (as defined |
|
0 commit comments