From f03e351c9f481aa5c81cf674b9709d1d8d7446f3 Mon Sep 17 00:00:00 2001
From: "Vladimir V. Bychkov"
Date: Fri, 28 Oct 2022 12:30:37 +0200
Subject: [PATCH] JUnit tests actualized: 4 -> 5
---
.../src/test/java/MyResourceTest.java | 4 +-
.../resources/archetype-resources/pom.xml | 7 +-
.../src/test/java/MyResourceTest.java | 12 +-
.../jersey/apache/connector/AsyncTest.java | 12 +-
.../jersey/apache/connector/AuthTest.java | 18 +-
.../jersey/apache/connector/CookieTest.java | 12 +-
.../apache/connector/CustomLoggingFilter.java | 12 +-
.../connector/DisableContentEncodingTest.java | 6 +-
.../apache/connector/FollowRedirectsTest.java | 6 +-
.../connector/GZIPContentEncodingTest.java | 6 +-
.../apache/connector/HelloWorldTest.java | 20 +-
.../apache/connector/HttpEntityTest.java | 14 +-
.../apache/connector/HttpHeadersTest.java | 8 +-
.../apache/connector/HttpMethodTest.java | 11 +-
.../apache/connector/LargeDataTest.java | 11 +-
.../apache/connector/ManagedClientTest.java | 6 +-
.../jersey/apache/connector/NoEntityTest.java | 4 +-
.../apache/connector/RetryHandlerTest.java | 6 +-
.../apache/connector/SpecialHeaderTest.java | 30 +-
.../apache/connector/StreamingTest.java | 6 +-
.../jersey/apache/connector/TimeoutTest.java | 10 +-
.../apache/connector/TraceSupportTest.java | 22 +-
.../UnderlyingCookieStoreAccessTest.java | 16 +-
.../UnderlyingHttpClientAccessTest.java | 18 +-
.../jersey/apache5/connector/AsyncTest.java | 10 +-
.../jersey/apache5/connector/AuthTest.java | 16 +-
.../jersey/apache5/connector/CookieTest.java | 10 +-
.../connector/CustomLoggingFilter.java | 10 +-
.../connector/DisableContentEncodingTest.java | 4 +-
.../connector/FollowRedirectsTest.java | 4 +-
.../connector/GZIPContentEncodingTest.java | 4 +-
.../apache5/connector/HelloWorldTest.java | 18 +-
.../apache5/connector/HttpEntityTest.java | 12 +-
.../apache5/connector/HttpHeadersTest.java | 6 +-
.../apache5/connector/HttpMethodTest.java | 8 +-
.../apache5/connector/LargeDataTest.java | 9 +-
.../apache5/connector/ManagedClientTest.java | 4 +-
.../apache5/connector/NoEntityTest.java | 2 +-
.../apache5/connector/RetryStrategyTest.java | 4 +-
.../apache5/connector/SpecialHeaderTest.java | 28 +-
.../apache5/connector/StreamingTest.java | 4 +-
.../jersey/apache5/connector/TimeoutTest.java | 8 +-
.../apache5/connector/TraceSupportTest.java | 20 +-
.../UnderlyingCookieStoreAccessTest.java | 14 +-
.../UnderlyingHttpClientAccessTest.java | 16 +-
.../jersey/grizzly/connector/AsyncTest.java | 8 +-
.../grizzly/connector/CustomizersTest.java | 6 +-
.../connector/FollowRedirectsTest.java | 6 +-
.../grizzly/connector/HttpHeadersTest.java | 8 +-
.../grizzly/connector/HttpMethodTest.java | 8 +-
.../grizzly/connector/NoEntityTest.java | 4 +-
.../grizzly/connector/ParallelTest.java | 20 +-
.../jersey/grizzly/connector/TimeoutTest.java | 10 +-
.../grizzly/connector/TraceSupportTest.java | 22 +-
.../UnderlyingHttpClientAccessTest.java | 18 +-
.../jersey/helidon/connector/AsyncTest.java | 8 +-
.../connector/BasicHelidonConnectorTest.java | 320 +++++------
.../connector/FollowRedirectsTest.java | 6 +-
.../helidon/connector/LargeDataTest.java | 11 +-
.../helidon/connector/ParallelTest.java | 20 +-
.../jersey/helidon/connector/TimeoutTest.java | 12 +-
.../connector/sse/EventOutputTest.java | 28 +-
.../jersey/helidon/connector/sse/SseTest.java | 22 +-
.../jersey/jdk/connector/HttpMethodTest.java | 8 +-
.../AsynchronousBodyInputStreamTest.java | 17 +-
.../AsynchronousBodyOutputStreamTest.java | 15 +-
.../internal/ChunkedBodyOutputStreamTest.java | 10 +-
.../internal/ConnectionPoolTest.java | 8 +-
.../jdk/connector/internal/CookieTest.java | 8 +-
.../connector/internal/EntityWriteTest.java | 6 +-
.../internal/HttpConnectionTest.java | 12 +-
.../connector/internal/HttpParserTest.java | 20 +-
.../ModifyHeaderInBodyWriterTest.java | 6 +-
.../internal/MultiValueHeaderTest.java | 10 +-
.../jdk/connector/internal/ProxyTest.java | 10 +-
.../connector/internal/PublicSitesTest.java | 12 +-
.../connector/internal/ReadChunkedEntity.java | 6 +-
.../jdk/connector/internal/RedirectTest.java | 10 +-
.../jdk/connector/internal/SslFilterTest.java | 10 +-
.../jersey/jetty/connector/AsyncTest.java | 8 +-
.../jetty/connector/AuthFilterTest.java | 6 +-
.../jersey/jetty/connector/AuthTest.java | 8 +-
.../jersey/jetty/connector/CookieTest.java | 12 +-
.../jetty/connector/CustomLoggingFilter.java | 12 +-
.../jersey/jetty/connector/EntityTest.java | 6 +-
.../jersey/jetty/connector/ErrorTest.java | 6 +-
.../jetty/connector/FollowRedirectsTest.java | 6 +-
.../connector/GZIPContentEncodingTest.java | 6 +-
.../jetty/connector/HelloWorldTest.java | 8 +-
.../jetty/connector/HttpHeadersTest.java | 10 +-
.../jetty/connector/ManagedClientTest.java | 6 +-
.../jersey/jetty/connector/MethodTest.java | 6 +-
.../jersey/jetty/connector/NoEntityTest.java | 4 +-
.../jetty/connector/SyncResponseSizeTest.java | 12 +-
.../jersey/jetty/connector/TimeoutTest.java | 16 +-
.../jetty/connector/TraceSupportTest.java | 22 +-
.../UnderlyingHttpClientAccessTest.java | 20 +-
.../jersey/netty/connector/AsyncTest.java | 8 +-
.../netty/connector/CustomLoggingFilter.java | 12 +-
.../netty/connector/FollowRedirectsTest.java | 6 +-
.../netty/connector/HelloWorldTest.java | 8 +-
.../netty/connector/HttpHeadersTest.java | 8 +-
.../netty/connector/HugeEntityTest.java | 4 +-
.../jersey/netty/connector/MethodTest.java | 6 +-
.../jersey/netty/connector/NoEntityTest.java | 4 +-
.../jersey/netty/connector/ParallelTest.java | 20 +-
.../jersey/netty/connector/TimeoutTest.java | 10 +-
.../netty/connector/TraceSupportTest.java | 22 +-
connectors/pom.xml | 4 +-
containers/jdk-http/pom.xml | 5 +
.../jdkhttp/AbstractJdkHttpServerTester.java | 6 +-
.../jdkhttp/BasicJdkHttpServerTest.java | 8 +-
.../jersey/jdkhttp/JdkHttpPackageTest.java | 6 +-
.../jersey/jdkhttp/JdkHttpsServerTest.java | 74 +--
.../jersey/jdkhttp/LifecycleListenerTest.java | 14 +-
.../jersey/jdkhttp/RuntimeDelegateTest.java | 6 +-
.../internal/ContextPathEncodingTest.java | 8 +-
.../internal/ThreadLocalInvokerTest.java | 8 +-
containers/jetty-http/pom.xml | 5 +
.../jetty/AbstractJettyServerTester.java | 6 +-
.../org/glassfish/jersey/jetty/AsyncTest.java | 16 +-
.../glassfish/jersey/jetty/ExceptionTest.java | 6 +-
.../jersey/jetty/LifecycleListenerTest.java | 14 +-
.../glassfish/jersey/jetty/OptionsTest.java | 8 +-
containers/pom.xml | 4 +-
containers/simple-http/pom.xml | 5 +
.../simple/AbstractSimpleServerTester.java | 6 +-
.../glassfish/jersey/simple/AsyncTest.java | 16 +-
.../jersey/simple/ExceptionTest.java | 6 +-
.../jersey/simple/LifecycleListenerTest.java | 14 +-
.../glassfish/jersey/simple/OptionsTest.java | 16 +-
.../glassfish/jersey/simple/ParallelTest.java | 6 +-
.../glassfish/jersey/simple/TraceTest.java | 16 +-
core-client/pom.xml | 4 +-
.../client/AutoDiscoverableClientTest.java | 21 +-
.../jersey/client/ClientConfigTest.java | 51 +-
.../jersey/client/ClientRequestTest.java | 31 +-
.../jersey/client/ClientResponseTest.java | 20 +-
.../glassfish/jersey/client/ClientRxTest.java | 68 +--
.../jersey/client/CustomConnectorTest.java | 8 +-
.../client/DefaultSslContextProviderTest.java | 10 +-
.../client/FixedBoundaryParserTest.java | 8 +-
.../client/FixedMultiBoundaryParserTest.java | 8 +-
.../jersey/client/HttpUrlConnectorTest.java | 26 +-
.../JaxRsFeatureRegistrationClientTest.java | 8 +-
.../client/JerseyClientBuilderTest.java | 45 +-
.../jersey/client/JerseyClientTest.java | 27 +-
.../JerseyCompletionStageRxInvokerTest.java | 83 +--
.../jersey/client/JerseyInvocationTest.java | 18 +-
.../jersey/client/JerseyWebTargetTest.java | 63 ++-
.../org/glassfish/jersey/client/LinkTest.java | 12 +-
.../jersey/client/ShutdownHookLeakTest.java | 6 +-
.../client/WebTargetPropertiesTest.java | 8 +-
.../HttpDigestAuthFilterTest.java | 36 +-
.../ClientProviderInstanceInjectionTest.java | 6 +-
.../filter/CsrfProtectionFilterTest.java | 12 +-
.../client/filter/EncodingFilterTest.java | 17 +-
.../filter/HttpBasicAuthFilterTest.java | 6 +-
.../spi/CachingConnectorProviderTest.java | 6 +-
.../client/spi/ClientBuilderListenerTest.java | 8 +-
.../spi/InvocationBuilderListenerTest.java | 43 +-
.../spi/PostInvocationInterceptorTest.java | 68 +--
.../spi/PreInvocationInterceptorTest.java | 52 +-
core-common/pom.xml | 27 +-
.../jersey/SecurityManagerConfiguredTest.java | 9 +-
.../jersey/internal/TestRuntimeDelegate.java | 16 +-
.../AdditionalSystemPropertiesTest.java | 22 +-
.../config/DisabledProvidersTest.java | 26 +-
...nalPropertiesConfigurationFactoryTest.java | 35 +-
.../jersey/internal/inject/ProvidersTest.java | 6 +-
.../routing/CombinedMediaTypeTest.java | 6 +-
.../internal/sonar/SonarJerseyCommonTest.java | 8 +-
.../jersey/internal/util/Base64Test.java | 20 +-
.../internal/util/JdkVersionCompareTest.java | 6 +-
.../internal/util/JdkVersionParseTest.java | 50 +-
.../internal/util/JerseyPublisherTest.java | 10 +-
.../internal/util/OsgiRegistryTest.java | 52 +-
.../internal/util/PropertiesHelperTest.java | 6 +-
.../internal/util/ReflectionHelperTest.java | 40 +-
.../jersey/internal/util/TokenizerTest.java | 6 +-
.../AbstractKeyComparatorHashMapTest.java | 8 +-
.../collection/ByteBufferInputStreamTest.java | 64 +--
.../collection/KeyComparatorHashMapTest.java | 4 +-
.../KeyComparatorLinkedHashMapTest.java | 4 +-
.../internal/util/collection/ViewsTest.java | 10 +-
.../jersey/logging/HasEntityTimeoutTest.java | 2 +-
.../logging/LoggingInterceptorTest.java | 10 +-
.../jersey/message/AbstractEncodingTest.java | 6 +-
.../jersey/message/DeflateEncodingTest.java | 4 +-
.../jersey/message/GZipEncodingTest.java | 4 +-
.../message/internal/DateProviderTest.java | 6 +-
.../FormMultivaluedMapProviderTest.java | 8 +-
.../message/internal/FormProviderTest.java | 8 +-
.../message/internal/LanguageTagTest.java | 13 +-
.../internal/MessageBodyFactoryTest.java | 16 +-
.../jersey/message/internal/QualityTest.java | 104 ++--
.../jersey/message/internal/ResponseTest.java | 10 +-
.../internal/StringBuilderUtilsTest.java | 14 +-
.../jersey/message/internal/UtilsTest.java | 8 +-
.../internal/VariantListBuilderTest.java | 8 +-
.../internal/RankedComparatorTest.java | 6 +-
.../glassfish/jersey/uri/PathPatternTest.java | 27 +-
.../jersey/uri/UriComponentTest.java | 8 +-
.../glassfish/jersey/uri/UriTemplateTest.java | 84 +--
.../jersey/uri/internal/PathTemplateTest.java | 14 +-
.../src/test/resources/surefire-jdk17.policy | 20 +
core-server/pom.xml | 4 +-
.../jersey/server/AnnotatedEntityTest.java | 10 +-
.../jersey/server/ApplicationHandlerTest.java | 24 +-
.../jersey/server/ApplicationTest.java | 4 +-
.../server/AsyncApplicationBuildingTest.java | 10 +-
.../server/AsyncCallbackServerTest.java | 24 +-
.../server/AutoDiscoverableServerTest.java | 6 +-
.../jersey/server/ContainerRequestTest.java | 37 +-
.../server/ExtendedResourceContextTest.java | 8 +-
.../server/JaxRsFeatureRegistrationTest.java | 14 +-
.../server/ModelProcessorScopeTest.java | 6 +-
.../server/ResourceConfigBuilderTest.java | 8 +-
.../jersey/server/ResourceConfigTest.java | 17 +-
.../jersey/server/ResourceMergeTest.java | 10 +-
.../jersey/server/SecurityContextTest.java | 10 +-
.../server/SecurityManagerConfiguredTest.java | 10 +-
.../server/UriInfoMatchedResourcesTest.java | 6 +-
.../jersey/server/UriInfoMatchedUrisTest.java | 6 +-
.../server/filter/ApplicationFilterTest.java | 18 +-
.../ContainerResponseFilterOrderingTest.java | 10 +-
.../filter/CsrfProtectionFilterTest.java | 10 +-
.../server/filter/EncodingFilterTest.java | 14 +-
.../server/filter/EntityTypeFilterTest.java | 8 +-
.../server/filter/FilterSetMethodTest.java | 8 +-
.../filter/HttpMethodOverrideFilterTest.java | 8 +-
.../server/filter/LayeredFiltersTest.java | 22 +-
.../server/filter/UriConnegFilterTest.java | 10 +-
.../filter/UriModificationFilterTest.java | 6 +-
.../BackgroundSchedulerProviderTest.java | 8 +-
.../server/internal/ContainerUtilsTest.java | 9 +-
.../server/internal/ResourceContextTest.java | 6 +-
.../internal/RuntimeDelegateImplTest.java | 8 +-
.../server/internal/ServiceFinderTest.java | 8 +-
.../server/internal/inject/AbstractTest.java | 4 +-
.../inject/ActiveBindingBindingTest.java | 4 +-
.../inject/BeanParamMemoryLeakTest.java | 6 +-
.../ConstructorParameterInjectionTest.java | 8 +-
.../inject/ContextBasedInjectionTest.java | 42 +-
.../inject/CookieParamAsCookieTest.java | 6 +-
.../inject/CookieParamAsPrimitiveTest.java | 6 +-
.../inject/CookieParamAsStringTest.java | 6 +-
.../CookieParamStringConstructorTest.java | 6 +-
.../internal/inject/EncodedParamsTest.java | 8 +-
.../server/internal/inject/FormParamTest.java | 8 +-
.../inject/HeaderParamAsPrimitiveTest.java | 6 +-
.../inject/HeaderParamAsStringTest.java | 6 +-
.../HeaderParamStringConstructorTest.java | 6 +-
.../internal/inject/InvalidParamsTest.java | 6 +-
.../internal/inject/JaxRsInjectablesTest.java | 10 +-
.../inject/MatrixParamAsPrimitiveTest.java | 6 +-
.../inject/MatrixParamAsStringTest.java | 6 +-
.../MatrixParamStringConstructorTest.java | 6 +-
.../inject/ParamConverterDateTest.java | 6 +-
.../inject/ParamConverterInternalTest.java | 14 +-
.../inject/ParamExceptionMappingTest.java | 8 +-
.../inject/PathParamAsPathSegmentTest.java | 6 +-
.../inject/PathParamAsPrimitiveTest.java | 6 +-
.../inject/PathParamAsStringTest.java | 6 +-
.../inject/PathParamDefaultValueTest.java | 6 +-
.../PathParamStringConstructorTest.java | 6 +-
.../inject/QueryParamAsPrimitiveTest.java | 6 +-
.../inject/QueryParamAsSetPrimitiveTest.java | 8 +-
.../inject/QueryParamAsSetStringTest.java | 8 +-
.../QueryParamAsSortedSetPrimitiveTest.java | 8 +-
.../QueryParamAsSortedSetStringTest.java | 8 +-
.../inject/QueryParamAsStringTest.java | 6 +-
.../internal/inject/QueryParamEnumTest.java | 6 +-
.../inject/QueryParamFromStringTest.java | 6 +-
.../QueryParamSetStringConstructorTest.java | 8 +-
...ryParamSortedSetStringConstructorTest.java | 8 +-
.../QueryParamStringConstructorTest.java | 6 +-
.../server/internal/inject/UriTest.java | 8 +-
.../AbstractNanosReservoirTest.java | 14 +-
.../monitoring/AggregatingTrimmerTest.java | 16 +-
.../monitoring/MonitoringStatisticsTest.java | 36 +-
.../monitoring/MonitoringUtilsTest.java | 14 +-
.../ResponseStatisticsImplTest.java | 43 +-
...owTimeReservoirAggregatingTrimmerTest.java | 4 +-
.../SlidingWindowTimeReservoirTest.java | 6 +-
.../TimeWindowStatisticsImplTest.java | 18 +-
.../process/ProxyInjectablesTest.java | 8 +-
.../internal/routing/ExtendedUriInfoTest.java | 10 +-
.../ResponseMediaTypeFromProvidersTest.java | 6 +-
.../SubResourceLocatorCachingTest.java | 10 +-
.../routing/SubResourceValidationTest.java | 10 +-
.../routing/UriRoutingContextTest.java | 24 +-
.../scanning/BundleSchemeScannerTest.java | 32 +-
.../scanning/CompositeResourceFinderTest.java | 8 +-
.../internal/scanning/JarFileScannerTest.java | 36 +-
.../scanning/VFSSchemeResourceFinderTest.java | 12 +-
.../internal/sonar/SonarJerseyServerTest.java | 8 +-
.../AcceptAnnotatedReaderWriterTest.java | 8 +-
.../jersey/server/model/AcceptQsTest.java | 68 +--
.../jersey/server/model/AcceptTest.java | 44 +-
.../jersey/server/model/AcceptWriterTest.java | 6 +-
.../server/model/AmbiguousTemplateTest.java | 58 +-
.../jersey/server/model/AncestorsTest.java | 6 +-
.../model/AsyncContentAndEntityTypeTest.java | 10 +-
.../server/model/ConstrainedToServerTest.java | 8 +-
.../model/ConsumeProduceSimpleTest.java | 6 +-
.../model/ConsumeProduceWildcardTest.java | 6 +-
.../server/model/DynamicFeatureTest.java | 16 +-
.../server/model/GenericMethodListTest.java | 6 +-
.../model/HeadSubResourceMethodTest.java | 8 +-
.../jersey/server/model/HeadTest.java | 10 +-
.../model/InnerClassWithGenericTypeTest.java | 6 +-
.../jersey/server/model/MethodListTest.java | 6 +-
.../model/MixedResourceConfigurationTest.java | 6 +-
.../model/OptionsSubResourceMethodTest.java | 10 +-
.../jersey/server/model/OptionsTest.java | 36 +-
.../jersey/server/model/ParameterTest.java | 8 +-
.../ParameterWithMultipleAnnotationsTest.java | 12 +-
.../PathAndResourceMethodErrorsTest.java | 18 +-
.../ProgrammaticResourceMethodsTest.java | 8 +-
.../jersey/server/model/RMBuilderTest.java | 6 +-
.../jersey/server/model/ResourceInfoTest.java | 8 +-
.../server/model/ResourceModelTest.java | 10 +-
.../server/model/ResourceNotFoundTest.java | 6 +-
.../model/ResourcePathOverrideTest.java | 6 +-
.../server/model/ResourceTestUtils.java | 6 +-
.../model/SubResourceClassDynamicTest.java | 6 +-
.../server/model/SubResourceDynamicTest.java | 6 +-
...DynamicWithDuplicateTemplateNamesTest.java | 6 +-
.../SubResourceDynamicWithParametersTest.java | 6 +-
.../model/SubResourceHttpMethodsTest.java | 6 +-
.../server/model/SubResourceNullTest.java | 6 +-
.../model/SubResourceProgrammaticTest.java | 8 +-
.../jersey/server/model/ValidatorTest.java | 20 +-
.../model/internal/ChildResourceTest.java | 6 +-
.../model/internal/ModelHelperTest.java | 14 +-
.../ResourceMethodDispatcherFactoryTest.java | 14 +-
.../annotation/IntrospectionModellerTest.java | 60 +--
.../monitoring/MonitoringFeatureTest.java | 108 ++--
.../wadl/config/WadlGeneratorConfigTest.java | 38 +-
.../WadlGeneratorConfigurationLoaderTest.java | 10 +-
.../wadl/config/WadlGeneratorLoaderTest.java | 22 +-
.../WadlGeneratorResourceDocSupportTest.java | 4 +-
docs/src/main/docbook/getting-started.xml | 4 +-
.../examples/bookmark_em/BookmarkTest.java | 20 +-
.../examples/bookmark/BookmarkTest.java | 17 +-
.../webapp/resource/BookstoreTest.java | 12 +-
.../bookstore/webapp/resource/ItemTest.java | 12 +-
.../webapp/resource/TestSupport.java | 10 +-
.../examples/cdi/resources/CdiTest.java | 13 +-
.../cdi/resources/EchoParamBeanTest.java | 47 +-
.../cdi/resources/EchoResourceTest.java | 45 +-
.../cdi/resources/HelloworldTest.java | 6 +-
.../cdi/resources/PerApplicationBeanTest.java | 4 +-
.../cdi/resources/PerRequestBeanTest.java | 47 +-
.../resources/ProxyScopeAlignmentTest.java | 38 +-
.../examples/clipboard/ClipboardTest.java | 6 +-
.../examples/clipboard/ClipboardTest.java | 10 +-
.../examples/linking/LinkWebAppTest.java | 10 +-
.../security/RestrictedResourceTest.java | 222 ++++----
.../security/UnrestrictedResourceTest.java | 67 +--
.../selectable/PersonResourceTest.java | 298 +++++------
.../entityfiltering/ProjectsResourceTest.java | 102 ++--
.../entityfiltering/TaskResourceTest.java | 99 ++--
.../entityfiltering/UsersResourceTest.java | 109 ++--
.../exception/ExceptionMappingFilterTest.java | 8 +-
.../exception/ExceptionMappingTest.java | 8 +-
examples/extended-wadl-webapp/pom.xml | 6 +
.../ExtendedWadlWebappOsgiTest.java | 4 +-
.../extendedwadl/ExtendedWadlWebappTest.java | 4 +-
.../examples/freemarker/FreemarkerTest.java | 6 +-
examples/groovy/pom.xml | 6 +
.../examples/groovy/GroovyResourceTest.groovy | 6 +-
.../examples/helloworld/HelloWorldTest.java | 6 +-
.../helloworld/cdi2se/CounterTest.java | 6 +-
.../helloworld/cdi2se/HelloWorldTest.java | 6 +-
examples/helloworld-netty/pom.xml | 3 +
.../helloworld/netty/CustomLoggingFilter.java | 12 +-
.../helloworld/netty/HelloWorldTest.java | 55 +-
.../examples/helloworld/HelloWorldTest.java | 10 +-
examples/helloworld-pure-jax-rs/pom.xml | 4 +-
.../helloworld/jaxrs/HelloWorldTest.java | 6 +-
.../SpringRequestResourceTest.java | 14 +-
examples/helloworld-spring-webapp/pom.xml | 4 +-
.../helloworld/webapp/HelloWorldTest.java | 6 +-
examples/helloworld-weld/pom.xml | 3 +
.../helloworld/AppScopedResourceTest.java | 13 +-
.../examples/helloworld/HelloWorldTest.java | 16 +-
.../helloworld/RequestScopeAlignmentTest.java | 20 +-
.../helloworld/RequestScopedResourceTest.java | 60 +--
examples/helloworld/pom.xml | 3 +
.../helloworld/CustomLoggingFilter.java | 12 +-
.../examples/helloworld/HelloWorldTest.java | 48 +-
.../examples/httppatch/HttpPatchTest.java | 6 +-
.../examples/httptrace/TraceSupportTest.java | 22 +-
examples/https-clientserver-grizzly/pom.xml | 4 +-
.../httpsclientservergrizzly/MainTest.java | 16 +-
.../java8/DefaultMethodResourceTest.java | 6 +-
.../examples/java8/LambdaResourceTest.java | 6 +-
.../jersey/examples/jaxb/JaxbTest.java | 11 +-
.../JaxrsTypeInjectionTest.java | 24 +-
.../jersey_ejb/test/MessageBoardTest.java | 27 +-
.../jersey/examples/jackson/JacksonTest.java | 30 +-
.../examples/jackson1/Jackson1Test.java | 14 +-
.../examples/jettison/JsonJettisonTest.java | 36 +-
.../examples/jsonmoxy/JsonResourceTest.java | 6 +-
.../jsonp/JsonProcessingResourceTest.java | 8 +-
.../examples/jsonp/JsonWithPaddingTest.java | 12 +-
.../managedbeans/ManagedBeanWebAppTest.java | 4 +-
.../ManagedClientSimpleTest.java | 6 +-
.../managedclient/ManagedClientTest.java | 6 +-
.../managedclient/ManagedClientTest.java | 6 +-
.../multipart/webapp/MultiPartWebAppTest.java | 6 +-
.../functional-test/pom.xml | 1 +
.../osgi-http-service/functional-test/pom.xml | 3 +-
.../jersey/examples/reload/ReloadTest.java | 12 +-
.../jersey/examples/rx/RxClientsTest.java | 4 +-
.../managed/ManagedAsyncResourceTest.java | 20 +-
.../server-async-standalone/client/pom.xml | 4 +-
.../examples/server/async/MainTest.java | 6 +-
.../server/async/AsyncResourceTest.java | 18 +-
.../sse/jaxrs/ServerSentEventsTest.java | 15 +-
.../sse/jersey/ServerSentEventsTest.java | 16 +-
.../src/test/java/Servlet3WebappITCase.java | 6 +-
.../jersey/examples/console/MainTest.java | 35 +-
.../jaxrs/JaxrsItemStoreResourceTest.java | 36 +-
.../jersey/JerseyItemStoreResourceTest.java | 34 +-
.../examples/sysprops/SysPropsTest.java | 6 +-
.../jersey/examples/xmlmoxy/MoxyAppTest.java | 6 +-
...ptyHk2CustomInjectionTypeProviderTest.java | 4 +-
ext/cdi/jersey-cdi1x/pom.xml | 6 +
.../internal/CdiComponentProviderTest.java | 8 +-
.../ext/cdi1x/internal/CdiUtilTest.java | 6 +-
.../filtering/SecurityAnnotationsTest.java | 4 +-
.../SecurityEntityProcessorTest.java | 8 +-
.../message/filtering/SecurityHelperTest.java | 4 +-
.../jersey/message/MetaInfServicesTest.java | 10 +-
ext/microprofile/mp-config/pom.xml | 4 +-
.../config/ConfigurationProviderTest.java | 12 +-
...nalPropertiesConfigurationFactoryTest.java | 12 +-
.../restclient/RestClientBuilderImplTest.java | 14 +-
ext/pom.xml | 4 +-
.../client/proxy/WebResourceFactoryTest.java | 47 +-
ext/rx/pom.xml | 4 +-
.../rx/guava/RxListenableFutureTest.java | 91 ++--
.../client/rx/rxjava/RxObservableTest.java | 91 ++--
.../client/rx/rxjava2/RxFlowableTest.java | 63 ++-
.../server/spring/aspect4j/Aspect4JTest.java | 10 +-
.../SpringFieldInjectionTest.java | 6 +-
.../server/spring/filter/FilterTest.java | 6 +-
.../SpringMethodInjectionTest.java | 6 +-
.../SpringParameterInjectionTest.java | 6 +-
.../SpringDefaultProfileResourceTest.java | 8 +-
.../SpringDevProfileResourceTest.java | 8 +-
.../spring/profiles/SpringProfilesTest.java | 6 +-
.../server/spring/aspect4j/Aspect4JTest.java | 10 +-
.../SpringFieldInjectionTest.java | 6 +-
.../server/spring/filter/FilterTest.java | 6 +-
.../SpringMethodInjectionTest.java | 6 +-
.../SpringParameterInjectionTest.java | 6 +-
.../SpringDefaultProfileResourceTest.java | 8 +-
.../SpringDevProfileResourceTest.java | 8 +-
.../spring/profiles/SpringProfilesTest.java | 6 +-
incubator/cdi-inject-weld/pom.xml | 9 +-
.../CachedConstructorAnalyzerTest.java | 18 +-
.../injector/JerseyProxyResolverTest.java | 12 +-
.../managed/ClientInstanceInjectionTest.java | 38 +-
.../managed/DisposableSupplierTest.java | 18 +-
.../managed/InjectionManagerTest.java | 14 +-
.../managed/ProviderInjectionTest.java | 14 +-
.../managed/SupplierClassBindingTest.java | 14 +-
.../managed/SupplierContractsTest.java | 81 +--
.../managed/SupplierInstanceBindingTest.java | 20 +-
.../weld/internal/managed/TestParent.java | 14 +-
.../internal/managed/ThreadScopeTest.java | 18 +-
incubator/declarative-linking/pom.xml | 4 +-
.../jersey/linking/EntityDescriptorTest.java | 6 +-
.../jersey/linking/FieldProcessorTest.java | 8 +-
.../jersey/linking/HeaderProcessorTest.java | 8 +-
.../jersey/linking/LinkELContextTest.java | 8 +-
.../integration/LinkingManualTest.java | 4 +-
.../linking/integration/LinkingTest.java | 4 +-
incubator/html-json/pom.xml | 4 +-
.../media/htmljson/AbstractTypeTester.java | 6 +-
.../media/htmljson/ComputedPropertyTest.java | 6 +-
.../htmljson/ModelEntityOnArrayTest.java | 14 +-
.../media/htmljson/ModelEntityOnListTest.java | 10 +-
.../media/htmljson/ModelEntityTest.java | 8 +-
.../jersey/kryo/PersonResourceBaseTest.java | 6 +-
.../jersey/kryo/PersonResourceTest.java | 6 +-
incubator/open-tracing/pom.xml | 4 +-
inject/cdi2-se/pom.xml | 9 +-
.../inject/cdi/se/DisposableSupplierTest.java | 22 +-
.../inject/cdi/se/ProviderInjectionTest.java | 14 +-
.../cdi/se/SupplierClassBindingTest.java | 18 +-
.../inject/cdi/se/SupplierContractsTest.java | 61 ++-
.../cdi/se/SupplierInstanceBindingTest.java | 20 +-
.../jersey/inject/cdi/se/ThreadScopeTest.java | 14 +-
.../CachedConstructorAnalyzerTest.java | 17 +-
.../se/injector/JerseyProxyResolverTest.java | 12 +-
inject/hk2/pom.xml | 4 +-
.../inject/hk2/DisposableSupplierTest.java | 22 +-
.../inject/hk2/InjectionManagerTest.java | 25 +-
.../inject/hk2/SupplierClassBindingTest.java | 18 +-
.../inject/hk2/SupplierContractsTest.java | 61 ++-
.../hk2/SupplierInstanceBindingTest.java | 18 +-
.../jersey/inject/hk2/SupplierProxyTest.java | 16 +-
media/jaxb/pom.xml | 9 +-
.../internal/AbstractJaxbProviderTest.java | 8 +-
.../FeatureAndPropertySupplierTest.java | 30 +-
.../JaxbStringReaderProviderTest.java | 4 +-
...SaxParserFactoryInjectionProviderTest.java | 14 +-
.../jaxb/internal/SourceProviderTest.java | 8 +-
media/json-binding/pom.xml | 4 +-
.../internal/JsonBindingProviderTest.java | 29 +-
media/json-gson/pom.xml | 4 +-
.../gson/internal/JsonGsonProviderTest.java | 15 +-
media/json-jackson/pom.xml | 4 +-
.../DefaultJacksonJaxbJsonProviderTest.java | 6 +-
...JsonJacksonProviderForBothModulesTest.java | 4 +-
...JacksonProviderForDisabledModulesTest.java | 6 +-
...nJacksonProviderForEnabledModulesTest.java | 4 +-
media/json-jackson1/pom.xml | 4 +-
media/json-jettison/pom.xml | 4 +-
media/json-processing/pom.xml | 4 +-
...nProcessingAutoDiscoverableClientTest.java | 6 +-
...nProcessingAutoDiscoverableServerTest.java | 6 +-
media/moxy/pom.xml | 4 +-
media/multipart/pom.xml | 4 +-
.../jersey/media/multipart/BodyPartTest.java | 20 +-
.../media/multipart/FormDataBodyPartTest.java | 22 +-
.../multipart/FormDataMultiPartTest.java | 16 +-
.../multipart/MultiPartMediaTypesTest.java | 8 +-
.../jersey/media/multipart/MultiPartTest.java | 16 +-
.../MultipartMixedWithApacheClientTest.java | 6 +-
.../ParameterizedHeadersMapTest.java | 22 +-
...oreCaseMultivaluedMapAsHeadersMapTest.java | 22 +-
.../multipart/file/FileDataBodyPartTest.java | 18 +-
.../file/StreamDataBodyPartTest.java | 20 +-
.../internal/FormDataMultiPartBufferTest.java | 10 +-
.../FormDataMultiPartReaderWriterTest.java | 24 +-
.../MultiPartHeaderModificationTest.java | 152 +++---
.../internal/MultiPartReaderWriterTest.java | 40 +-
media/sse/pom.xml | 4 +-
.../jersey/media/sse/ClientCloseTest.java | 8 +-
.../jersey/media/sse/EmptyEventsTest.java | 6 +-
.../jersey/media/sse/EventSourceTest.java | 8 +-
.../media/sse/InboundEventReaderTest.java | 10 +-
.../jersey/media/sse/OutboundEventTest.java | 12 +-
.../media/sse/SseEventSinkCloseTest.java | 14 +-
.../jersey/media/sse/SseEventSinkTest.java | 6 +-
.../sse/internal/JerseyEventSinkTest.java | 19 +-
.../internal/JerseySseBroadcasterTest.java | 33 +-
.../internal/JerseySseEventSourceTest.java | 13 +-
pom.xml | 34 +-
security/oauth1-client/pom.xml | 4 +-
security/oauth1-server/pom.xml | 4 +-
.../server/oauth1/NonceManagerTest.java | 12 +-
.../server/oauth1/OAuth1ExceptionTest.java | 8 +-
security/oauth1-signature/pom.xml | 4 +-
.../oauth1/signature/OAuth1SignatureTest.java | 6 +-
.../oauth1/signature/OAuthBase64Test.java | 18 +-
.../oauth1/signature/SignatureTest.java | 10 +-
test-framework/core/pom.xml | 5 +-
.../org/glassfish/jersey/test/JerseyTest.java | 48 +-
.../glassfish/jersey/test/package-info.java | 6 +-
.../glassfish/jersey/test/spi/TestHelper.java | 37 +-
.../glassfish/jersey/test/JerseyTestTest.java | 6 +-
.../container-runner-maven-plugin/pom.xml | 2 +
.../maven/custom-enforcer-rules/pom.xml | 4 +-
.../rule/FilePatternDoesNotExistRuleTest.java | 23 +-
.../rule/PatternNotMatchedInFileRuleTest.java | 9 +-
test-framework/memleak-test-common/pom.xml | 9 +-
.../common/AbstractMemoryLeakSimpleTest.java | 6 +-
.../common/AbstractMemoryLeakWebAppTest.java | 6 +-
.../common/MemoryLeakSucceedingTimeout.java | 117 ++---
test-framework/pom.xml | 9 +-
.../grizzly/AvailablePortGrizzlyTest.java | 6 +-
.../jersey/test/grizzly/BaseUriTest.java | 10 +-
.../test/grizzly/pckg/GrizzlyPackageTest.java | 6 +-
.../web/AvailablePortGrizzlyWebTest.java | 4 +-
.../web/GrizzlyRequestDispatchFilterTest.java | 16 +-
.../web/GrizzlyWebFixedRequestSizeTest.java | 6 +-
.../grizzly/web/GrizzlyWebInjectionTest.java | 6 +-
.../web/GrizzlyWebServletAndFilterTest.java | 14 +-
.../test/grizzly/web/GrizzlyWebTest.java | 10 +-
.../context/GrizzlyWebContextPathTest.java | 6 +-
.../web/ssl/GrizzlyOneWaySslWebTest.java | 39 +-
.../web/ssl/GrizzlyTwoWaySslWebTest.java | 55 +-
.../InMemoryContainerPackageTest.java | 8 +-
.../test/inmemory/InMemoryContainerTest.java | 12 +-
.../internal/FollowRedirectsTest.java | 6 +-
.../AvailablePortJdkHttpServerTest.java | 4 +-
.../jdkhttp/JdkHttpServerContainerTest.java | 10 +-
.../test/jetty/AvailablePortJettyTest.java | 4 +-
.../jersey/test/jetty/JettyContainerTest.java | 16 +-
.../test/simple/AvailablePortSimpleTest.java | 4 +-
.../test/simple/SimpleContainerTest.java | 10 +-
test-framework/util/pom.xml | 10 +
.../runner/ConcurrentParameterizedRunner.java | 7 +-
.../test/util/runner/ConcurrentRunner.java | 7 +-
.../test/util/runner/RunSeparately.java | 7 +-
.../util/client/LoopBackConnectorTest.java | 28 +-
tests/e2e-client/pom.xml | 6 -
.../e2e/client/AbortResponseClientTest.java | 10 +-
.../tests/e2e/client/BasicClientTest.java | 12 +-
.../tests/e2e/client/BufferingTest.java | 16 +-
.../e2e/client/CancelFutureClientTest.java | 8 +-
...unkedInputStreamClosedPrematurelyTest.java | 55 +-
.../client/ClientBufferingDisabledTest.java | 35 +-
.../tests/e2e/client/ClientDestroyTest.java | 32 +-
.../client/ClientEntityAnnotationTest.java | 14 +-
.../e2e/client/ClientExecutorCloseTest.java | 26 +-
.../tests/e2e/client/ClientExecutorTest.java | 8 +-
.../tests/e2e/client/ClientFilterTest.java | 10 +-
.../tests/e2e/client/ClientPathTest.java | 6 +-
.../tests/e2e/client/ClientPreInitTest.java | 14 +-
.../e2e/client/FollowRedirectHeadTest.java | 22 +-
.../tests/e2e/client/FollowRedirectsTest.java | 6 +-
.../tests/e2e/client/GenericResponseTest.java | 24 +-
.../e2e/client/HttpAuthorizationTest.java | 42 +-
.../e2e/client/HttpDigestAuthFilterTest.java | 18 +-
.../e2e/client/HttpHeadersInjectionTest.java | 4 +-
.../e2e/client/HttpMethodEntityTest.java | 10 +-
.../client/IgnoreExceptionResponseTest.java | 18 +-
.../e2e/client/InjectedClientBodyWorker.java | 4 +-
.../client/InjectionManagerProviderTest.java | 6 +-
.../e2e/client/InvocationBuilderRxTest.java | 22 +-
.../tests/e2e/client/JaxRsTimeoutTest.java | 8 +-
.../e2e/client/NonSuccessfulResponseTest.java | 14 +-
.../client/RequestScopedReadEntityTest.java | 6 +-
.../tests/e2e/client/ResponseCloseTest.java | 6 +-
.../ResponseReadAndBufferEntityTest.java | 18 +-
.../client/ShutdownHookMemoryLeakTest.java | 159 +++---
.../jersey/tests/e2e/client/TimeoutTest.java | 8 +-
.../e2e/client/connector/HttpPatchTest.java | 180 ++++---
.../RequestHeaderModificationsTest.java | 188 ++++---
.../connector/proxy/ProxySelectorTest.java | 48 +-
.../e2e/client/connector/proxy/ProxyTest.java | 188 ++++---
.../ssl/AbstractConnectorServerTest.java | 32 +-
.../ssl/SslConnectorConfigurationTest.java | 31 +-
.../ssl/SslConnectorHostnameVerifierTest.java | 21 +-
.../ssl/SslHttpUrlConnectorTest.java | 24 +-
.../grizzlyconnector/NonBlockingTest.java | 16 +-
.../client/httpurlconnector/AsyncTest.java | 16 +-
.../Expect100ContinueTest.java | 20 +-
tests/e2e-core-common/pom.xml | 4 +-
.../tests/e2e/common/TestRuntimeDelegate.java | 16 +-
.../config/ServiceFinderBinderTest.java | 16 +-
.../internal/ContextResolverFactoryTest.java | 12 +-
.../internal/ExceptionMapperFactoryTest.java | 15 +-
.../common/internal/JaxrsProvidersTest.java | 8 +-
.../internal/LocalizationMessagesTest.java | 8 +-
.../common/internal/ProviderBinderTest.java | 8 +-
.../inject/ReferencingFactoryTest.java | 6 +-
...ableMediaTypeStringRepresentationTest.java | 49 +-
.../internal/AcceptableMediaTypeTest.java | 60 +--
.../internal/CommittingOutputStreamTest.java | 14 +-
.../message/internal/CookiesParserTest.java | 4 +-
.../message/internal/HeaderUtilsTest.java | 18 +-
.../internal/InboundMessageContextTest.java | 12 +-
.../message/internal/JerseyLinkTest.java | 16 +-
.../message/internal/LinkProviderTest.java | 14 +-
.../internal/MatchingEntityTagTest.java | 10 +-
.../message/internal/MediaTypesTest.java | 16 +-
.../OutboundJaxrsResponseBuilderTest.java | 6 +-
.../internal/OutboundJaxrsResponseTest.java | 34 +-
.../internal/OutboundMessageContextTest.java | 16 +-
.../internal/QualitySourceMediaTypeTest.java | 59 +--
.../model/internal/CommonConfigTest.java | 60 +--
.../internal/ExecutorProvidersTest.java | 16 +-
.../process/internal/RequestScopeTest.java | 10 +-
.../uri/internal/JerseyUriBuilderTest.java | 396 +++++++-------
tests/e2e-entity/pom.xml | 10 +-
.../tests/e2e/entity/AbstractTypeTester.java | 6 +-
.../tests/e2e/entity/BeanStreamingTest.java | 10 +-
.../jersey/tests/e2e/entity/CharsetTest.java | 5 +-
.../entity/ContextResolverMediaTypeTest.java | 28 +-
.../tests/e2e/entity/EmptyEntityTest.java | 12 +-
.../entity/EmptyRequestToEntityParamTest.java | 10 +-
.../e2e/entity/EmptyRequestWithJaxbTest.java | 19 +-
.../tests/e2e/entity/EntityTypesTest.java | 86 ++-
.../tests/e2e/entity/EnumEntityTest.java | 37 +-
.../e2e/entity/GenericTypeAndEntityTest.java | 9 +-
.../e2e/entity/InjectedProviderTest.java | 6 +-
.../entity/InterceptedStreamCloseTest.java | 6 +-
.../tests/e2e/entity/InvalidEntityTest.java | 6 +-
.../tests/e2e/entity/InvalidFormTest.java | 6 +-
.../e2e/entity/JAXBContextResolverTest.java | 59 ++-
.../jersey/tests/e2e/entity/JsonMoxyTest.java | 43 +-
.../e2e/entity/MediaTypeSelectionTest.java | 10 +-
.../MessageBodyProviderAnnotationsTest.java | 6 +-
.../tests/e2e/entity/MultipartTest.java | 4 +-
.../e2e/entity/NoMessageBodyWorkerTest.java | 6 +-
.../ParameterTypeArgumentOrderTest.java | 6 +-
...ArgumentResourceReaderWriterOrderTest.java | 6 +-
...arameterTypeArgumentReversedOrderTest.java | 6 +-
.../e2e/entity/RenderedImageTypeTest.java | 6 +-
.../tests/e2e/entity/StreamingOutputTest.java | 6 +-
.../entity/SubResourceDynamicProxyTest.java | 6 +-
.../jersey/tests/e2e/entity/XXETest.java | 10 +-
.../entity/XmlJaxBElementProviderTest.java | 6 +-
.../jersey/tests/e2e/entity/XmlMoxyTest.java | 39 +-
.../e2e/entity/filtering/EmptyEntityTest.java | 4 +-
.../filtering/EntityFilteringClientTest.java | 20 +-
.../filtering/EntityFilteringOnClassTest.java | 4 +-
.../EntityFilteringOnPropertiesTest.java | 4 +-
.../filtering/EntityFilteringScopesTest.java | 4 +-
.../filtering/EntityFilteringServerTest.java | 12 +-
.../filtering/json/JsonEmptyEntityTest.java | 78 +--
.../json/JsonEntityFilteringClientTest.java | 398 +++++++-------
.../json/JsonEntityFilteringOnClassTest.java | 496 +++++++++---------
.../JsonEntityFilteringOnPropertiesTest.java | 478 ++++++++---------
.../json/JsonEntityFilteringScopesTest.java | 85 +--
.../json/JsonEntityFilteringServerTest.java | 87 ++-
.../json/MoxyEntityFilteringTest.java | 4 +-
.../header/HeaderDelegateProviderTest.java | 18 +-
.../RuntimeDelegateProviderDisabledTest.java | 16 +-
.../RuntimeDelegateProviderEnabledTest.java | 16 +-
.../jersey/tests/e2e/json/GenericTest.java | 38 +-
.../tests/e2e/json/InheritanceTest.java | 33 +-
.../tests/e2e/json/Jackson1JsonViewTest.java | 4 +-
.../tests/e2e/json/JacksonJsonViewTest.java | 4 +-
.../jersey/tests/e2e/json/JaxbTest.java | 31 +-
.../jersey/tests/e2e/json/Jersey1199Test.java | 31 +-
.../jersey/tests/e2e/json/Jersey1835Test.java | 32 +-
.../e2e/json/JsonProcessingDisabledTest.java | 6 +-
.../tests/e2e/json/JsonProcessingTest.java | 10 +-
.../{AbstractJsonTest.java => JsonTest.java} | 17 +-
.../JsonWithPaddingEncodingFilterTest.java | 8 +-
.../tests/e2e/json/JsonWithPaddingTest.java | 260 +++++----
.../json/JsonWithoutExceptionMapperTest.java | 10 +-
.../jersey/tests/e2e/json/PojoTest.java | 34 +-
.../tests/e2e/sse/BroadcasterCloseTest.java | 18 +-
.../e2e/sse/BroadcasterExecutorTest.java | 18 +-
.../jersey/tests/e2e/sse/BroadcasterTest.java | 68 +--
.../jersey/tests/e2e/sse/EventOutputTest.java | 28 +-
.../sse/EventSourceWithNamedEventsTest.java | 14 +-
.../tests/e2e/sse/GenericEntityTest.java | 17 +-
.../tests/e2e/sse/SseCustomEventImplTest.java | 28 +-
.../sse/SseEventSinkToEventSourceTest.java | 28 +-
tests/e2e-inject/cdi-inject-weld/pom.xml | 4 +-
.../tests/e2e/inject/cdi/weld/EventsTest.java | 17 +-
.../cdi/weld/InterceptorDecoratorTest.java | 17 +-
.../inject/cdi/weld/scopes/ScopesTest.java | 12 +-
.../subresources/ModelProcessorScopeTest.java | 15 +-
tests/e2e-inject/cdi2-se/pom.xml | 4 +-
.../tests/e2e/inject/cdi/se/EventsTest.java | 6 +-
.../cdi/se/InterceptorDecoratorTest.java | 6 +-
.../e2e/inject/cdi/se/scopes/ScopesTest.java | 8 +-
.../subresources/ModelProcessorScopeTest.java | 6 +-
.../hk2/HK2AbstractBinderClassTest.java | 4 +-
.../hk2/HK2AbstractBinderInFeaturesTest.java | 4 +-
.../hk2/HK2AbstractBinderInstanceTest.java | 4 +-
.../e2e/inject/hk2/HK2AbstractBinderTest.java | 4 +-
.../inject/hk2/JerseyAbstractBinderTest.java | 4 +-
tests/e2e-server/pom.xml | 10 +-
...tractDisableMetainfServicesLookupTest.java | 12 +-
.../tests/e2e/server/AllInjectablesTest.java | 8 +-
.../server/AmbigousResourceMethodTest.java | 6 +-
.../tests/e2e/server/AppNameBindingTest.java | 6 +-
.../tests/e2e/server/AppNameBindingTest2.java | 6 +-
.../e2e/server/ArrayParamConverterTest.java | 6 +-
.../tests/e2e/server/AsyncCallbackTest.java | 17 +-
.../tests/e2e/server/AsyncResponseTest.java | 8 +-
.../e2e/server/BeanParamExceptionTest.java | 6 +-
.../tests/e2e/server/BeanParamTest.java | 34 +-
.../tests/e2e/server/BroadcasterTest.java | 8 +-
.../e2e/server/ChunkedInputOutputTest.java | 18 +-
.../server/ClientResponseOnServerTest.java | 6 +-
.../tests/e2e/server/CloseableTest.java | 6 +-
.../tests/e2e/server/CompletionStageTest.java | 8 +-
...erListenerRegistrationAsProvidersTest.java | 8 +-
.../e2e/server/ContentNegotiationTest.java | 42 +-
.../CustomInjectablesApplicationTest.java | 18 +-
.../CustomInjectablesResourceConfigTest.java | 6 +-
.../CustomMultivaluedMapProviderTest.java | 6 +-
.../e2e/server/EncodedFormParamTest.java | 6 +-
.../server/EncodedSlashInPathSegmentTest.java | 6 +-
.../tests/e2e/server/EntityExpansionTest.java | 22 +-
.../e2e/server/ExceptionLoggingTest.java | 6 +-
.../server/ExceptionMapperPriorityTest.java | 6 +-
.../ExceptionMapperPropagationTest.java | 50 +-
.../tests/e2e/server/ExceptionMapperTest.java | 6 +-
.../server/ExtendedExceptionMapperTest.java | 14 +-
.../tests/e2e/server/ExtendedUriInfoTest.java | 6 +-
.../FormParamMultivaluedInjectionTest.java | 6 +-
.../GlobalNameBoundInterceptorTest.java | 39 +-
.../GloballyNameBoundResourceFilterTest.java | 8 +-
.../e2e/server/GrizzlyInjectionTest.java | 8 +-
.../tests/e2e/server/GsonCustomTest.java | 4 +-
.../tests/e2e/server/GsonDefaultTest.java | 4 +-
.../server/IllegalArgumentExceptionTest.java | 6 +-
.../e2e/server/InitializationLoggingTest.java | 6 +-
.../InjectionManagerServerProviderTest.java | 6 +-
.../tests/e2e/server/InjectionTest.java | 28 +-
.../e2e/server/InputStreamResponseTest.java | 6 +-
.../InterceptorHttpHeadersInjectionTest.java | 6 +-
.../InterceptorNameAndDynamicBindingTest.java | 6 +-
.../tests/e2e/server/Issue4097Test.java | 4 +-
.../e2e/server/ManagedClientExecutorTest.java | 10 +-
.../MessageBodyProvidersExceptionsTest.java | 6 +-
.../MetainfServicesLookupDisabledTest.java | 4 +-
.../MetainfServicesLookupEnabledTest.java | 4 +-
.../tests/e2e/server/ModelProcessorTest.java | 27 +-
.../tests/e2e/server/NameBindingTest.java | 42 +-
.../OptionalParamConverterNoProviderTest.java | 6 +-
.../server/OptionalParamConverterTest.java | 8 +-
.../server/ParamConverterPriorityTest.java | 4 +-
.../tests/e2e/server/ParamConverterTest.java | 12 +-
.../tests/e2e/server/PathEncodingTest.java | 6 +-
.../e2e/server/PerRequestLifecycleTest.java | 8 +-
.../tests/e2e/server/PostConstructTest.java | 16 +-
.../tests/e2e/server/PrimitiveTypesTest.java | 43 +-
.../jersey/tests/e2e/server/ReloadTest.java | 6 +-
.../e2e/server/RequestScopedAndAsyncTest.java | 10 +-
.../tests/e2e/server/ResourceConfigTest.java | 10 +-
.../tests/e2e/server/ResourceFilterTest.java | 18 +-
.../tests/e2e/server/ResourceRoutingTest.java | 16 +-
.../e2e/server/ResponseStatusTypeTest.java | 34 +-
.../tests/e2e/server/RuntimeConfigTest.java | 12 +-
...heduledThreadPoolExecutorProviderTest.java | 8 +-
.../e2e/server/SecurityContextFilterTest.java | 16 +-
.../tests/e2e/server/ServerDestroyTest.java | 10 +-
.../e2e/server/SingletonProviderTest.java | 8 +-
.../SingletonProvidersResourcesTest.java | 14 +-
.../e2e/server/SingletonResourceTest.java | 6 +-
.../e2e/server/StreamMethodCallTest.java | 14 +-
.../tests/e2e/server/SubResourceTest.java | 52 +-
.../server/SubjectSecurityContextTest.java | 4 +-
.../e2e/server/UriBuilderTemplateTest.java | 21 +-
.../WebApplicationExceptionLoggingTest.java | 12 +-
.../server/filter/PostToPutDeleteTest.java | 6 +-
.../e2e/server/filter/RolesAllowedTest.java | 8 +-
...riConnegLanguageMediaTypeNegativeTest.java | 6 +-
.../UriConnegLanguageMediaTypeTest.java | 6 +-
.../server/filter/UriConnegLanguageTest.java | 6 +-
.../server/filter/UriConnegMediaTypeTest.java | 6 +-
.../monitoring/ApplicationInfoTest.java | 139 +++--
.../server/monitoring/EventListenerTest.java | 18 +-
.../e2e/server/monitoring/MBeansTest.java | 20 +-
.../MonitoringStatisticsLocatorTest.java | 10 +-
.../ReloadApplicationEventTest.java | 29 +-
.../monitoring/StatisticsDestroyTest.java | 35 +-
.../mvc/BeanValidationErrorTemplateTest.java | 12 +-
.../server/mvc/CustomViewableContextTest.java | 6 +-
.../e2e/server/mvc/ErrorTemplateTest.java | 12 +-
.../mvc/ExceptionViewProcessorTest.java | 10 +-
.../mvc/ExplicitProduceTemplateTest.java | 8 +-
.../e2e/server/mvc/ExplicitTemplateTest.java | 6 +-
.../mvc/FlatInheritedViewProcessorTest.java | 6 +-
.../e2e/server/mvc/FlatViewProcessorTest.java | 6 +-
.../ImplicitProducesViewProcessorTest.java | 6 +-
.../mvc/ImplicitTemplateProgrammaticTest.java | 6 +-
.../e2e/server/mvc/ImplicitTemplateTest.java | 6 +-
.../ImplicitViewWithResourceFilterTest.java | 8 +-
.../mvc/InheritedViewProcessorTest.java | 6 +-
.../tests/e2e/server/mvc/MvcEncodingTest.java | 167 +++---
.../mvc/TemplateMethodSelectionTest.java | 10 +-
.../e2e/server/mvc/ViewProcessorTest.java | 6 +-
.../spi/AbstractTemplateProcessorTest.java | 23 +-
.../e2e/server/routing/InheritanceTest.java | 6 +-
.../routing/RegularExpressionsTest.java | 4 +-
.../ResponseMediaTypeFromProvidersTest.java | 6 +-
.../scanning/RankedProviderScanningTest.java | 6 +-
.../tests/e2e/server/scanning/Resource.java | 4 +-
.../validation/BasicValidationTest.java | 10 +-
.../e2e/server/validation/ContactBean.java | 7 +-
.../CustomConfigValidationTest.java | 10 +-
.../EntityInheritanceValidationTest.java | 6 +-
.../FieldPropertyValidationTest.java | 6 +-
.../validation/InheritanceValidationTest.java | 6 +-
.../ProgrammaticValidationTest.java | 6 +-
.../validation/PropertyValidationTest.java | 6 +-
.../AnotherContactBean.java | 7 +-
.../ValidateOnExecutionAbstractTest.java | 13 +-
.../ValidateOnExecutionBasicTest.java | 12 +-
...ateOnExecutionInheritanceGenericsTest.java | 7 +-
.../ValidateOnExecutionInheritanceTest.java | 5 +-
.../ValidateOnExecutionOverrideTest.java | 6 +-
.../server/wadl/OverrideWadlResourceTest.java | 6 +-
.../server/wadl/ResourceExtendedFlagTest.java | 6 +-
.../e2e/server/wadl/WadlBeanParamTest.java | 71 +--
.../server/wadl/WadlEmptyMediaTypeTest.java | 6 +-
.../e2e/server/wadl/WadlResourceTest.java | 45 +-
.../tests/e2e/BeforeClassParallelTest.java | 10 +-
tests/e2e/pom.xml | 12 +-
.../jersey/tests/api/AbortingFilterTest.java | 27 +-
.../api/AcceptMediaTypeProviderTest.java | 8 +-
.../tests/api/AnnotationInheritanceTest.java | 24 +-
.../tests/api/ApplicationCachingTest.java | 10 +-
.../tests/api/CacheControlImplTest.java | 6 +-
.../tests/api/ClientInvocationTest.java | 6 +-
.../tests/api/ConstructorSelectionTest.java | 14 +-
.../jersey/tests/api/ConsumeProduceTest.java | 6 +-
.../tests/api/ContentDispositionTest.java | 10 +-
.../jersey/tests/api/CookieImplTest.java | 8 +-
.../tests/api/EntityTagProviderTest.java | 6 +-
.../jersey/tests/api/ExceptionTest.java | 15 +-
.../api/FormDataContentDispositionTest.java | 8 +-
.../jersey/tests/api/HttpHeaderTest.java | 6 +-
.../jersey/tests/api/LocaleProviderTest.java | 6 +-
.../tests/api/LocationHeaderAsyncTest.java | 31 +-
.../tests/api/LocationHeaderBasicTest.java | 29 +-
.../tests/api/LocationHeaderFiltersTest.java | 26 +-
...nHeaderWithAbsolutizationDisabledTest.java | 8 +-
...ocationHeaderWithIncompatibleFlagTest.java | 8 +-
.../tests/api/MediaTypeProviderTest.java | 8 +-
.../tests/api/MessageBodyReaderTest.java | 6 +-
.../tests/api/MessageBodyWriterTest.java | 8 +-
.../jersey/tests/api/OptionsTest.java | 8 +-
.../QualitySourceMediaTypeProviderTest.java | 8 +-
.../jersey/tests/api/ResourceContextTest.java | 14 +-
.../jersey/tests/api/ResponseE2ETest.java | 46 +-
.../tests/api/ResponseIntegrationTest.java | 6 +-
.../jersey/tests/api/ResponseTest.java | 12 +-
.../tests/api/RestrictedHeaderTest.java | 14 +-
.../tests/api/SourceEntityProviderTest.java | 16 +-
.../tests/api/UnsafeCharsInUriTest.java | 10 +-
.../jersey/tests/api/VariantsTest.java | 10 +-
.../jersey/tests/e2e/ClientTest.java | 24 +-
.../e2e/ExecutorServiceProviderTest.java | 65 +--
.../tests/e2e/InterceptorCustomTest.java | 10 +-
.../jersey/tests/e2e/InterceptorGzipTest.java | 6 +-
.../glassfish/jersey/tests/e2e/LinkTest.java | 8 +-
.../e2e/MessageBodyExceptionWrappingTest.java | 8 +-
.../e2e/client/connector/HugeEntityTest.java | 125 ++---
.../e2e/client/connector/MethodTest.java | 91 ++--
.../e2e/common/AutoDiscoverableTest.java | 6 +-
.../tests/e2e/common/ConstrainedToTest.java | 16 +-
.../tests/e2e/common/ContentLengthTest.java | 10 +-
.../tests/e2e/common/ContentTypeTest.java | 8 +-
.../common/DetermineContentLengthTest.java | 6 +-
.../jersey/tests/e2e/common/EncodingTest.java | 8 +-
.../e2e/common/FeatureConstraintTest.java | 6 +-
.../common/ForcedAutoDiscoverableTest.java | 6 +-
.../tests/e2e/common/HeaderParamTest.java | 4 +-
.../e2e/common/HeaderValueExceptionTest.java | 12 +-
.../e2e/common/Hk2BinderSupportTest.java | 6 +-
.../tests/e2e/common/LoggingFeatureTest.java | 17 +-
.../MessageBodyReaderUnsupportedTest.java | 10 +-
.../MessageBodyWorkerInheritanceTest.java | 6 +-
.../MessageBodyWriterObjectDistanceTest.java | 6 +-
.../jersey/tests/e2e/common/NoEntityTest.java | 12 +-
.../e2e/common/NonPublicNonStaticTest.java | 72 +--
.../common/ProvidersLegacyOrderingTest.java | 16 +-
.../e2e/common/ProvidersOrderingTest.java | 20 +-
.../e2e/common/QueryParamEncodingTest.java | 14 +-
.../tests/e2e/common/ReaderProviderTest.java | 8 +-
.../tests/e2e/common/RequestScopeTest.java | 10 +-
.../tests/e2e/common/ResponseLinksTest.java | 24 +-
.../tests/e2e/common/UriComponentTest.java | 10 +-
.../tests/e2e/container/EscapedUriTest.java | 56 +-
.../GrizzlySlashesWithContextPathTest.java | 6 +-
.../container/GzipContentEncodingTest.java | 83 +--
.../jersey/tests/e2e/container/HeadTest.java | 36 +-
.../JdkSlashesWithContextPathTest.java | 10 +-
.../tests/e2e/container/Jersey2462Test.java | 15 +-
.../e2e/container/JerseyContainerTest.java | 23 +-
.../container/JettyEmptyHeaderParamTest.java | 6 +-
.../e2e/container/LeadingSlashesTest.java | 130 +++--
.../tests/e2e/container/MatrixParamTest.java | 51 +-
.../tests/e2e/container/QueryParamTest.java | 50 +-
.../container/ResponseWriterMetadataTest.java | 59 ++-
.../ResponseWriterOutputStreamTest.java | 93 ++--
.../e2e/container/TrailingSlashTest.java | 62 ++-
.../tests/e2e/oauth/AccessTokenResource.java | 8 +-
.../jersey/tests/e2e/oauth/OAuth2Test.java | 8 +-
.../e2e/oauth/OAuthClientServerTest.java | 6 +-
.../OauthClientAuthorizationFlowTest.java | 8 +-
.../tests/e2e/oauth/PhotosResource.java | 8 +-
.../tests/e2e/oauth/RequestTokenResource.java | 8 +-
.../e2e/server/wadl/NoJAXBNoWadlTest.java | 21 +-
.../tests/e2e/sonar/SonarJerseyE2ETest.java | 10 +-
.../jersey2988/Jersey2988ITCase.java | 6 +-
tests/integration/asm/pom.xml | 4 +-
.../asm/AnnotatedClassVisitorTest.java | 27 +-
.../jersey2730/Jersey2730ITCase.java | 13 +-
.../jersey2812/Jersey2812ITCase.java | 34 +-
.../tests/cdi/bv/BaseValidationTest.java | 6 +-
.../jersey/tests/cdi/bv/CombinedTest.java | 39 +-
.../jersey/tests/cdi/bv/RawCdiTest.java | 15 +-
.../jersey/tests/cdi/bv/RawHk2Test.java | 6 +-
.../BeanManagerInjectedOnClientTest.java | 19 +-
.../tests/cdi/resources/CdiIntoEjbTest.java | 10 +-
.../tests/cdi/resources/EjbIntoCdiTest.java | 6 +-
.../jersey/tests/cdi/resources/TestBase.java | 4 +-
.../tests/cdi/resources/EchoResourceTest.java | 6 +-
.../CdiComponentProviderWarningTest.java | 21 +-
.../manuallybound/CdiServiceInjectTest.java | 19 +-
.../manuallybound/HK2ServiceInjectTest.java | 19 +-
.../cdi/web1/JaxRsCdiIntegrationTest.java | 4 +-
.../cdi/web2/JaxRsCdiIntegrationTest.java | 8 +-
.../cdi/resources/MultipartFeatureTest.java | 34 +-
.../ResourceWithConstructorTest.java | 19 +-
.../tests/cdi/singleton/SingletonTest.java | 23 +-
.../resources/CdiComponentProviderTest.java | 8 +-
.../jersey/tests/cdi/resources/CdiTest.java | 6 +-
.../resources/ConstructorInjectionTest.java | 6 +-
.../tests/cdi/resources/CounterTest.java | 10 +-
.../resources/JaxRsInjectedCdiBeanTest.java | 8 +-
.../NonJaxRsBeanJaxRsInjectionTest.java | 19 +-
.../cdi/resources/PerRequestBeanTest.java | 52 +-
.../PerRequestDependentBeanTest.java | 39 +-
.../tests/cdi/resources/ProducerTest.java | 6 +-
.../QualifiedInjectionSetGetTest.java | 6 +-
.../tests/cdi/resources/ReverseEchoTest.java | 45 +-
.../SecondJaxRsInjectedCdiBeanTest.java | 11 +-
.../cdi/resources/SingletonBeanTest.java | 53 +-
.../resources/SingletonDependentBeanTest.java | 53 +-
.../tests/cdi/resources/StutterEchoTest.java | 45 +-
.../jersey/tests/cdi/resources/TimerTest.java | 10 +-
.../cdi/resources/CustomInjectionTest.java | 43 +-
.../cdi/resources/ExceptionMappersTest.java | 39 +-
.../tests/cdi/resources/MonitoringTest.java | 39 +-
.../cdi/resources/RequestSensitiveTest.java | 70 +--
.../jersey/tests/cdi/resources/CdiTest.java | 4 +-
.../cdi/resources/CustomInjectionTest.java | 95 ++--
.../cdi/resources/ExceptionMappersTest.java | 75 +--
.../tests/cdi/resources/MonitoringTest.java | 79 +--
.../cdi/resources/RequestSensitiveTest.java | 100 ++--
.../cdi/resources/CustomInjectionTest.java | 39 +-
.../cdi/resources/ExceptionMappersTest.java | 39 +-
.../tests/cdi/resources/MonitoringTest.java | 28 +-
.../cdi/resources/RequestSensitiveTest.java | 70 +--
.../NonScopedApplicationInjectTest.java | 21 +-
.../cdi/inject/NonScopedInjectionTest.java | 29 +-
.../inject/ScopedApplicationInjectTest.java | 21 +-
.../tests/cdi/inject/ScopedInjectionTest.java | 29 +-
.../jersey/tests/cdi/inject/SseTest.java | 25 +-
.../cdi-integration/gf-cdi-inject/pom.xml | 4 +-
.../provider/CustomConnectorProviderTest.java | 10 +-
.../ejb/reload/web1/ReloadTest.java | 4 +-
.../reload/web2/JaxRsFromEjbLibraryTest.java | 4 +-
.../ejb/web1/JaxRsFromEjbLibraryTest.java | 4 +-
.../jersey/tests/ejb/resources/EjbTest.java | 4 +-
tests/integration/externalproperties/pom.xml | 4 +-
.../externalproperties/HttpProxyTest.java | 16 +-
.../tests/integration/j376/J376Test.java | 14 +-
.../integration/j441/one/ContextPathTest.java | 4 +-
.../integration/j441/two/ContextPathTest.java | 4 +-
.../integration/j59/cdi/web/NameBeanTest.java | 4 +-
.../jaxrs/inject/ApplicationInjectITCase.java | 6 +-
.../jersey1107/ApplicationHandlerITCase.java | 8 +-
.../jersey1223/ApplicationHandlerITCase.java | 6 +-
.../jersey1604/ConnectionCloseITCase.java | 4 +-
.../jersey1667/Jersey1667ITCase.java | 4 +-
.../jersey1829/ApplicationHandlerITCase.java | 14 +-
.../jersey1883/Jersey1883ITCase.java | 12 +-
.../jersey1928/Jersey1928ITCase.java | 4 +-
.../jersey1960/Jersey1960ITCase.java | 6 +-
.../jersey1964/Jersey1964ITCase.java | 51 +-
.../jersey2031/Jersey2031ITCase.java | 4 +-
.../jersey2136/Jersey2136ITCase.java | 8 +-
.../jersey2137/WaeExceptionMappingTest.java | 6 +-
.../jersey2154/EjbExceptionMappingTest.java | 6 +-
.../jersey2160/Jersey2160ITCase.java | 6 +-
.../jersey2164/Jersey2164ITCase.java | 4 +-
.../jersey2167/Jersey2167ITCase.java | 10 +-
.../jersey2176/Jersey2176ITCaseBase.java | 38 +-
.../jersey2184/Jersey2184ITCase.java | 14 +-
.../jersey2255/Jersey2255ITCase.java | 6 +-
.../jersey2322/Jersey2322ITCase.java | 4 +-
.../jersey2335/Jersey2335ITCase.java | 6 +-
tests/integration/jersey-2421/pom.xml | 10 +-
.../jersey2421/Jersey2421Test.java | 9 +-
.../jersey2551/Jersey2551ITCase.java | 4 +-
.../jersey2612/Jersey2612ITCase.java | 4 +-
.../jersey2637/Jersey2637DisabledITCase.java | 4 +-
.../jersey2637/Jersey2637EnabledITCase.java | 44 +-
.../jersey2654/Jersey2654ITCase.java | 6 +-
.../jersey2673/Jersey2673ITCase.java | 6 +-
.../jersey2689/Jersey2689ITCase.java | 8 +-
.../jersey2704/Jersey2704ITCase.java | 10 +-
.../jersey2776/Jersey2776ITCase.java | 10 +-
.../jersey2794/Jersey2794ITCase.java | 6 +-
.../jersey2846/Jersey2846ITCase.java | 6 +-
.../jersey2878/Jersey2878ITCase.java | 6 +-
.../AbstractJerseyEntityFilteringITCase.java | 16 +-
tests/integration/jersey-3662/pom.xml | 4 +-
...ExternalApplicationParamConverterTest.java | 6 +-
.../jersey3796/Jersey3796ITCase.java | 16 +-
.../jersey/tests/cdi/resources/CdiTest.java | 6 +-
.../tests/cdi/resources/InheritanceTest.java | 6 +-
.../jersey4003/LostResponseTest.java | 60 +--
...orityAnnotationOnExceptionMappersTest.java | 10 +-
.../integration/jersey4321/StreamingTest.java | 6 +-
.../tests/integration/jersey4507/SSETest.java | 17 +-
.../ProgrammaticValidationTest.java | 17 +-
.../MonitoringEventListenerTest.java | 9 +-
.../jersey4722/Jersey4722Test.java | 10 +-
.../jersey4949/Jersey4949ITCase.java | 10 +-
.../jersey780/HelloWorldResourceITCase.java | 14 +-
.../integration/jetty-response-close/pom.xml | 10 +
.../config/HelidonConfigApplicationTest.java | 8 +-
.../microprofile/rest-client/pom.xml | 6 +-
.../jersey/restclient/ConnectorTest.java | 4 +-
.../restclient/ConsumesAndProducesTest.java | 21 +-
.../InboundHeadersProviderTest.java | 10 +-
.../restclient/RestClientModelTest.java | 6 +-
.../rest-client14-compatibility/pom.xml | 4 +-
.../compatibility/Compatibility14Test.java | 21 +-
.../portability/PortabilityITCase.java | 6 +-
tests/integration/property-check/pom.xml | 5 +-
...ystemPropertiesConfigurationModelTest.java | 12 +-
.../PropertyOverlappingCheckTest.java | 6 +-
.../integration/reactive-streams/sse/pom.xml | 4 +-
.../media/sse/internal/SseSubscriberTest.java | 8 +-
.../SecurityDigestAuthenticationITCase.java | 44 +-
.../LanguageVariantResourceITCase.java | 6 +-
.../ValidationResourceITCase.java | 6 +-
.../servlet_2_5_filter/MyResourceITCase.java | 8 +-
.../InflectorInjectionTestITCase.java | 6 +-
.../Servlet25Init1ITCase.java | 19 +-
.../HelloWorldResourceITCase.java | 6 +-
.../HelloWorldResourceITCase.java | 6 +-
.../HelloWorldResourceITCase.java | 6 +-
.../HelloWorldResourceITCase.java | 21 +-
.../HelloWorldResourceITCase.java | 6 +-
.../HelloWorldResourceITCase.java | 6 +-
.../HelloWorldResourceITCase.java | 6 +-
.../servlet_25_mvc_1/BookstoreITCase.java | 26 +-
.../servlet_25_mvc_1/ItemITCase.java | 12 +-
.../servlet_25_mvc_1/TestSupport.java | 10 +-
.../servlet_25_mvc_2/BookstoreITCase.java | 12 +-
.../servlet_25_mvc_2/ItemITCase.java | 12 +-
.../servlet_25_mvc_3/BookstoreITCase.java | 12 +-
.../servlet_25_mvc_3/ItemITCase.java | 22 +-
.../servlet_25_mvc_3/TestSupport.java | 10 +-
.../ReloadTestIT.java | 8 +-
.../AsyncServletResourceITCase.java | 39 +-
.../AsyncTimeoutResourceITCase.java | 6 +-
.../ChunkedInputOutputITCase.java | 27 +-
.../servlet_3_filter/MyResourceITCase.java | 8 +-
.../AsyncCancelTimeoutResourceTest.java | 6 +-
.../AsyncResumeTimeoutResourceTest.java | 6 +-
.../AsyncServletResourceTest.java | 35 +-
.../InflectorInjectionTestITCase.java | 6 +-
.../HelloWorldResourceITCase.java | 8 +-
tests/integration/servlet-3-init-2/pom.xml | 5 +-
.../HelloWorldResourceITCase.java | 6 +-
.../EmptyApplicationTestITCase.java | 6 +-
.../EmptyApplicationTestITCase.java | 6 +-
.../HelloWorldResourceITCase.java | 6 +-
.../EmptyApplicationITCase.java | 6 +-
.../HelloWorldResourceITCase.java | 6 +-
.../HelloWorldResourceITCase.java | 57 +-
.../HelloWorldResourceUnreachableITCase.java | 45 +-
.../HelloWorldResourceITCase.java | 6 +-
.../AbstractHelloWorldResourceTest.java | 14 +-
.../HelloWorld1ResourceITCase.java | 12 +-
.../HelloWorld3ResourceITCase.java | 8 +-
.../HelloWorld4ResourceITCase.java | 8 +-
.../HelloWorld5ResourceITCase.java | 8 +-
.../servlet_3_params/ParamsTestITCase.java | 6 +-
.../ItemStoreResourceITCase.java | 38 +-
.../servlet_40_mvc_1/GzipITCase.java | 8 +-
.../servlet_40_mvc_1/TestSupport.java | 10 +-
.../AbstractRequestResponseTypeTest.java | 4 +-
.../AbstractRequestResponseTypeTest.java | 4 +-
.../servlettests/CacheControlOn404ITCase.java | 6 +-
.../Custom404MediaTypeITCase.java | 18 +-
.../servlettests/DuplicateHeaderITCase.java | 8 +-
.../servlettests/FilterContextPathITCase.java | 6 +-
.../servlettests/FormConsumptionITCase.java | 6 +-
.../servlettests/ForwardOn404ITCase.java | 6 +-
.../servlettests/InvalidRequestUriITCase.java | 6 +-
.../RolesAllowedFilterITCase.java | 6 +-
.../StaticContentRegexITCase.java | 6 +-
.../integration/sonar/JerseySonarITCase.java | 10 +-
.../spring/test/AccountResourceITCase.java | 6 +-
.../spring/test/AccountResourceTestBase.java | 8 +-
.../spring/test/JerseyManagedITCase.java | 6 +-
.../test/SpringManagedControllerITCase.java | 6 +-
.../test/SpringManagedEndpointITCase.java | 6 +-
.../spring/test/SpringManagedITCase.java | 6 +-
.../test/SpringManagedRepositoryITCase.java | 6 +-
.../test/SpringManagedServiceITCase.java | 6 +-
.../spring/test/AccountResourceITCase.java | 6 +-
.../spring/test/AccountResourceTestBase.java | 8 +-
.../spring/test/JerseyManagedITCase.java | 6 +-
.../test/SpringManagedControllerITCase.java | 6 +-
.../test/SpringManagedEndpointITCase.java | 6 +-
.../spring/test/SpringManagedITCase.java | 6 +-
.../test/SpringManagedRepositoryITCase.java | 6 +-
.../test/SpringManagedServiceITCase.java | 6 +-
.../tracing/AllTracingSupportITCase.java | 99 ++--
.../tracing/OnDemandTracingSupportITCase.java | 10 +-
tests/jmockit/pom.xml | 4 +-
.../FormDataMultiPartReaderWriterTest.java | 8 +-
.../jmockit/server/ResourceConfigTest.java | 6 +-
.../scanning/PackageNamesScannerTest.java | 40 +-
.../BeanParamLeakResourceITCase.java | 20 +-
.../testleak/MemoryLeakingResourceITCase.java | 18 +-
.../client/EndlessShutdownHookLeakTest.java | 13 +-
.../ShutdownLeakResourceITCase.java | 18 +-
tests/osgi/functional/pom.xml | 6 +
.../AbstractJsonOsgiIntegrationTest.java | 4 +-
.../benchmark/server/JacksonTest.java | 6 +-
.../benchmark/server/LocatorTest.java | 6 +-
.../filter/dynamic/FilterTest.java | 6 +-
.../performance/filter/global/FilterTest.java | 6 +-
.../performance/filter/name/FilterTest.java | 6 +-
.../interceptor/dynamic/InterceptorTest.java | 6 +-
.../interceptor/global/InterceptorTest.java | 6 +-
.../interceptor/name/InterceptorTest.java | 6 +-
.../mbw/custom/PersonEntityTest.java | 6 +-
.../performance/mbw/json/JsonEntityTest.java | 6 +-
.../performance/mbw/json/JsonEntityTest.java | 6 +-
.../mbw/kryo/PersonResourceTest.java | 6 +-
.../performance/mbw/text/TextEntityTest.java | 6 +-
.../performance/mbw/xml/XmlEntityTest.java | 6 +-
.../performance/mbw/xml/XmlEntityTest.java | 6 +-
.../performance/test-cases/monitoring/pom.xml | 8 +-
.../performance/param/srl/SrlSrmTest.java | 6 +-
.../injection/InjectedResourcesTest.java | 6 +-
...MultiThreadingAggregatedReservoirTest.java | 32 +-
.../jersey-release-notes-maven-plugin/pom.xml | 2 +-
1218 files changed, 11479 insertions(+), 10916 deletions(-)
create mode 100644 core-common/src/test/resources/surefire-jdk17.policy
rename tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/json/{AbstractJsonTest.java => JsonTest.java} (96%)
diff --git a/archetypes/jersey-heroku-webapp/src/main/resources/archetype-resources/src/test/java/MyResourceTest.java b/archetypes/jersey-heroku-webapp/src/main/resources/archetype-resources/src/test/java/MyResourceTest.java
index f0c141c0cb..1212f6f9fa 100644
--- a/archetypes/jersey-heroku-webapp/src/main/resources/archetype-resources/src/test/java/MyResourceTest.java
+++ b/archetypes/jersey-heroku-webapp/src/main/resources/archetype-resources/src/test/java/MyResourceTest.java
@@ -5,8 +5,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import ${package}.MyResource;
diff --git a/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/pom.xml b/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/pom.xml
index 42416bbd12..9dcb68bb61 100644
--- a/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/pom.xml
+++ b/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/pom.xml
@@ -38,9 +38,9 @@
-->
- junit
- junit
- 4.12
+ org.junit.jupiter
+ junit-jupiter
+ \${junit-jupiter.version}
test
@@ -77,6 +77,7 @@
${project.version}
+ 5.9.1
UTF-8
diff --git a/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/src/test/java/MyResourceTest.java b/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/src/test/java/MyResourceTest.java
index 6986107bcb..901bc19283 100644
--- a/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/src/test/java/MyResourceTest.java
+++ b/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/src/test/java/MyResourceTest.java
@@ -6,17 +6,17 @@
import org.glassfish.grizzly.http.server.HttpServer;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class MyResourceTest {
private HttpServer server;
private WebTarget target;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
// start the server
server = Main.startServer();
@@ -32,7 +32,7 @@ public void setUp() throws Exception {
target = c.target(Main.BASE_URI);
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
server.stop();
}
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AsyncTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AsyncTest.java
index 82e2d5d49d..4c6702b04a 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AsyncTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AsyncTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -40,10 +40,10 @@
import org.glassfish.jersey.test.JerseyTest;
import org.hamcrest.Matchers;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Asynchronous connector test.
@@ -210,7 +210,7 @@ public String call() throws Exception {
}
});
- assertTrue("Waiting for results has timed out.", latch.await(5 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS));
+ assertTrue(latch.await(5 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS), "Waiting for results has timed out.");
final long toc = System.currentTimeMillis();
assertEquals("DONE-1", r1.get());
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AuthTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AuthTest.java
index dceb272c62..9bced7a7f4 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AuthTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AuthTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -44,12 +44,12 @@
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.junit.Ignore;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Paul Sandoz
@@ -398,7 +398,7 @@ public void testAuthGetWithDigestFilter() {
}
@Test
- @Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
+ @Disabled("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
+ " Allow repeatable write in jersey?")
public void testAuthPost() {
CredentialsProvider credentialsProvider = new org.apache.http.impl.client.BasicCredentialsProvider();
@@ -474,7 +474,7 @@ public void testAuthInteractiveGet() {
}
@Test
- @Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
+ @Disabled("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
+ " Allow repeatable write in jersey?")
public void testAuthInteractivePost() {
CredentialsProvider credentialsProvider = new org.apache.http.impl.client.BasicCredentialsProvider();
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CookieTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CookieTest.java
index c387fcecf3..5e2c66bb6a 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CookieTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CookieTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -34,11 +34,11 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Paul Sandoz
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CustomLoggingFilter.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CustomLoggingFilter.java
index d6c4259576..a26aea8f54 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CustomLoggingFilter.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CustomLoggingFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -27,7 +27,7 @@
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Custom logging filter.
@@ -43,28 +43,28 @@ public class CustomLoggingFilter implements ContainerRequestFilter, ContainerRes
@Override
public void filter(ClientRequestContext context) throws IOException {
System.out.println("CustomLoggingFilter.preFilter called");
- assertEquals(context.getConfiguration().getProperty("foo"), "bar");
+ assertEquals("bar", context.getConfiguration().getProperty("foo"));
preFilterCalled++;
}
@Override
public void filter(ClientRequestContext context, ClientResponseContext clientResponseContext) throws IOException {
System.out.println("CustomLoggingFilter.postFilter called");
- assertEquals(context.getConfiguration().getProperty("foo"), "bar");
+ assertEquals("bar", context.getConfiguration().getProperty("foo"));
postFilterCalled++;
}
@Override
public void filter(ContainerRequestContext context) throws IOException {
System.out.println("CustomLoggingFilter.preFilter called");
- assertEquals(context.getProperty("foo"), "bar");
+ assertEquals("bar", context.getProperty("foo"));
preFilterCalled++;
}
@Override
public void filter(ContainerRequestContext context, ContainerResponseContext containerResponseContext) throws IOException {
System.out.println("CustomLoggingFilter.postFilter called");
- assertEquals(context.getProperty("foo"), "bar");
+ assertEquals("bar", context.getProperty("foo"));
postFilterCalled++;
}
}
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/DisableContentEncodingTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/DisableContentEncodingTest.java
index 4e2681feb5..dfd5b17cd9 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/DisableContentEncodingTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/DisableContentEncodingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -30,8 +30,8 @@
import org.glassfish.jersey.test.JerseyTest;
import org.apache.http.client.config.RequestConfig;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Ondrej Kosatka
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/FollowRedirectsTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/FollowRedirectsTest.java
index f55bf78f66..c789a1a905 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/FollowRedirectsTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/FollowRedirectsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -36,8 +36,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Apache connector follow redirect tests.
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/GZIPContentEncodingTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/GZIPContentEncodingTest.java
index fb2503e78f..bfa86988d5 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/GZIPContentEncodingTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/GZIPContentEncodingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -34,8 +34,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Paul Sandoz
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HelloWorldTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HelloWorldTest.java
index e6a29e5be9..dab72b3232 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HelloWorldTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HelloWorldTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -63,11 +63,11 @@
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HttpContext;
-import org.junit.Assert;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Jakub Podlesak
@@ -160,11 +160,11 @@ public void _testConnectionPoolSharing(final boolean sharingEnabled) throws Exce
try {
target.request().get();
if (exceptionExpected) {
- Assert.fail("Exception expected");
+ Assertions.fail("Exception expected");
}
} catch (Exception e) {
if (!exceptionExpected) {
- Assert.fail("Exception not expected");
+ Assertions.fail("Exception not expected");
}
} finally {
clientTwo.close();
@@ -603,10 +603,10 @@ public void shutdown() {
final String response = rootTarget.path("error2").request().get(String.class);
fail("Exception expected. Received: " + response);
} catch (InternalServerErrorException isee) {
- assertEquals("Received unexpected data.", "Error2.", isee.getResponse().readEntity(String.class));
+ assertEquals("Error2.", isee.getResponse().readEntity(String.class), "Received unexpected data.");
// Test buffering:
// second read would fail if entity was not buffered
- assertEquals("Unexpected data in the entity buffer.", "Error2.", isee.getResponse().readEntity(String.class));
+ assertEquals("Error2.", isee.getResponse().readEntity(String.class), "Unexpected data in the entity buffer.");
}
assertEquals(0, connectionCounter.get());
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpEntityTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpEntityTest.java
index f7d2b161c3..19d9784279 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpEntityTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpEntityTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -22,8 +22,8 @@
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -65,8 +65,8 @@ public void testInputStreamEntity() {
InputStreamEntity entity = new InputStreamEntity(bais);
try (Response response = target().request().post(Entity.entity(entity, MediaType.APPLICATION_OCTET_STREAM))) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
}
}
@@ -75,8 +75,8 @@ public void testByteArrayEntity() {
ByteArrayEntity entity = new ByteArrayEntity(ECHO_MESSAGE.getBytes());
try (Response response = target().request().post(Entity.entity(entity, MediaType.APPLICATION_OCTET_STREAM))) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
}
}
}
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpHeadersTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpHeadersTest.java
index 5302beff77..c4d5ed7177 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpHeadersTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpHeadersTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -43,9 +43,9 @@
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Paul Sandoz
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodTest.java
index f507504348..b21940d658 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -39,13 +39,12 @@
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Paul Sandoz
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/LargeDataTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/LargeDataTest.java
index 938096c7df..059a3c0597 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/LargeDataTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/LargeDataTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -37,8 +37,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
/**
* The LargeDataTest reproduces a problem when bytes of large data sent are incorrectly sent.
@@ -107,9 +107,8 @@ public void postWithLargeData() throws Throwable {
throw exception;
}
- Assert.assertEquals("Unexpected error: " + response.getStatus(),
- Status.Family.SUCCESSFUL,
- response.getStatusInfo().getFamily());
+ Assertions.assertEquals(Status.Family.SUCCESSFUL, response.getStatusInfo().getFamily(),
+ "Unexpected error: " + response.getStatus());
} finally {
response.close();
}
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ManagedClientTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ManagedClientTest.java
index a263177d22..d3c5644156 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ManagedClientTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ManagedClientTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -46,8 +46,8 @@
import org.glassfish.jersey.server.Uri;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Jersey programmatic managed client test
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/NoEntityTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/NoEntityTest.java
index a162e14648..27ba0ca5f3 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/NoEntityTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/NoEntityTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -31,7 +31,7 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* @author Paul Sandoz
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/RetryHandlerTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/RetryHandlerTest.java
index f779d12698..7a135af18c 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/RetryHandlerTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/RetryHandlerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -36,8 +36,8 @@
import org.glassfish.jersey.test.JerseyTest;
import org.apache.http.client.HttpRequestRetryHandler;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class RetryHandlerTest extends JerseyTest {
private static final int READ_TIMEOUT_MS = 100;
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/SpecialHeaderTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/SpecialHeaderTest.java
index 25bfadb4e2..0d17af5f06 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/SpecialHeaderTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/SpecialHeaderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -29,9 +29,9 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
*
@@ -67,23 +67,23 @@ protected void configureClient(ClientConfig config) {
@Test
- @Ignore("Apache connector does not provide information about encoding for gzip and deflate encoding")
+ @Disabled("Apache connector does not provide information about encoding for gzip and deflate encoding")
public void testEncoded() {
final Response response = target().path("resource/encoded").request("text/plain").get();
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("get", response.readEntity(String.class));
- Assert.assertEquals("gzip", response.getHeaderString(HttpHeaders.CONTENT_ENCODING));
- Assert.assertEquals("text/plain", response.getHeaderString(HttpHeaders.CONTENT_TYPE));
- Assert.assertEquals(3, response.getHeaderString(HttpHeaders.CONTENT_LENGTH));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("get", response.readEntity(String.class));
+ Assertions.assertEquals("gzip", response.getHeaderString(HttpHeaders.CONTENT_ENCODING));
+ Assertions.assertEquals("text/plain", response.getHeaderString(HttpHeaders.CONTENT_TYPE));
+ Assertions.assertEquals(3, response.getHeaderString(HttpHeaders.CONTENT_LENGTH));
}
@Test
public void testNonEncoded() {
final Response response = target().path("resource/non-encoded").request("text/plain").get();
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("get", response.readEntity(String.class));
- Assert.assertNull(response.getHeaderString(HttpHeaders.CONTENT_ENCODING));
- Assert.assertEquals("text/plain", response.getHeaderString(HttpHeaders.CONTENT_TYPE));
- Assert.assertEquals("3", response.getHeaderString(HttpHeaders.CONTENT_LENGTH));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("get", response.readEntity(String.class));
+ Assertions.assertNull(response.getHeaderString(HttpHeaders.CONTENT_ENCODING));
+ Assertions.assertEquals("text/plain", response.getHeaderString(HttpHeaders.CONTENT_TYPE));
+ Assertions.assertEquals("3", response.getHeaderString(HttpHeaders.CONTENT_LENGTH));
}
}
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/StreamingTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/StreamingTest.java
index c5ef31e4b0..10dcbcf0b9 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/StreamingTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/StreamingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -38,8 +38,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Petr Janouch
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TimeoutTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TimeoutTest.java
index 66860cf517..6947b6666e 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TimeoutTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TimeoutTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -31,11 +31,11 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Martin Matula
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TraceSupportTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TraceSupportTest.java
index c0442f2d44..e6c593bafb 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TraceSupportTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TraceSupportTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -45,10 +45,10 @@
import org.glassfish.jersey.server.model.Resource;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* This very basic resource showcases support of a HTTP TRACE method,
@@ -129,9 +129,9 @@ public void testProgrammaticApp() throws Exception {
String responseEntity = response.readEntity(String.class);
for (String expectedFragment : expectedFragmentsProgrammatic) {
- assertTrue("Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity,
- // toLowerCase - http header field names are case insensitive
- responseEntity.contains(expectedFragment));
+ assertTrue(// toLowerCase - http header field names are case insensitive
+ responseEntity.contains(expectedFragment),
+ "Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity);
}
}
@@ -143,9 +143,9 @@ public void testAnnotatedApp() throws Exception {
String responseEntity = response.readEntity(String.class);
for (String expectedFragment : expectedFragmentsAnnotated) {
- assertTrue("Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity,
- // toLowerCase - http header field names are case insensitive
- responseEntity.contains(expectedFragment));
+ assertTrue(// toLowerCase - http header field names are case insensitive
+ responseEntity.contains(expectedFragment),
+ "Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity);
}
}
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingCookieStoreAccessTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingCookieStoreAccessTest.java
index 3238c8162f..808fef960b 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingCookieStoreAccessTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingCookieStoreAccessTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -23,9 +23,9 @@
import org.glassfish.jersey.client.ClientConfig;
import org.apache.http.client.CookieStore;
-import org.junit.Test;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
/**
* Test of access to the underlying CookieStore instance used by the connector.
@@ -44,9 +44,9 @@ public void testCookieStoreInstanceAccess() {
final WebTarget target = client.target("http://localhost/");
final CookieStore csOnTarget = ApacheConnectorProvider.getCookieStore(target);
- assertNotNull("CookieStore instance set on JerseyClient should not be null.", csOnClient);
- assertNotNull("CookieStore instance set on JerseyWebTarget should not be null.", csOnTarget);
- assertSame("CookieStore instance set on JerseyClient should be the same instance as the one set on JerseyWebTarget"
- + "(provided the target instance has not been further configured).", csOnClient, csOnTarget);
+ assertNotNull(csOnClient, "CookieStore instance set on JerseyClient should not be null.");
+ assertNotNull(csOnTarget, "CookieStore instance set on JerseyWebTarget should not be null.");
+ assertSame(csOnClient, csOnTarget, "CookieStore instance set on JerseyClient should be the same instance as the one "
+ + "set on JerseyWebTarget (provided the target instance has not been further configured).");
}
}
diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingHttpClientAccessTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingHttpClientAccessTest.java
index 61b9bd0225..18b3eee118 100644
--- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingHttpClientAccessTest.java
+++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingHttpClientAccessTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -23,9 +23,9 @@
import org.glassfish.jersey.client.ClientConfig;
import org.apache.http.client.HttpClient;
-import org.junit.Test;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
/**
* Test of access to the underlying HTTP client instance used by the connector.
@@ -47,11 +47,9 @@ public void testHttpClientInstanceAccess() {
final WebTarget target = client.target("http://localhost/");
final HttpClient hcOnTarget = ApacheConnectorProvider.getHttpClient(target);
- assertNotNull("HTTP client instance set on JerseyClient should not be null.", hcOnClient);
- assertNotNull("HTTP client instance set on JerseyWebTarget should not be null.", hcOnTarget);
- assertSame("HTTP client instance set on JerseyClient should be the same instance as the one set on JerseyWebTarget"
- + "(provided the target instance has not been further configured).",
- hcOnClient, hcOnTarget
- );
+ assertNotNull(hcOnClient, "HTTP client instance set on JerseyClient should not be null.");
+ assertNotNull(hcOnTarget, "HTTP client instance set on JerseyWebTarget should not be null.");
+ assertSame(hcOnClient, hcOnTarget, "HTTP client instance set on JerseyClient should be the same instance as the one "
+ + "set on JerseyWebTarget (provided the target instance has not been further configured).");
}
}
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/AsyncTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/AsyncTest.java
index 50e8f6571f..6ac74e5049 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/AsyncTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/AsyncTest.java
@@ -40,10 +40,10 @@
import org.glassfish.jersey.test.JerseyTest;
import org.hamcrest.Matchers;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Asynchronous connector test.
@@ -210,7 +210,7 @@ public String call() throws Exception {
}
});
- assertTrue("Waiting for results has timed out.", latch.await(5 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS));
+ assertTrue(latch.await(5 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS), "Waiting for results has timed out.");
final long toc = System.currentTimeMillis();
assertEquals("DONE-1", r1.get());
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/AuthTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/AuthTest.java
index f59c0cf9bf..c16e4855d8 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/AuthTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/AuthTest.java
@@ -44,12 +44,12 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Ignore;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Paul Sandoz
@@ -398,7 +398,7 @@ public void testAuthGetWithDigestFilter() {
}
@Test
- @Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
+ @Disabled("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
+ " Allow repeatable write in jersey?")
public void testAuthPost() {
CredentialsStore credentialsProvider = new BasicCredentialsProvider();
@@ -474,7 +474,7 @@ public void testAuthInteractiveGet() {
}
@Test
- @Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
+ @Disabled("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
+ " Allow repeatable write in jersey?")
public void testAuthInteractivePost() {
CredentialsStore credentialsProvider = new BasicCredentialsProvider();
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/CookieTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/CookieTest.java
index 0e619a661a..1ff230006f 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/CookieTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/CookieTest.java
@@ -34,11 +34,11 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Paul Sandoz
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/CustomLoggingFilter.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/CustomLoggingFilter.java
index 27caedad53..60e4cc8d34 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/CustomLoggingFilter.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/CustomLoggingFilter.java
@@ -27,7 +27,7 @@
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Custom logging filter.
@@ -43,28 +43,28 @@ public class CustomLoggingFilter implements ContainerRequestFilter, ContainerRes
@Override
public void filter(ClientRequestContext context) throws IOException {
System.out.println("CustomLoggingFilter.preFilter called");
- assertEquals(context.getConfiguration().getProperty("foo"), "bar");
+ assertEquals("bar", context.getConfiguration().getProperty("foo"));
preFilterCalled++;
}
@Override
public void filter(ClientRequestContext context, ClientResponseContext clientResponseContext) throws IOException {
System.out.println("CustomLoggingFilter.postFilter called");
- assertEquals(context.getConfiguration().getProperty("foo"), "bar");
+ assertEquals("bar", context.getConfiguration().getProperty("foo"));
postFilterCalled++;
}
@Override
public void filter(ContainerRequestContext context) throws IOException {
System.out.println("CustomLoggingFilter.preFilter called");
- assertEquals(context.getProperty("foo"), "bar");
+ assertEquals("bar", context.getProperty("foo"));
preFilterCalled++;
}
@Override
public void filter(ContainerRequestContext context, ContainerResponseContext containerResponseContext) throws IOException {
System.out.println("CustomLoggingFilter.postFilter called");
- assertEquals(context.getProperty("foo"), "bar");
+ assertEquals("bar", context.getProperty("foo"));
postFilterCalled++;
}
}
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/DisableContentEncodingTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/DisableContentEncodingTest.java
index 51bc6a007c..9bd1572c31 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/DisableContentEncodingTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/DisableContentEncodingTest.java
@@ -30,8 +30,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Ondrej Kosatka
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/FollowRedirectsTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/FollowRedirectsTest.java
index 9377a0a741..27a54c94e9 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/FollowRedirectsTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/FollowRedirectsTest.java
@@ -36,8 +36,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Apache connector follow redirect tests.
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/GZIPContentEncodingTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/GZIPContentEncodingTest.java
index 0230ba14e0..298ca42dbf 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/GZIPContentEncodingTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/GZIPContentEncodingTest.java
@@ -34,8 +34,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Paul Sandoz
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HelloWorldTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HelloWorldTest.java
index e0f6612177..2dc697c23b 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HelloWorldTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HelloWorldTest.java
@@ -52,11 +52,11 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Jakub Podlesak
@@ -149,11 +149,11 @@ public void _testConnectionPoolSharing(final boolean sharingEnabled) throws Exce
try {
target.request().get();
if (exceptionExpected) {
- Assert.fail("Exception expected");
+ Assertions.fail("Exception expected");
}
} catch (Exception e) {
if (!exceptionExpected) {
- Assert.fail("Exception not expected");
+ Assertions.fail("Exception not expected");
}
} finally {
clientTwo.close();
@@ -389,10 +389,10 @@ public void close() throws IOException {
final String response = rootTarget.path("error2").request().get(String.class);
fail("Exception expected. Received: " + response);
} catch (InternalServerErrorException isee) {
- assertEquals("Received unexpected data.", "Error2.", isee.getResponse().readEntity(String.class));
+ assertEquals("Error2.", isee.getResponse().readEntity(String.class), "Received unexpected data.");
// Test buffering:
// second read would fail if entity was not buffered
- assertEquals("Unexpected data in the entity buffer.", "Error2.", isee.getResponse().readEntity(String.class));
+ assertEquals("Error2.", isee.getResponse().readEntity(String.class), "Unexpected data in the entity buffer.");
}
assertEquals(0, connectionCounter.get());
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpEntityTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpEntityTest.java
index cad5ea8494..5581fc92a6 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpEntityTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpEntityTest.java
@@ -23,8 +23,8 @@
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -66,8 +66,8 @@ public void testInputStreamEntity() {
InputStreamEntity entity = new InputStreamEntity(bais, ContentType.TEXT_PLAIN);
try (Response response = target().request().post(Entity.entity(entity, MediaType.APPLICATION_OCTET_STREAM))) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
}
}
@@ -76,8 +76,8 @@ public void testByteArrayEntity() {
ByteArrayEntity entity = new ByteArrayEntity(ECHO_MESSAGE.getBytes(), ContentType.TEXT_PLAIN);
try (Response response = target().request().post(Entity.entity(entity, MediaType.APPLICATION_OCTET_STREAM))) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
}
}
}
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpHeadersTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpHeadersTest.java
index c63b7a87ee..cea6db2a09 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpHeadersTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpHeadersTest.java
@@ -43,9 +43,9 @@
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Paul Sandoz
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpMethodTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpMethodTest.java
index 00a45a15b6..1f4830378c 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpMethodTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/HttpMethodTest.java
@@ -41,11 +41,11 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Paul Sandoz
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/LargeDataTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/LargeDataTest.java
index 40f1b4136d..fc67712c3f 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/LargeDataTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/LargeDataTest.java
@@ -37,8 +37,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
/**
* The LargeDataTest reproduces a problem when bytes of large data sent are incorrectly sent.
@@ -107,9 +107,8 @@ public void postWithLargeData() throws Throwable {
throw exception;
}
- Assert.assertEquals("Unexpected error: " + response.getStatus(),
- Status.Family.SUCCESSFUL,
- response.getStatusInfo().getFamily());
+ Assertions.assertEquals(Status.Family.SUCCESSFUL, response.getStatusInfo().getFamily(),
+ "Unexpected error: " + response.getStatus());
} finally {
response.close();
}
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/ManagedClientTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/ManagedClientTest.java
index 46ba4ee018..cd3468252f 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/ManagedClientTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/ManagedClientTest.java
@@ -46,8 +46,8 @@
import org.glassfish.jersey.server.Uri;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Jersey programmatic managed client test
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/NoEntityTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/NoEntityTest.java
index cdea49be4c..e00ded91e0 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/NoEntityTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/NoEntityTest.java
@@ -31,7 +31,7 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* @author Paul Sandoz
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/RetryStrategyTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/RetryStrategyTest.java
index 6254c430fc..cdfc30fbd2 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/RetryStrategyTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/RetryStrategyTest.java
@@ -40,8 +40,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class RetryStrategyTest extends JerseyTest {
private static final int READ_TIMEOUT_MS = 100;
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/SpecialHeaderTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/SpecialHeaderTest.java
index ce6a377883..8803ac43d8 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/SpecialHeaderTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/SpecialHeaderTest.java
@@ -29,9 +29,9 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
*
@@ -67,23 +67,23 @@ protected void configureClient(ClientConfig config) {
@Test
- @Ignore("Apache connector does not provide information about encoding for gzip and deflate encoding")
+ @Disabled("Apache connector does not provide information about encoding for gzip and deflate encoding")
public void testEncoded() {
final Response response = target().path("resource/encoded").request("text/plain").get();
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("get", response.readEntity(String.class));
- Assert.assertEquals("gzip", response.getHeaderString(HttpHeaders.CONTENT_ENCODING));
- Assert.assertEquals("text/plain", response.getHeaderString(HttpHeaders.CONTENT_TYPE));
- Assert.assertEquals(3, response.getHeaderString(HttpHeaders.CONTENT_LENGTH));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("get", response.readEntity(String.class));
+ Assertions.assertEquals("gzip", response.getHeaderString(HttpHeaders.CONTENT_ENCODING));
+ Assertions.assertEquals("text/plain", response.getHeaderString(HttpHeaders.CONTENT_TYPE));
+ Assertions.assertEquals(3, response.getHeaderString(HttpHeaders.CONTENT_LENGTH));
}
@Test
public void testNonEncoded() {
final Response response = target().path("resource/non-encoded").request("text/plain").get();
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("get", response.readEntity(String.class));
- Assert.assertNull(response.getHeaderString(HttpHeaders.CONTENT_ENCODING));
- Assert.assertEquals("text/plain", response.getHeaderString(HttpHeaders.CONTENT_TYPE));
- Assert.assertEquals("3", response.getHeaderString(HttpHeaders.CONTENT_LENGTH));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("get", response.readEntity(String.class));
+ Assertions.assertNull(response.getHeaderString(HttpHeaders.CONTENT_ENCODING));
+ Assertions.assertEquals("text/plain", response.getHeaderString(HttpHeaders.CONTENT_TYPE));
+ Assertions.assertEquals("3", response.getHeaderString(HttpHeaders.CONTENT_LENGTH));
}
}
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/StreamingTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/StreamingTest.java
index ea90e79879..7a05f61c53 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/StreamingTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/StreamingTest.java
@@ -37,8 +37,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Petr Janouch
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/TimeoutTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/TimeoutTest.java
index 7eab1b30b6..0d69457105 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/TimeoutTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/TimeoutTest.java
@@ -31,11 +31,11 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Martin Matula
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/TraceSupportTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/TraceSupportTest.java
index d95c2f21c8..c4c2d3a037 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/TraceSupportTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/TraceSupportTest.java
@@ -45,10 +45,10 @@
import org.glassfish.jersey.server.model.Resource;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* This very basic resource showcases support of a HTTP TRACE method,
@@ -129,9 +129,9 @@ public void testProgrammaticApp() throws Exception {
String responseEntity = response.readEntity(String.class);
for (String expectedFragment : expectedFragmentsProgrammatic) {
- assertTrue("Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity,
- // toLowerCase - http header field names are case insensitive
- responseEntity.contains(expectedFragment));
+ assertTrue(// toLowerCase - http header field names are case insensitive
+ responseEntity.contains(expectedFragment),
+ "Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity);
}
}
@@ -143,9 +143,9 @@ public void testAnnotatedApp() throws Exception {
String responseEntity = response.readEntity(String.class);
for (String expectedFragment : expectedFragmentsAnnotated) {
- assertTrue("Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity,
- // toLowerCase - http header field names are case insensitive
- responseEntity.contains(expectedFragment));
+ assertTrue(// toLowerCase - http header field names are case insensitive
+ responseEntity.contains(expectedFragment),
+ "Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity);
}
}
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/UnderlyingCookieStoreAccessTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/UnderlyingCookieStoreAccessTest.java
index 8248fdd7d8..1250637ac7 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/UnderlyingCookieStoreAccessTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/UnderlyingCookieStoreAccessTest.java
@@ -23,9 +23,9 @@
import org.apache.hc.client5.http.cookie.CookieStore;
import org.glassfish.jersey.client.ClientConfig;
-import org.junit.Test;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
/**
* Test of access to the underlying CookieStore instance used by the connector.
@@ -44,9 +44,9 @@ public void testCookieStoreInstanceAccess() {
final WebTarget target = client.target("http://localhost/");
final CookieStore csOnTarget = Apache5ConnectorProvider.getCookieStore(target);
- assertNotNull("CookieStore instance set on JerseyClient should not be null.", csOnClient);
- assertNotNull("CookieStore instance set on JerseyWebTarget should not be null.", csOnTarget);
- assertSame("CookieStore instance set on JerseyClient should be the same instance as the one set on JerseyWebTarget"
- + "(provided the target instance has not been further configured).", csOnClient, csOnTarget);
+ assertNotNull(csOnClient, "CookieStore instance set on JerseyClient should not be null.");
+ assertNotNull(csOnTarget, "CookieStore instance set on JerseyWebTarget should not be null.");
+ assertSame(csOnClient, csOnTarget, "CookieStore instance set on JerseyClient should be the same instance as the one "
+ + "set on JerseyWebTarget (provided the target instance has not been further configured).");
}
}
diff --git a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/UnderlyingHttpClientAccessTest.java b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/UnderlyingHttpClientAccessTest.java
index 0c2e320b62..d8aec2ca3b 100644
--- a/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/UnderlyingHttpClientAccessTest.java
+++ b/connectors/apache5-connector/src/test/java/org/glassfish/jersey/apache5/connector/UnderlyingHttpClientAccessTest.java
@@ -23,9 +23,9 @@
import org.apache.hc.client5.http.classic.HttpClient;
import org.glassfish.jersey.client.ClientConfig;
-import org.junit.Test;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
/**
* Test of access to the underlying HTTP client instance used by the connector.
@@ -47,11 +47,9 @@ public void testHttpClientInstanceAccess() {
final WebTarget target = client.target("http://localhost/");
final HttpClient hcOnTarget = Apache5ConnectorProvider.getHttpClient(target);
- assertNotNull("HTTP client instance set on JerseyClient should not be null.", hcOnClient);
- assertNotNull("HTTP client instance set on JerseyWebTarget should not be null.", hcOnTarget);
- assertSame("HTTP client instance set on JerseyClient should be the same instance as the one set on JerseyWebTarget"
- + "(provided the target instance has not been further configured).",
- hcOnClient, hcOnTarget
- );
+ assertNotNull(hcOnClient, "HTTP client instance set on JerseyClient should not be null.");
+ assertNotNull(hcOnTarget, "HTTP client instance set on JerseyWebTarget should not be null.");
+ assertSame(hcOnClient, hcOnTarget, "HTTP client instance set on JerseyClient should be the same instance as the one"
+ + " set on JerseyWebTarget (provided the target instance has not been further configured).");
}
}
diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/AsyncTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/AsyncTest.java
index 754c371a44..bc970c7329 100644
--- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/AsyncTest.java
+++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/AsyncTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -36,9 +36,9 @@
import org.glassfish.jersey.test.JerseyTest;
import org.hamcrest.Matchers;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* Asynchronous connector test.
diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/CustomizersTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/CustomizersTest.java
index 75e0ca0f9f..23a82880c9 100644
--- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/CustomizersTest.java
+++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/CustomizersTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -32,9 +32,9 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.RequestBuilder;
diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/FollowRedirectsTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/FollowRedirectsTest.java
index 21f8879f3d..2d86199ea0 100644
--- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/FollowRedirectsTest.java
+++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/FollowRedirectsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -34,8 +34,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Grizzly connector follow redirect tests.
diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpHeadersTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpHeadersTest.java
index 2772864450..81576091da 100644
--- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpHeadersTest.java
+++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpHeadersTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -26,9 +26,9 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the headers.
diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpMethodTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpMethodTest.java
index 3f905042e2..6752870471 100644
--- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpMethodTest.java
+++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpMethodTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -19,7 +19,7 @@
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -30,8 +30,8 @@
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Response;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the Http methods.
diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/NoEntityTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/NoEntityTest.java
index a6db9eef1d..8e7cfe5b7f 100644
--- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/NoEntityTest.java
+++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/NoEntityTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -31,7 +31,7 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* @author Paul Sandoz
diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/ParallelTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/ParallelTest.java
index 8cd48ba650..2016b583e2 100644
--- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/ParallelTest.java
+++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/ParallelTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -37,10 +37,10 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the parallel execution of multiple requests.
@@ -120,15 +120,15 @@ public void run() {
startBarrier.await(1, TimeUnit.SECONDS);
- assertTrue("Waiting for clients to finish has timed out.", doneLatch.await(5 * getAsyncTimeoutMultiplier(),
- TimeUnit.SECONDS));
+ assertTrue(doneLatch.await(5 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS),
+ "Waiting for clients to finish has timed out.");
- assertEquals("Resource counter", PARALLEL_CLIENTS, resourceCounter.get());
+ assertEquals(PARALLEL_CLIENTS, resourceCounter.get(), "Resource counter");
- assertEquals("Received counter", PARALLEL_CLIENTS, receivedCounter.get());
+ assertEquals(PARALLEL_CLIENTS, receivedCounter.get(), "Received counter");
} finally {
executor.shutdownNow();
- Assert.assertTrue("Executor termination", executor.awaitTermination(5, TimeUnit.SECONDS));
+ Assertions.assertTrue(executor.awaitTermination(5, TimeUnit.SECONDS), "Executor termination");
}
}
}
diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TimeoutTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TimeoutTest.java
index f920bd7802..0d771af14e 100644
--- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TimeoutTest.java
+++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TimeoutTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -29,11 +29,11 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Martin Matula
diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TraceSupportTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TraceSupportTest.java
index d5b2cf5c46..d11646bd23 100644
--- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TraceSupportTest.java
+++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TraceSupportTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -45,10 +45,10 @@
import org.glassfish.jersey.server.model.Resource;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* This very basic resource showcases support of a HTTP TRACE method,
@@ -129,9 +129,9 @@ public void testProgrammaticApp() throws Exception {
String responseEntity = response.readEntity(String.class);
for (String expectedFragment : expectedFragmentsProgrammatic) {
- assertTrue("Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity,
- // toLowerCase - http header field names are case insensitive
- responseEntity.contains(expectedFragment));
+ assertTrue(// toLowerCase - http header field names are case insensitive
+ responseEntity.contains(expectedFragment),
+ "Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity);
}
}
@@ -143,9 +143,9 @@ public void testAnnotatedApp() throws Exception {
String responseEntity = response.readEntity(String.class);
for (String expectedFragment : expectedFragmentsAnnotated) {
- assertTrue("Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity,
- // toLowerCase - http header field names are case insensitive
- responseEntity.contains(expectedFragment));
+ assertTrue(// toLowerCase - http header field names are case insensitive
+ responseEntity.contains(expectedFragment),
+ "Expected fragment '" + expectedFragment + "' not found in response:\n" + responseEntity);
}
}
diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/UnderlyingHttpClientAccessTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/UnderlyingHttpClientAccessTest.java
index eee7992a49..2edae61143 100644
--- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/UnderlyingHttpClientAccessTest.java
+++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/UnderlyingHttpClientAccessTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -22,9 +22,9 @@
import org.glassfish.jersey.client.ClientConfig;
-import org.junit.Test;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
import com.ning.http.client.AsyncHttpClient;
@@ -48,11 +48,9 @@ public void testHttpClientInstanceAccess() {
final WebTarget target = client.target("http://localhost/");
final AsyncHttpClient hcOnTarget = GrizzlyConnectorProvider.getHttpClient(target);
- assertNotNull("HTTP client instance set on JerseyClient should not be null.", hcOnClient);
- assertNotNull("HTTP client instance set on JerseyWebTarget should not be null.", hcOnTarget);
- assertSame("HTTP client instance set on JerseyClient should be the same instance as the one set on JerseyWebTarget"
- + "(provided the target instance has not been further configured).",
- hcOnClient, hcOnTarget
- );
+ assertNotNull(hcOnClient, "HTTP client instance set on JerseyClient should not be null.");
+ assertNotNull(hcOnTarget, "HTTP client instance set on JerseyWebTarget should not be null.");
+ assertSame(hcOnClient, hcOnTarget, "HTTP client instance set on JerseyClient should be the same instance as the one "
+ + "set on JerseyWebTarget (provided the target instance has not been further configured).");
}
}
diff --git a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/AsyncTest.java b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/AsyncTest.java
index b6189db57a..4d6c9b3b30 100644
--- a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/AsyncTest.java
+++ b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/AsyncTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -21,7 +21,7 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.hamcrest.Matchers;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -36,8 +36,8 @@
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* Asynchronous connector test.
diff --git a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/BasicHelidonConnectorTest.java b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/BasicHelidonConnectorTest.java
index 4af0ebec99..48d7db5506 100644
--- a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/BasicHelidonConnectorTest.java
+++ b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/BasicHelidonConnectorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -21,10 +21,11 @@
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.glassfish.jersey.test.spi.TestHelper;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DynamicContainer;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestFactory;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@@ -45,7 +46,9 @@
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -55,21 +58,9 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-@RunWith(Parameterized.class)
-public class BasicHelidonConnectorTest extends JerseyTest {
-
- private final String entityType;
-
- public BasicHelidonConnectorTest(String entityType) {
- this.entityType = entityType;
- }
-
- @Parameterized.Parameters
- public static Object[] data() {
- return new Object[]{"BYTE_ARRAY_OUTPUT_STREAM", "READABLE_BYTE_CHANNEL", "OUTPUT_STREAM_PUBLISHER"};
- }
+public class BasicHelidonConnectorTest {
@Path("basic")
public static class BasicResource {
@@ -112,6 +103,10 @@ public String putConsumesProduces(String content) {
}
}
+ public static List data() {
+ return Arrays.asList("BYTE_ARRAY_OUTPUT_STREAM", "READABLE_BYTE_CHANNEL", "OUTPUT_STREAM_PUBLISHER");
+ }
+
@Path("async")
public static class AsyncResource {
private static CountDownLatch shortLong = null;
@@ -137,181 +132,200 @@ public String shortGet() {
}
}
- @Override
- protected Application configure() {
- return new ResourceConfig(BasicResource.class, AsyncResource.class)
- .property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, "WARNING");
+ @TestFactory
+ public Collection generateTests() {
+ Collection tests = new ArrayList<>();
+ data().forEach(entityType -> {
+ BasicHelidonConnectorTemplateTest test = new BasicHelidonConnectorTemplateTest(entityType) {};
+ tests.add(TestHelper.toTestContainer(test, entityType));
+ });
+ return tests;
}
- @Override
- protected void configureClient(ClientConfig config) {
- super.configureClient(config);
- config.connectorProvider(new HelidonConnectorProvider());
- config.property("jersey.config.helidon.client.entity.type", entityType);
- }
+ public abstract static class BasicHelidonConnectorTemplateTest extends JerseyTest {
+
+ private final String entityType;
- @Test
- public void testBasicGet() {
- try (Response response = target("basic").path("get").request().get()) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("ok", response.readEntity(String.class));
+ public BasicHelidonConnectorTemplateTest(String entityType) {
+ this.entityType = entityType;
}
- }
- @Test
- public void testBasicPost() {
- try (Response response = target("basic").path("post").request()
- .buildPost(Entity.entity("ok", MediaType.TEXT_PLAIN_TYPE)).invoke()) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("okok", response.readEntity(String.class));
+ @Override
+ protected Application configure() {
+ return new ResourceConfig(BasicResource.class, AsyncResource.class)
+ .property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, "WARNING");
}
- }
- @Test
- public void queryGetTest() {
- try (Response response = target("basic").path("getquery")
- .queryParam("first", "hello")
- .queryParam("second", "world")
- .request().get()) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("helloworld", response.readEntity(String.class));
+ @Override
+ protected void configureClient(ClientConfig config) {
+ super.configureClient(config);
+ config.connectorProvider(new HelidonConnectorProvider());
+ config.property("jersey.config.helidon.client.entity.type", entityType);
}
- }
- @Test
- public void testHeaders() {
- String[][] headers = new String[][]{{"X-TEST-ONE", "ONE"}, {"X-TEST-TWO", "TWO"}, {"X-TEST-THREE", "THREE"}};
- MultivaluedHashMap map = new MultivaluedHashMap<>();
- Arrays.stream(headers).forEach(a -> map.add(a[0], a[1]));
- try (Response response = target("basic").path("headers").request().headers(map).get()) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("ok", response.readEntity(String.class));
- for (int i = 0; i != headers.length; i++) {
- Assert.assertTrue(response.getHeaders().containsKey(headers[i][0]));
- Assert.assertEquals(headers[i][1], response.getStringHeaders().getFirst(headers[i][0]));
+ @Test
+ public void testBasicGet() {
+ try (Response response = target("basic").path("get").request().get()) {
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("ok", response.readEntity(String.class));
}
}
- }
- @Test
- public void testProduces() {
- try (Response response = target("basic").path("produces/consumes").request("test/z-test")
- .put(Entity.entity("ok", new MediaType("test", "x-test")))) {
- Assert.assertEquals(406, response.getStatus());
+ @Test
+ public void testBasicPost() {
+ try (Response response = target("basic").path("post").request()
+ .buildPost(Entity.entity("ok", MediaType.TEXT_PLAIN_TYPE)).invoke()) {
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("okok", response.readEntity(String.class));
+ }
}
- try (Response response = target("basic").path("produces/consumes").request()
- .put(Entity.entity("ok", new MediaType("test", "x-test")))) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("okok", response.readEntity(String.class));
- Assert.assertEquals("test/y-test", response.getStringHeaders().getFirst(HttpHeaders.CONTENT_TYPE));
+ @Test
+ public void queryGetTest() {
+ try (Response response = target("basic").path("getquery")
+ .queryParam("first", "hello")
+ .queryParam("second", "world")
+ .request().get()) {
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("helloworld", response.readEntity(String.class));
+ }
}
- }
- @Test
- public void testAsyncGet() throws ExecutionException, InterruptedException {
- Future futureResponse = target("basic").path("get").request().async().get();
- try (Response response = futureResponse.get()) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("ok", response.readEntity(String.class));
+ @Test
+ public void testHeaders() {
+ String[][] headers = new String[][]{{"X-TEST-ONE", "ONE"}, {"X-TEST-TWO", "TWO"}, {"X-TEST-THREE", "THREE"}};
+ MultivaluedHashMap map = new MultivaluedHashMap<>();
+ Arrays.stream(headers).forEach(a -> map.add(a[0], a[1]));
+ try (Response response = target("basic").path("headers").request().headers(map).get()) {
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("ok", response.readEntity(String.class));
+ for (int i = 0; i != headers.length; i++) {
+ Assertions.assertTrue(response.getHeaders().containsKey(headers[i][0]));
+ Assertions.assertEquals(headers[i][1], response.getStringHeaders().getFirst(headers[i][0]));
+ }
+ }
+ }
+
+ @Test
+ public void testProduces() {
+ try (Response response = target("basic").path("produces/consumes").request("test/z-test")
+ .put(Entity.entity("ok", new MediaType("test", "x-test")))) {
+ Assertions.assertEquals(406, response.getStatus());
+ }
+
+ try (Response response = target("basic").path("produces/consumes").request()
+ .put(Entity.entity("ok", new MediaType("test", "x-test")))) {
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("okok", response.readEntity(String.class));
+ Assertions.assertEquals("test/y-test", response.getStringHeaders().getFirst(HttpHeaders.CONTENT_TYPE));
+ }
}
- }
- @Test
- public void testConsumes() {
- try (Response response = target("basic").path("produces/consumes").request("test/y-test")
- .put(Entity.entity("ok", new MediaType("test", "z-test")))) {
- Assert.assertEquals(415, response.getStatus());
+ @Test
+ public void testAsyncGet() throws ExecutionException, InterruptedException {
+ Future futureResponse = target("basic").path("get").request().async().get();
+ try (Response response = futureResponse.get()) {
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("ok", response.readEntity(String.class));
+ }
}
- try (Response response = target("basic").path("produces/consumes").request("test/y-test")
- .put(Entity.entity("ok", MediaType.WILDCARD_TYPE))) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("okok", response.readEntity(String.class));
- Assert.assertEquals("test/y-test", response.getStringHeaders().getFirst(HttpHeaders.CONTENT_TYPE));
+ @Test
+ public void testConsumes() {
+ try (Response response = target("basic").path("produces/consumes").request("test/y-test")
+ .put(Entity.entity("ok", new MediaType("test", "z-test")))) {
+ Assertions.assertEquals(415, response.getStatus());
+ }
+
+ try (Response response = target("basic").path("produces/consumes").request("test/y-test")
+ .put(Entity.entity("ok", MediaType.WILDCARD_TYPE))) {
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("okok", response.readEntity(String.class));
+ Assertions.assertEquals("test/y-test", response.getStringHeaders().getFirst(HttpHeaders.CONTENT_TYPE));
+ }
}
- }
- @Test
- public void testRxGet() throws ExecutionException, InterruptedException {
- CompletableFuture futureResponse =
- target("basic").path("get").request().rx(JerseyCompletionStageRxInvoker.class).get();
+ @Test
+ public void testRxGet() throws ExecutionException, InterruptedException {
+ CompletableFuture futureResponse =
+ target("basic").path("get").request().rx(JerseyCompletionStageRxInvoker.class).get();
- try (Response response = futureResponse.get()) {
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("ok", response.readEntity(String.class));
+ try (Response response = futureResponse.get()) {
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("ok", response.readEntity(String.class));
+ }
}
- }
- @Test
- public void testInputStreamEntity() throws IOException {
- try (Response response = target("basic").path("get").request().get()) {
- Assert.assertEquals(200, response.getStatus());
- InputStream is = response.readEntity(InputStream.class);
- Assert.assertEquals('o', is.read());
- Assert.assertEquals('k', is.read());
- is.close();
+ @Test
+ public void testInputStreamEntity() throws IOException {
+ try (Response response = target("basic").path("get").request().get()) {
+ Assertions.assertEquals(200, response.getStatus());
+ InputStream is = response.readEntity(InputStream.class);
+ Assertions.assertEquals('o', is.read());
+ Assertions.assertEquals('k', is.read());
+ is.close();
+ }
}
- }
- // -----------Async
+ // -----------Async
- @Test
- public void testTwoClientsAsync() throws ExecutionException, InterruptedException {
- try (Response resetResponse = target("async").path("reset").request().get()) {
- Assert.assertEquals(204, resetResponse.getStatus());
- }
+ @Test
+ public void testTwoClientsAsync() throws ExecutionException, InterruptedException {
+ try (Response resetResponse = target("async").path("reset").request().get()) {
+ Assertions.assertEquals(204, resetResponse.getStatus());
+ }
- ClientConfig config = new ClientConfig();
- config.connectorProvider(new HelidonConnectorProvider());
+ ClientConfig config = new ClientConfig();
+ config.connectorProvider(new HelidonConnectorProvider());
- Client longClient = ClientBuilder.newClient(config);
- Invocation.Builder longRequest = longClient.target(getBaseUri()).path("async/long").request();
+ Client longClient = ClientBuilder.newClient(config);
+ Invocation.Builder longRequest = longClient.target(getBaseUri()).path("async/long").request();
- Client shortClient = ClientBuilder.newClient(config);
- Invocation.Builder shortRequest = shortClient.target(getBaseUri()).path("async/short").request();
+ Client shortClient = ClientBuilder.newClient(config);
+ Invocation.Builder shortRequest = shortClient.target(getBaseUri()).path("async/short").request();
- Future futureLongResponse = longRequest.async().get();
- Future futureShortResponse = shortRequest.async().get();
+ Future futureLongResponse = longRequest.async().get();
+ Future futureShortResponse = shortRequest.async().get();
- try (Response shortResponse = futureShortResponse.get()) {
- Assert.assertEquals(200, shortResponse.getStatus());
- Assert.assertEquals("short", shortResponse.readEntity(String.class));
- }
+ try (Response shortResponse = futureShortResponse.get()) {
+ Assertions.assertEquals(200, shortResponse.getStatus());
+ Assertions.assertEquals("short", shortResponse.readEntity(String.class));
+ }
- try (Response longResponse = futureLongResponse.get()) {
- Assert.assertEquals(200, longResponse.getStatus());
- Assert.assertEquals("long", longResponse.readEntity(String.class));
+ try (Response longResponse = futureLongResponse.get()) {
+ Assertions.assertEquals(200, longResponse.getStatus());
+ Assertions.assertEquals("long", longResponse.readEntity(String.class));
+ }
}
- }
- @Test
- public void testOneClientsTwoReqestsAsync() throws ExecutionException, InterruptedException {
- try (Response resetResponse = target("async").path("reset").request().get()) {
- Assert.assertEquals(204, resetResponse.getStatus());
- }
+ @Test
+ public void testOneClientsTwoReqestsAsync() throws ExecutionException, InterruptedException {
+ try (Response resetResponse = target("async").path("reset").request().get()) {
+ Assertions.assertEquals(204, resetResponse.getStatus());
+ }
- Invocation.Builder longRequest = target().path("async/long").request();
- Invocation.Builder shortRequest = target().path("async/short").request();
+ Invocation.Builder longRequest = target().path("async/long").request();
+ Invocation.Builder shortRequest = target().path("async/short").request();
- Future futureLongResponse = longRequest.async().get();
- Future futureShortResponse = shortRequest.async().get();
+ Future futureLongResponse = longRequest.async().get();
+ Future futureShortResponse = shortRequest.async().get();
- try (Response shortResponse = futureShortResponse.get()) {
- Assert.assertEquals(200, shortResponse.getStatus());
- Assert.assertEquals("short", shortResponse.readEntity(String.class));
- }
+ try (Response shortResponse = futureShortResponse.get()) {
+ Assertions.assertEquals(200, shortResponse.getStatus());
+ Assertions.assertEquals("short", shortResponse.readEntity(String.class));
+ }
- try (Response longResponse = futureLongResponse.get()) {
- Assert.assertEquals(200, longResponse.getStatus());
- Assert.assertEquals("long", longResponse.readEntity(String.class));
+ try (Response longResponse = futureLongResponse.get()) {
+ Assertions.assertEquals(200, longResponse.getStatus());
+ Assertions.assertEquals("long", longResponse.readEntity(String.class));
+ }
}
- }
- @Test
- public void testOptionsWithEntity() {
- Response response = target("basic").path("get").request().build("OPTIONS", Entity.text("OPTIONS")).invoke();
- assertEquals(200, response.getStatus());
- response.close();
+ @Test
+ public void testOptionsWithEntity() {
+ Response response = target("basic").path("get").request().build("OPTIONS", Entity.text("OPTIONS")).invoke();
+ assertEquals(200, response.getStatus());
+ response.close();
+ }
}
}
diff --git a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/FollowRedirectsTest.java b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/FollowRedirectsTest.java
index 87105d666a..60a2826bae 100644
--- a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/FollowRedirectsTest.java
+++ b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/FollowRedirectsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -22,7 +22,7 @@
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -36,7 +36,7 @@
import java.io.IOException;
import java.util.logging.Logger;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Helidon connector follow redirect tests.
diff --git a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/LargeDataTest.java b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/LargeDataTest.java
index 8a7a6907df..8b6792eadb 100644
--- a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/LargeDataTest.java
+++ b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/LargeDataTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -20,8 +20,8 @@
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -106,9 +106,8 @@ public void postWithLargeData() throws Throwable {
throw exception;
}
- Assert.assertEquals("Unexpected error: " + response.getStatus(),
- Status.Family.SUCCESSFUL,
- response.getStatusInfo().getFamily());
+ Assertions.assertEquals(Status.Family.SUCCESSFUL, response.getStatusInfo().getFamily(),
+ "Unexpected error: " + response.getStatus());
} finally {
response.close();
}
diff --git a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/ParallelTest.java b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/ParallelTest.java
index 94a1d26a41..6ef37cd3b6 100644
--- a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/ParallelTest.java
+++ b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/ParallelTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -19,8 +19,8 @@
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -38,8 +38,8 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the parallel execution of multiple requests.
@@ -119,15 +119,15 @@ public void run() {
startBarrier.await(1, TimeUnit.SECONDS);
- assertTrue("Waiting for clients to finish has timed out.", doneLatch.await(5 * getAsyncTimeoutMultiplier(),
- TimeUnit.SECONDS));
+ assertTrue(doneLatch.await(5 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS),
+ "Waiting for clients to finish has timed out.");
- assertEquals("Resource counter", PARALLEL_CLIENTS, resourceCounter.get());
+ assertEquals(PARALLEL_CLIENTS, resourceCounter.get(), "Resource counter");
- assertEquals("Received counter", PARALLEL_CLIENTS, receivedCounter.get());
+ assertEquals(PARALLEL_CLIENTS, receivedCounter.get(), "Received counter");
} finally {
executor.shutdownNow();
- Assert.assertTrue("Executor termination", executor.awaitTermination(5, TimeUnit.SECONDS));
+ Assertions.assertTrue(executor.awaitTermination(5, TimeUnit.SECONDS), "Executor termination");
}
}
}
diff --git a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/TimeoutTest.java b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/TimeoutTest.java
index 1fe6374177..3ae1470e41 100644
--- a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/TimeoutTest.java
+++ b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/TimeoutTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -20,8 +20,8 @@
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -29,8 +29,8 @@
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Response;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Martin Matula
@@ -82,7 +82,7 @@ public void testSlow() {
}
}
- @Ignore
+ @Disabled
// TODO - WebClient change request
public void testTimeoutInRequest() {
try {
diff --git a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/sse/EventOutputTest.java b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/sse/EventOutputTest.java
index 5eb76e8e50..cd98a6d430 100644
--- a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/sse/EventOutputTest.java
+++ b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/sse/EventOutputTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -28,8 +28,8 @@
import org.glassfish.jersey.media.sse.SseFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -48,10 +48,10 @@
import java.util.concurrent.atomic.AtomicReference;
import static org.hamcrest.Matchers.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Event output tests.
@@ -179,12 +179,12 @@ public void onEvent(InboundEvent inboundEvent) {
closeTimedOut = es.close(5, TimeUnit.SECONDS);
}
- assertEquals("Unexpected event count", 2, eventComments.size());
+ assertEquals(2, eventComments.size(), "Unexpected event count");
for (int i = 1; i <= 2; i++) {
- assertEquals("Unexpected comment data on event #" + i, "No comment #" + i, eventComments.poll());
+ assertEquals("No comment #" + i, eventComments.poll(), "Unexpected comment data on event #" + i);
}
- assertTrue("Event latch has timed out", latchTimedOut);
- assertTrue("EventSource.close() has timed out", closeTimedOut);
+ assertTrue(latchTimedOut, "Event latch has timed out");
+ assertTrue(closeTimedOut, "EventSource.close() has timed out");
}
@Test
@@ -265,8 +265,8 @@ public void onEvent(InboundEvent inboundEvent) {
}
// 2.0.0.-M3 assertEquals("Unexpected event count", 1, counter.get());
- assertEquals("Unexpected event data", "single", eventData.get());
- assertTrue("Event latch has timed out", latchTimedOut);
- assertTrue("EventSource.close() has timed out", closeTimedOut);
+ assertEquals("single", eventData.get(), "Unexpected event data");
+ assertTrue(latchTimedOut, "Event latch has timed out");
+ assertTrue(closeTimedOut, "EventSource.close() has timed out");
}
}
diff --git a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/sse/SseTest.java b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/sse/SseTest.java
index cba0763f2d..a102d9bc2b 100644
--- a/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/sse/SseTest.java
+++ b/connectors/helidon-connector/src/test/java/org/glassfish/jersey/helidon/connector/sse/SseTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -20,8 +20,8 @@
import org.glassfish.jersey.helidon.connector.HelidonConnectorProvider;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import javax.annotation.PostConstruct;
import javax.inject.Singleton;
@@ -119,8 +119,8 @@ public void testSend() throws InterruptedException {
latch.await(WAIT_TIME, TimeUnit.MILLISECONDS);
}
- Assert.assertEquals("AAAAAAAAAA", sb.toString());
- Assert.assertEquals(0, latch.getCount());
+ Assertions.assertEquals("AAAAAAAAAA", sb.toString());
+ Assertions.assertEquals(0, latch.getCount());
}
@Test
@@ -137,11 +137,11 @@ public void testBroadcast() throws InterruptedException {
clientOne.messageLatch.await(WAIT_TIME, TimeUnit.MILLISECONDS);
clientTwo.messageLatch.await(WAIT_TIME, TimeUnit.MILLISECONDS);
- Assert.assertEquals(0, clientOne.messageLatch.getCount());
- Assert.assertEquals(0, clientTwo.messageLatch.getCount());
+ Assertions.assertEquals(0, clientOne.messageLatch.getCount());
+ Assertions.assertEquals(0, clientTwo.messageLatch.getCount());
- Assert.assertEquals(BroadcasterResource.WELCOME + PALINDROME + PALINDROME, clientOne.message.toString());
- Assert.assertEquals(BroadcasterResource.WELCOME + PALINDROME + PALINDROME, clientTwo.message.toString());
+ Assertions.assertEquals(BroadcasterResource.WELCOME + PALINDROME + PALINDROME, clientOne.message.toString());
+ Assertions.assertEquals(BroadcasterResource.WELCOME + PALINDROME + PALINDROME, clientTwo.message.toString());
clientOne.close();
clientTwo.close();
@@ -168,13 +168,13 @@ private void register() throws InterruptedException {
source.open();
latch.await(WAIT_TIME, TimeUnit.MILLISECONDS);
- Assert.assertEquals(0, latch.getCount());
+ Assertions.assertEquals(0, latch.getCount());
}
private void broadcast() {
try (Response r = target.path("broadcast/broadcast")
.request().buildPost(Entity.entity(PALINDROME, MediaType.TEXT_PLAIN)).invoke()) {
- Assert.assertEquals(204, r.getStatus());
+ Assertions.assertEquals(204, r.getStatus());
}
}
diff --git a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/HttpMethodTest.java b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/HttpMethodTest.java
index 60f5f1bc6d..0f68e2050c 100644
--- a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/HttpMethodTest.java
+++ b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/HttpMethodTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -19,7 +19,7 @@
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -30,8 +30,8 @@
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Response;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the Http methods.
diff --git a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/AsynchronousBodyInputStreamTest.java b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/AsynchronousBodyInputStreamTest.java
index 3d64abeeb9..f67aa01b6c 100644
--- a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/AsynchronousBodyInputStreamTest.java
+++ b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/AsynchronousBodyInputStreamTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -26,14 +26,13 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import static junit.framework.TestCase.assertNull;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Petr Janouch
diff --git a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/AsynchronousBodyOutputStreamTest.java b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/AsynchronousBodyOutputStreamTest.java
index 2feea43ecc..e936df75c4 100644
--- a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/AsynchronousBodyOutputStreamTest.java
+++ b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/AsynchronousBodyOutputStreamTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -31,13 +31,12 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import static junit.framework.Assert.assertNotNull;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* @author Petr Janouch
diff --git a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/ChunkedBodyOutputStreamTest.java b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/ChunkedBodyOutputStreamTest.java
index 474e9e9c85..a54345b33e 100644
--- a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/ChunkedBodyOutputStreamTest.java
+++ b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/ChunkedBodyOutputStreamTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -19,11 +19,11 @@
import java.io.IOException;
import java.nio.ByteBuffer;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.TestCase.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Petr Janouch
diff --git a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/ConnectionPoolTest.java b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/ConnectionPoolTest.java
index 9585c54af1..2c5be92a6b 100644
--- a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/ConnectionPoolTest.java
+++ b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/ConnectionPoolTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -44,9 +44,9 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Petr Janouch
diff --git a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/CookieTest.java b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/CookieTest.java
index 82fee74e79..33ccc8534a 100644
--- a/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/CookieTest.java
+++ b/connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/CookieTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -34,9 +34,9 @@
import org.glassfish.jersey.jdk.connector.JdkConnectorProvider;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Paul Sandoz
@@ -102,7 +102,7 @@ public void testIssue4678() {
.get();
// Issue 4678 happens here. HttpParser splits the headers value by comma.
List
*/
@Test
- @Ignore("fails unpredictable (see javadoc)")
+ @Execution(ExecutionMode.CONCURRENT)
+ @Disabled("fails unpredictable (see javadoc)")
public void testDisableBufferingWithChunkEncoding() {
postLatch = new CountDownLatch(1);
@@ -168,9 +171,9 @@ public void testDisableBufferingWithChunkEncoding() {
final Response response
= client.target(getBaseUri()).path("resource")
.request().post(Entity.entity(is, MediaType.APPLICATION_OCTET_STREAM));
- Assert.assertEquals(200, response.getStatus());
+ Assertions.assertEquals(200, response.getStatus());
final long count = response.readEntity(long.class);
- Assert.assertEquals("Unexpected content length received.", LENGTH, count);
+ Assertions.assertEquals(LENGTH, count, "Unexpected content length received.");
}
private InputStream getInputStream() {
@@ -183,7 +186,7 @@ public int read() throws IOException {
if (cnt > CHUNK * 10) {
try {
postLatch.await(3 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS);
- Assert.assertEquals("waiting for chunk on the server side time-outed", 0, postLatch.getCount());
+ Assertions.assertEquals(0, postLatch.getCount(), "waiting for chunk on the server side time-outed");
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientDestroyTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientDestroyTest.java
index afb4134d8d..d9d5956d5f 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientDestroyTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientDestroyTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -42,12 +42,12 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* Assert that pre destroy method on providers is invoked.
@@ -59,7 +59,7 @@ public class ClientDestroyTest extends JerseyTest {
private static final Map destroyed = new HashMap<>();
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
destroyed.clear();
destroyed.put("filter", false);
@@ -228,22 +228,22 @@ public void testLifecycleListenerProvider() {
client.register(filterOnTarget); // instance registered into client
client.target(getBaseUri()).register(filterOnClient).request().get(String.class); // instance registration into target
- assertTrue("Filter registered on Client was expected to be already initialized.", filterOnClient.isInitialized());
- assertTrue("Filter registered on Target was expected to be already initialized.", filterOnTarget.isInitialized());
+ assertTrue(filterOnClient.isInitialized(), "Filter registered on Client was expected to be already initialized.");
+ assertTrue(filterOnTarget.isInitialized(), "Filter registered on Target was expected to be already initialized.");
client.target(getBaseUri()).register(FooListener.class).request().get(String.class); // class registration into target
- assertTrue("Class-registered filter was expected to be already initialized", FooListener.isInitialized());
+ assertTrue(FooListener.isInitialized(), "Class-registered filter was expected to be already initialized");
- assertFalse("Class-registered filter was expected to be still open.", FooListener.isClosed());
- assertFalse("Filter registered on Client was expected to be still open.", filterOnClient.isClosedByClientClose());
- assertFalse("Filter registered on Target was expected to be still open.", filterOnTarget.isClosedByClientClose());
+ assertFalse(FooListener.isClosed(), "Class-registered filter was expected to be still open.");
+ assertFalse(filterOnClient.isClosedByClientClose(), "Filter registered on Client was expected to be still open.");
+ assertFalse(filterOnTarget.isClosedByClientClose(), "Filter registered on Target was expected to be still open.");
client.close();
- assertTrue("Class-registered filter was expected to be closed.", FooListener.isClosed());
- assertTrue("Filter registered on Client was expected to be closed.", filterOnClient.isClosed());
- assertTrue("Filter registered on Target was expected to be closed.", filterOnTarget.isClosed());
+ assertTrue(FooListener.isClosed(), "Class-registered filter was expected to be closed.");
+ assertTrue(filterOnClient.isClosed(), "Filter registered on Client was expected to be closed.");
+ assertTrue(filterOnTarget.isClosed(), "Filter registered on Target was expected to be closed.");
}
private static boolean isCalledFromFinalizer() {
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientEntityAnnotationTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientEntityAnnotationTest.java
index 79288c73bf..26c619121c 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientEntityAnnotationTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientEntityAnnotationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -33,8 +33,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
/**
* Tests annotations of entity on the client side.
@@ -59,8 +59,8 @@ public void test() {
Entity post = Entity.entity("test", MediaType.WILDCARD_TYPE,
annotations);
final Response response = target().path("resource").request().post(post);
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("test", response.readEntity(String.class));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("test", response.readEntity(String.class));
}
@@ -69,8 +69,8 @@ public static class ClientFilter implements ClientRequestFilter {
@Override
public void filter(ClientRequestContext requestContext) throws IOException {
final Annotation[] entityAnnotations = requestContext.getEntityAnnotations();
- Assert.assertEquals(1, entityAnnotations.length);
- Assert.assertEquals(MyProvider.class.getAnnotation(Provider.class), entityAnnotations[0]);
+ Assertions.assertEquals(1, entityAnnotations.length);
+ Assertions.assertEquals(MyProvider.class.getAnnotation(Provider.class), entityAnnotations[0]);
}
}
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientExecutorCloseTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientExecutorCloseTest.java
index e6a09b6198..70d583f307 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientExecutorCloseTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientExecutorCloseTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -29,11 +29,11 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Petr Janouch
@@ -46,7 +46,7 @@ public class ClientExecutorCloseTest extends JerseyTest {
* Tests that closing a client shuts down a corresponding client async executor service.
*/
@Test
- @Ignore("Jersey uses ForkJoin common pool by default, which shouldn't be closed when client closes.")
+ @Disabled("Jersey uses ForkJoin common pool by default, which shouldn't be closed when client closes.")
public void testCloseAsyncExecutor() throws InterruptedException {
assertFalse(clientExecutorThreadPresent());
target("resource").request().async().get();
@@ -56,14 +56,14 @@ public void testCloseAsyncExecutor() throws InterruptedException {
.build();
eventSource.register(System.out::println);
eventSource.open();
- assertTrue("Waiting for eventSource to open time-outed", cdl.await(5000, TimeUnit.MILLISECONDS));
- assertTrue("Client async executor thread not found.", clientExecutorThreadPresent());
- assertTrue("Scheduler thread not found.", schedulerFound);
+ assertTrue(cdl.await(5000, TimeUnit.MILLISECONDS), "Waiting for eventSource to open time-outed");
+ assertTrue(clientExecutorThreadPresent(), "Client async executor thread not found.");
+ assertTrue(schedulerFound, "Scheduler thread not found.");
client().close();
- assertFalse("Client async executor thread should have been already removed.",
- clientExecutorThreadPresent());
- assertFalse("Client background scheduler thread should have been already removed.",
- clientSchedulerThreadPresent());
+ assertFalse(clientExecutorThreadPresent(),
+ "Client async executor thread should have been already removed.");
+ assertFalse(clientSchedulerThreadPresent(),
+ "Client background scheduler thread should have been already removed.");
}
private boolean clientExecutorThreadPresent() {
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientExecutorTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientExecutorTest.java
index e1230cd785..a20b28afbd 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientExecutorTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientExecutorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -43,8 +43,8 @@
import org.glassfish.jersey.spi.ExecutorServiceProvider;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
@@ -73,7 +73,7 @@ protected Application configure() {
private volatile StringBuilder threadName;
private volatile CountDownLatch latch;
- @Before
+ @BeforeEach
public void setUpThreadNameHolder() {
threadName = new StringBuilder();
latch = new CountDownLatch(1);
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientFilterTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientFilterTest.java
index 9918ad4776..f68f5415d6 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientFilterTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientFilterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -38,10 +38,10 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Pavel Bucek
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientPathTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientPathTest.java
index ee07bd7f0f..85f74111e3 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientPathTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientPathTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -29,8 +29,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Test definition of path in client invocation.
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientPreInitTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientPreInitTest.java
index ad4d687b28..b930cf2400 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientPreInitTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientPreInitTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -43,11 +43,11 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test pre initialization of the client.
@@ -110,7 +110,7 @@ public Integer readFrom(Class type, Type genericType, Annotation[] anno
}
}
- @Before
+ @BeforeEach
public void before() {
TestReader.initialized = false;
}
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/FollowRedirectHeadTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/FollowRedirectHeadTest.java
index 204ca15726..fb85c61ed9 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/FollowRedirectHeadTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/FollowRedirectHeadTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -32,8 +32,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
/**
* Tests that configuration of {@link ClientProperties#FOLLOW_REDIRECTS} works when HEAD method is used.
@@ -73,28 +73,28 @@ private WebTarget getTarget(boolean followRedirect) {
@Test
public void testDontFollowRedirectHead() throws Exception {
Response response = getTarget(false).request().head();
- Assert.assertEquals(303, response.getStatus());
- Assert.assertTrue(response.getLocation().toString().endsWith("/final"));
+ Assertions.assertEquals(303, response.getStatus());
+ Assertions.assertTrue(response.getLocation().toString().endsWith("/final"));
}
@Test
public void testDontFollowRedirectGet() throws Exception {
Response response = getTarget(false).request().get();
- Assert.assertEquals(303, response.getStatus());
- Assert.assertTrue(response.getLocation().toString().endsWith("/final"));
+ Assertions.assertEquals(303, response.getStatus());
+ Assertions.assertTrue(response.getLocation().toString().endsWith("/final"));
}
@Test
public void testFollowRedirectHead() throws Exception {
Response response = getTarget(true).request().head();
- Assert.assertEquals(200, response.getStatus());
- Assert.assertFalse(response.hasEntity());
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertFalse(response.hasEntity());
}
@Test
public void testFollowRedirectGet() throws Exception {
Response response = getTarget(true).request().get();
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("final-entity", response.readEntity(String.class));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("final-entity", response.readEntity(String.class));
}
}
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/FollowRedirectsTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/FollowRedirectsTest.java
index 12610b12f6..07a6faf47b 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/FollowRedirectsTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/FollowRedirectsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -27,8 +27,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Martin Matula
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/GenericResponseTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/GenericResponseTest.java
index 14dadcdb8f..6dca5e7343 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/GenericResponseTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/GenericResponseTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -33,8 +33,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
/**
* Test {@link GenericType} with {@link Response}.
@@ -71,8 +71,8 @@ public void testPost() {
SyncInvoker sync = target.request();
Response response = sync.post(entity, generic);
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("entity", response.readEntity(String.class));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("entity", response.readEntity(String.class));
}
@Test
@@ -84,8 +84,8 @@ public void testAsyncPost() throws ExecutionException, InterruptedException {
final AsyncInvoker async = target.request().async();
Response response = async.post(entity, generic).get();
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("entity", response.readEntity(String.class));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("entity", response.readEntity(String.class));
}
@Test
@@ -95,8 +95,8 @@ public void testGet() {
WebTarget target = target("resource");
SyncInvoker sync = target.request();
Response response = sync.get(generic);
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("get", response.readEntity(String.class));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("get", response.readEntity(String.class));
}
@Test
@@ -106,8 +106,8 @@ public void testAsyncGet() throws ExecutionException, InterruptedException {
WebTarget target = target("resource");
final AsyncInvoker async = target.request().async();
Response response = async.get(generic).get();
- Assert.assertEquals(200, response.getStatus());
- Assert.assertEquals("get", response.readEntity(String.class));
+ Assertions.assertEquals(200, response.getStatus());
+ Assertions.assertEquals("get", response.readEntity(String.class));
}
@Test
@@ -117,6 +117,6 @@ public void testGetGenericString() {
WebTarget target = target("resource");
SyncInvoker sync = target.request();
final String entity = sync.get(generic);
- Assert.assertEquals("get", entity);
+ Assertions.assertEquals("get", entity);
}
}
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpAuthorizationTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpAuthorizationTest.java
index 57419880af..753ecd9eb7 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpAuthorizationTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpAuthorizationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -43,18 +43,18 @@
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.glassfish.jersey.test.util.runner.ConcurrentRunner;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* Tests {@link org.glassfish.jersey.client.authentication.HttpAuthenticationFeature}.
*
* @author Miroslav Fuksa
*/
-@RunWith(ConcurrentRunner.class)
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class HttpAuthorizationTest extends JerseyTest {
@NameBinding
@@ -253,6 +253,7 @@ public String alternating() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testBasicPreemptive() {
Response response = target().path("resource").path("basic")
.register(HttpAuthenticationFeature.basicBuilder().credentials("homer", "Homer").build())
@@ -261,6 +262,7 @@ public void testBasicPreemptive() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testBasicNonPreemptive() {
Response response = target().path("resource").path("basic")
.register(HttpAuthenticationFeature.basicBuilder().nonPreemptive().credentials("homer", "Homer").build())
@@ -269,6 +271,7 @@ public void testBasicNonPreemptive() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testBasicNonPreemptiveWithEmptyPassword() {
final WebTarget target = target().path("resource")
.register(HttpAuthenticationFeature.basicBuilder().nonPreemptive().build());
@@ -279,7 +282,7 @@ public void testBasicNonPreemptiveWithEmptyPassword() {
response = target().path("resource").path("basic")
.register(HttpAuthenticationFeature.basicBuilder().nonPreemptive().build())
.request().get();
- Assert.fail("should throw an exception as credentials are missing");
+ Assertions.fail("should throw an exception as credentials are missing");
} catch (Exception e) {
// ok
}
@@ -292,6 +295,7 @@ public void testBasicNonPreemptiveWithEmptyPassword() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testUniversalBasic() {
Response response = target().path("resource").path("basic")
.register(HttpAuthenticationFeature.universalBuilder().credentials("homer", "Homer").build())
@@ -304,6 +308,7 @@ public void testUniversalBasic() {
* insensitve.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testUniversalBasicCaseSensitivity() {
Response response;
@@ -330,6 +335,7 @@ public void testUniversalBasicCaseSensitivity() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testUniversalBasicWrongPassword() {
Response response = target().path("resource").path("basic")
.register(HttpAuthenticationFeature.universalBuilder().credentials("homer", "FOO").build())
@@ -338,6 +344,7 @@ public void testUniversalBasicWrongPassword() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testBasicWithDifferentCredentials() {
final WebTarget target = target().path("resource").path("basic")
.register(HttpAuthenticationFeature.basicBuilder().credentials("marge", "Marge").build());
@@ -346,6 +353,7 @@ public void testBasicWithDifferentCredentials() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testBasicUniversalWithDifferentCredentials() {
final WebTarget target = target().path("resource").path("basic")
.register(HttpAuthenticationFeature.universalBuilder().credentials("marge", "Marge").build());
@@ -378,6 +386,7 @@ public void _testBasicWithDifferentCredentials(WebTarget target) {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testDigest() {
Response response = target().path("resource").path("digest")
.register(HttpAuthenticationFeature.digest("homer", "Homer"))
@@ -386,6 +395,7 @@ public void testDigest() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testDigestWithPasswords() {
final WebTarget target = target().path("resource").path("digest")
.register(HttpAuthenticationFeature.digest("homer", "Homer"));
@@ -393,6 +403,7 @@ public void testDigestWithPasswords() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testUniversalDigestWithPasswords() {
final WebTarget target = target().path("resource").path("digest")
.register(HttpAuthenticationFeature.universalBuilder().credentials("homer", "Homer").build());
@@ -420,6 +431,7 @@ public void _testDigestWithPasswords(WebTarget target) {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testDigestWithEmptyDefaultPassword() {
final WebTarget target = target().path("resource")
.register(HttpAuthenticationFeature.digest());
@@ -427,6 +439,7 @@ public void testDigestWithEmptyDefaultPassword() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testDigestUniversalWithEmptyDefaultPassword() {
final WebTarget target = target().path("resource")
.register(HttpAuthenticationFeature.universalBuilder().build());
@@ -452,7 +465,7 @@ public void _testDigestWithEmptyDefaultPassword(WebTarget target) {
.property(HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME, "bart")
.property(HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD, "Bart")
.get();
- Assert.fail("should throw an exception as no credentials were supplied for digest auth");
+ Assertions.fail("should throw an exception as no credentials were supplied for digest auth");
} catch (Exception e) {
// ok
}
@@ -464,15 +477,16 @@ public void _testDigestWithEmptyDefaultPassword(WebTarget target) {
}
private void check(Response response, int status, String entity) {
- Assert.assertEquals(status, response.getStatus());
- Assert.assertEquals(entity, response.readEntity(String.class));
+ Assertions.assertEquals(status, response.getStatus());
+ Assertions.assertEquals(entity, response.readEntity(String.class));
}
private void check(Response response, int status) {
- Assert.assertEquals(status, response.getStatus());
+ Assertions.assertEquals(status, response.getStatus());
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testDigestUniversalSimple() {
Response response = target().path("resource").path("digest")
.register(HttpAuthenticationFeature.universalBuilder().credentials("homer", "Homer").build())
@@ -481,6 +495,7 @@ public void testDigestUniversalSimple() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testDigestUniversalSimple2() {
Response response = target().path("resource").path("digest")
.register(HttpAuthenticationFeature.universalBuilder().credentialsForDigest("homer", "Homer").build())
@@ -489,6 +504,7 @@ public void testDigestUniversalSimple2() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testDigestUniversalSimple3() {
Response response = target().path("resource").path("digest")
.register(HttpAuthenticationFeature.universalBuilder()
@@ -500,6 +516,7 @@ public void testDigestUniversalSimple3() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testDigestUniversalSimple4() {
Response response = target().path("resource").path("digest")
.register(HttpAuthenticationFeature.universal("homer", "Homer"))
@@ -508,6 +525,7 @@ public void testDigestUniversalSimple4() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testUniversal() {
final WebTarget target = target().path("resource")
.register(HttpAuthenticationFeature.universal("homer", "Homer"));
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpDigestAuthFilterTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpDigestAuthFilterTest.java
index 8e6bfd905c..f959cf68fa 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpDigestAuthFilterTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpDigestAuthFilterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -38,8 +38,8 @@
import org.glassfish.jersey.test.TestProperties;
import org.glassfish.jersey.uri.UriComponent;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
/**
*
@@ -117,7 +117,7 @@ private Response verify() {
ha2);
// this generates INTERNAL_SERVER_ERROR if not matching
- Assert.assertEquals(ncExpected, Integer.parseInt(getDigestAuthHeaderValue(authHeader, "nc=")));
+ Assertions.assertEquals(ncExpected, Integer.parseInt(getDigestAuthHeaderValue(authHeader, "nc=")));
if (response.equals(getDigestAuthHeaderValue(authHeader, "response="))) {
return Response.ok().build();
@@ -238,7 +238,7 @@ private void testRequest(final String path, final boolean addParams) {
ncExpected = 1;
final Response r1 = resource.request().get();
- Assert.assertEquals(Response.Status.fromStatusCode(r1.getStatus()), Response.Status.OK);
+ Assertions.assertEquals(Response.Status.fromStatusCode(r1.getStatus()), Response.Status.OK);
}
@@ -250,15 +250,15 @@ public void testPreemptive() {
ncExpected = 1;
final Response r1 = resource.request().get();
- Assert.assertEquals(Response.Status.fromStatusCode(r1.getStatus()), Response.Status.OK);
+ Assertions.assertEquals(Response.Status.fromStatusCode(r1.getStatus()), Response.Status.OK);
ncExpected = 2;
final Response r2 = resource.request().get();
- Assert.assertEquals(Response.Status.fromStatusCode(r2.getStatus()), Response.Status.OK);
+ Assertions.assertEquals(Response.Status.fromStatusCode(r2.getStatus()), Response.Status.OK);
ncExpected = 3;
final Response r3 = resource.request().get();
- Assert.assertEquals(Response.Status.fromStatusCode(r3.getStatus()), Response.Status.OK);
+ Assertions.assertEquals(Response.Status.fromStatusCode(r3.getStatus()), Response.Status.OK);
}
@@ -270,6 +270,6 @@ public void testAuthentication() {
ncExpected = 1;
final Response r1 = resource.request().get();
- Assert.assertEquals(Response.Status.fromStatusCode(r1.getStatus()), Response.Status.UNAUTHORIZED);
+ Assertions.assertEquals(Response.Status.fromStatusCode(r1.getStatus()), Response.Status.UNAUTHORIZED);
}
}
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpHeadersInjectionTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpHeadersInjectionTest.java
index b2ff0c73d9..65b86f0e55 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpHeadersInjectionTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpHeadersInjectionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -18,7 +18,7 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpMethodEntityTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpMethodEntityTest.java
index 3a81437d0c..ed51569ac3 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpMethodEntityTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpMethodEntityTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -35,10 +35,10 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Tests HTTP methods and entity presence.
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/IgnoreExceptionResponseTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/IgnoreExceptionResponseTest.java
index 88125d8a21..f331878ad6 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/IgnoreExceptionResponseTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/IgnoreExceptionResponseTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -27,16 +27,16 @@
import java.net.URI;
import java.util.concurrent.atomic.AtomicReference;
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertFalse;
-import static junit.framework.TestCase.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
import org.glassfish.jersey.CommonProperties;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
/**
* Tests ignoring of client responses in exceptions.
@@ -61,7 +61,7 @@ public IgnoreExceptionResponseTest() {
/**
* Sets ignore exception response as system property after enabling the provider.
*/
- @BeforeClass
+ @BeforeAll
public static void startUp() {
lastAllowSystemProperties = System.setProperty(CommonProperties.ALLOW_SYSTEM_PROPERTIES_PROVIDER, "true");
lastIgnoreExceptionResponse = System.setProperty(ClientProperties.IGNORE_EXCEPTION_RESPONSE, "true");
@@ -70,7 +70,7 @@ public static void startUp() {
/**
* Restores state after completion.
*/
- @AfterClass
+ @AfterAll
public static void cleanUp() {
if (lastIgnoreExceptionResponse != null) {
System.setProperty(ClientProperties.IGNORE_EXCEPTION_RESPONSE, lastIgnoreExceptionResponse);
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InjectedClientBodyWorker.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InjectedClientBodyWorker.java
index d747cd8e9e..1414887acd 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InjectedClientBodyWorker.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InjectedClientBodyWorker.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -43,7 +43,7 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InjectionManagerProviderTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InjectionManagerProviderTest.java
index 6ee393e82c..9aa31da25a 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InjectionManagerProviderTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InjectionManagerProviderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -46,8 +46,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Tests {@link InjectionManagerClientProvider}.
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InvocationBuilderRxTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InvocationBuilderRxTest.java
index 6c43026289..a10359a8c7 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InvocationBuilderRxTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/InvocationBuilderRxTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -20,9 +20,9 @@
import org.glassfish.jersey.client.JerseyInvocation;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -46,7 +46,7 @@ public class InvocationBuilderRxTest extends JerseyTest {
private static final String ECHO = "ECHO";
private CountDownLatch latch;
- @Before
+ @BeforeEach
public void beforeEach() {
latch = new CountDownLatch(1);
}
@@ -95,8 +95,8 @@ public void testMethodCallback() throws InterruptedException, ExecutionException
.method("GET", new TestCallback(latch));
latch.await(AWAIT_TIME, TimeUnit.MILLISECONDS);
- Assert.assertEquals(ECHO, future.get());
- Assert.assertEquals(0, latch.getCount());
+ Assertions.assertEquals(ECHO, future.get());
+ Assertions.assertEquals(0, latch.getCount());
}
@Test
@@ -105,8 +105,8 @@ public void testMethodEntityCallback() throws InterruptedException, ExecutionExc
.method("POST", Entity.entity(ECHO, MediaType.TEXT_PLAIN), new TestCallback(latch));
latch.await(AWAIT_TIME, TimeUnit.MILLISECONDS);
- Assert.assertEquals(ECHO + ECHO, future.get());
- Assert.assertEquals(0, latch.getCount());
+ Assertions.assertEquals(ECHO + ECHO, future.get());
+ Assertions.assertEquals(0, latch.getCount());
}
@Test
@@ -115,7 +115,7 @@ public void testMethodEntityResponseType() throws InterruptedException, Executio
.method("POST", Entity.entity(ECHO, MediaType.TEXT_PLAIN), Response.class);
try (Response response = stage.toCompletableFuture().get()) {
- Assert.assertEquals(ECHO + ECHO, response.readEntity(String.class));
+ Assertions.assertEquals(ECHO + ECHO, response.readEntity(String.class));
}
}
@@ -125,7 +125,7 @@ public void testMethodEntityGenericType() throws InterruptedException, Execution
.method("POST", Entity.entity(ECHO, MediaType.TEXT_PLAIN), new GenericType(){});
try (Response response = stage.toCompletableFuture().get()) {
- Assert.assertEquals(ECHO + ECHO, response.readEntity(String.class));
+ Assertions.assertEquals(ECHO + ECHO, response.readEntity(String.class));
}
}
}
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/JaxRsTimeoutTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/JaxRsTimeoutTest.java
index ebff0ea608..987de6a11d 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/JaxRsTimeoutTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/JaxRsTimeoutTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -31,9 +31,9 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Pavel Bucek
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/NonSuccessfulResponseTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/NonSuccessfulResponseTest.java
index 9075628beb..a01a1798a8 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/NonSuccessfulResponseTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/NonSuccessfulResponseTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -32,8 +32,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
/**
* Test no successful (3XX, 4XX, 5XX) responses with no empty body.
@@ -106,8 +106,8 @@ private void generalTestGet(int status) {
WebTarget target = target("resource").path(Integer.toString(status));
SyncInvoker sync = target.request();
Response response = sync.get(Response.class);
- Assert.assertEquals(status, response.getStatus());
- Assert.assertEquals("get", response.readEntity(String.class));
+ Assertions.assertEquals(status, response.getStatus());
+ Assertions.assertEquals("get", response.readEntity(String.class));
}
private void generalTestPost(int status) {
@@ -115,8 +115,8 @@ private void generalTestPost(int status) {
WebTarget target = target("resource").path(Integer.toString(status));
SyncInvoker sync = target.request();
Response response = sync.post(entity, Response.class);
- Assert.assertEquals(status, response.getStatus());
- Assert.assertEquals("entity", response.readEntity(String.class));
+ Assertions.assertEquals(status, response.getStatus());
+ Assertions.assertEquals("entity", response.readEntity(String.class));
}
}
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/RequestScopedReadEntityTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/RequestScopedReadEntityTest.java
index 9f5c926cfc..f8bd405fcf 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/RequestScopedReadEntityTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/RequestScopedReadEntityTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -40,8 +40,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* TODO: javadoc.
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ResponseCloseTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ResponseCloseTest.java
index 69bdeda208..44412ab8e3 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ResponseCloseTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ResponseCloseTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -25,8 +25,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Test for Response.close() method.
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ResponseReadAndBufferEntityTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ResponseReadAndBufferEntityTest.java
index b90b1296af..e9aa6d0c14 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ResponseReadAndBufferEntityTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ResponseReadAndBufferEntityTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -40,12 +40,12 @@
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Buffered response entity tests.
@@ -267,13 +267,13 @@ public void filter(final ClientRequestContext requestContext, final ClientRespon
// Read entity should not fail - we silently consume the underlying IOException from closed input stream.
final String entity = response.readEntity(String.class, null);
assertThat("Unexpected response.", entity.toString(), equalTo(Resource.ENTITY));
- assertEquals("Close not invoked on underlying input stream.", 1, entityStream.getCloseCount());
+ assertEquals(1, entityStream.getCloseCount(), "Close not invoked on underlying input stream.");
// Close should not fail and should be idempotent
response.close();
response.close();
response.close();
- assertEquals("Close invoked too many times on underlying input stream.", 1, entityStream.getCloseCount());
+ assertEquals(1, entityStream.getCloseCount(), "Close invoked too many times on underlying input stream.");
try {
// UC-1.1 : Try to read an unbuffered entity from a closed context
@@ -307,7 +307,7 @@ public void filter(final ClientRequestContext requestContext, final ClientRespon
entityStream.setCorruptClose(true);
response.bufferEntity();
- assertEquals("Close not invoked on underlying input stream.", 1, entityStream.getCloseCount());
+ assertEquals(1, entityStream.getCloseCount(), "Close not invoked on underlying input stream.");
String entity;
entity = response.readEntity(String.class, null);
@@ -319,7 +319,7 @@ public void filter(final ClientRequestContext requestContext, final ClientRespon
response.close();
response.close();
response.close();
- assertEquals("Close invoked too many times on underlying input stream.", 1, entityStream.getCloseCount());
+ assertEquals(1, entityStream.getCloseCount(), "Close invoked too many times on underlying input stream.");
try {
// UC-2.1 : Try to read a buffered entity from a closed context
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ShutdownHookMemoryLeakTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ShutdownHookMemoryLeakTest.java
index 14220dc1d8..85a63bdd98 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ShutdownHookMemoryLeakTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ShutdownHookMemoryLeakTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -17,6 +17,7 @@
package org.glassfish.jersey.tests.e2e.client;
import java.lang.reflect.Field;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -38,15 +39,15 @@
import org.glassfish.jersey.jetty.connector.JettyConnectorProvider;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.glassfish.jersey.test.spi.TestHelper;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.DynamicContainer;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestFactory;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* Ensure Jersey connectors do not leak resources
@@ -57,27 +58,28 @@
*
* @author Jakub Podlesak
*/
-@RunWith(Parameterized.class)
-public class ShutdownHookMemoryLeakTest extends JerseyTest {
+public class ShutdownHookMemoryLeakTest {
private static final String PATH = "test";
private static final int ITERATIONS = 1000;
- private final ConnectorProvider connectorProvider;
-
- public ShutdownHookMemoryLeakTest(final ConnectorProvider cp) {
- connectorProvider = cp;
+ public static List connectionProviders() {
+ return Arrays.asList(
+ new GrizzlyConnectorProvider(),
+ new JettyConnectorProvider(),
+ new ApacheConnectorProvider(),
+ new HttpUrlConnectorProvider()
+ );
}
-
- @Parameterized.Parameters
- public static List connectionProviders() {
- return Arrays.asList(new ConnectorProvider[][] {
- {new GrizzlyConnectorProvider()},
- {new JettyConnectorProvider()},
- {new ApacheConnectorProvider()},
- {new HttpUrlConnectorProvider()}
+ @TestFactory
+ public Collection generateTests() {
+ Collection tests = new ArrayList<>();
+ connectionProviders().forEach(connectionProvider -> {
+ ShutdownHookMemoryLeakTemplateTest test = new ShutdownHookMemoryLeakTemplateTest(connectionProvider) {};
+ tests.add(TestHelper.toTestContainer(test, connectionProvider.getClass().getSimpleName()));
});
+ return tests;
}
@Path(PATH)
@@ -89,63 +91,72 @@ public String get() {
}
}
- @Override
- protected Application configure() {
- return new ResourceConfig(TestResource.class);
- }
+ public abstract static class ShutdownHookMemoryLeakTemplateTest extends JerseyTest {
+ private final ConnectorProvider connectorProvider;
- @Override
- protected void configureClient(ClientConfig config) {
- config.connectorProvider(connectorProvider);
- }
-
- @Test
- @Ignore("Unstable, ignored for now")
- public void testClientDoesNotLeakResources() throws Exception {
-
- final AtomicInteger listenersInitialized = new AtomicInteger(0);
- final AtomicInteger listenersClosed = new AtomicInteger(0);
-
- for (int i = 0; i < ITERATIONS; i++) {
- final Response response = target(PATH).property("another", "runtime").register(new ClientLifecycleListener() {
- @Override
- public void onInit() {
- listenersInitialized.incrementAndGet();
- }
-
- @Override
- public void onClose() {
- listenersClosed.incrementAndGet();
- }
- }).register(LoggingFeature.class).request().get();
- assertEquals("GET", response.readEntity(String.class));
+ public ShutdownHookMemoryLeakTemplateTest(final ConnectorProvider cp) {
+ connectorProvider = cp;
}
- Collection shutdownHooks = getShutdownHooks(client());
-
- assertThat(String.format(
- "%s: number of initialized listeners should be the same as number of total request count",
- connectorProvider.getClass()),
- listenersInitialized.get(), is(ITERATIONS));
-
-// the following check is fragile, as GC could break it easily
-// assertThat(String.format(
-// "%s: number of closed listeners should correspond to the number of missing hooks",
-// connectorProvider.getClass()),
-// listenersClosed.get(), is(ITERATIONS - shutdownHooks.size()));
+ @Override
+ protected Application configure() {
+ return new ResourceConfig(TestResource.class);
+ }
- client().close(); // clean up the rest
+ @Override
+ protected void configureClient(ClientConfig config) {
+ config.connectorProvider(connectorProvider);
+ }
- assertThat(String.format(
- "%s: number of closed listeners should be the same as the number of total requests made",
- connectorProvider.getClass()),
- listenersClosed.get(), is(ITERATIONS));
- }
+ @Test
+ @Disabled("Unstable, ignored for now")
+ public void testClientDoesNotLeakResources() throws Exception {
+
+ final AtomicInteger listenersInitialized = new AtomicInteger(0);
+ final AtomicInteger listenersClosed = new AtomicInteger(0);
+
+ for (int i = 0; i < ITERATIONS; i++) {
+ final Response response = target(PATH).property("another", "runtime").register(new ClientLifecycleListener() {
+ @Override
+ public void onInit() {
+ listenersInitialized.incrementAndGet();
+ }
+
+ @Override
+ public void onClose() {
+ listenersClosed.incrementAndGet();
+ }
+ }).register(LoggingFeature.class).request().get();
+ assertEquals("GET", response.readEntity(String.class));
+ }
+
+ Collection shutdownHooks = getShutdownHooks(client());
+
+ assertThat(String.format(
+ "%s: number of initialized listeners should be the same as number of total request count",
+ connectorProvider.getClass()),
+ listenersInitialized.get(), is(ITERATIONS));
+
+// the following check is fragile, as GC could break it easily
+// assertThat(String.format(
+// "%s: number of closed listeners should correspond to the number of missing hooks",
+// connectorProvider.getClass()),
+// listenersClosed.get(), is(ITERATIONS - shutdownHooks.size()));
+
+ client().close(); // clean up the rest
+
+ assertThat(String.format(
+ "%s: number of closed listeners should be the same as the number of total requests made",
+ connectorProvider.getClass()),
+ listenersClosed.get(), is(ITERATIONS));
+ }
- private Collection getShutdownHooks(javax.ws.rs.client.Client client) throws NoSuchFieldException, IllegalAccessException {
- JerseyClient jerseyClient = (JerseyClient) client;
- Field shutdownHooksField = JerseyClient.class.getDeclaredField("shutdownHooks");
- shutdownHooksField.setAccessible(true);
- return (Collection) shutdownHooksField.get(jerseyClient);
+ private Collection getShutdownHooks(javax.ws.rs.client.Client client)
+ throws NoSuchFieldException, IllegalAccessException {
+ JerseyClient jerseyClient = (JerseyClient) client;
+ Field shutdownHooksField = JerseyClient.class.getDeclaredField("shutdownHooks");
+ shutdownHooksField.setAccessible(true);
+ return (Collection) shutdownHooksField.get(jerseyClient);
+ }
}
}
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/TimeoutTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/TimeoutTest.java
index 507321ff70..559258d730 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/TimeoutTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/TimeoutTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -29,10 +29,10 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Martin Matula
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/HttpPatchTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/HttpPatchTest.java
index e9429ac14d..3bca471561 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/HttpPatchTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/HttpPatchTest.java
@@ -16,7 +16,9 @@
package org.glassfish.jersey.tests.e2e.client.connector;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Future;
@@ -42,121 +44,133 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
+import org.glassfish.jersey.test.spi.TestHelper;
+import org.junit.jupiter.api.DynamicContainer;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestFactory;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Pavel Bucek
*/
-@RunWith(Parameterized.class)
-public class HttpPatchTest extends JerseyTest {
+public class HttpPatchTest {
private static final Logger LOGGER = Logger.getLogger(RequestHeaderModificationsTest.class.getName());
- @Parameterized.Parameters(name = "{index}: {0}")
- public static List testData() {
- return Arrays.asList(new Object[][]{
+ public static List testData() {
+ return Arrays.asList(
// {HttpUrlConnectorProvider.class}, // cannot process PATCH without additional configuration
- {GrizzlyConnectorProvider.class},
- {JettyConnectorProvider.class}, // unstable.
- {ApacheConnectorProvider.class},
- {Apache5ConnectorProvider.class},
- {NettyConnectorProvider.class},
- {JdkConnectorProvider.class},
- });
+ new GrizzlyConnectorProvider(),
+ new JettyConnectorProvider(), // unstable.
+ new ApacheConnectorProvider(),
+ new Apache5ConnectorProvider(),
+ new NettyConnectorProvider(),
+ new JdkConnectorProvider()
+ );
}
- private final ConnectorProvider connectorProvider;
-
- public HttpPatchTest(Class extends ConnectorProvider> connectorProviderClass)
- throws IllegalAccessException, InstantiationException {
- this.connectorProvider = connectorProviderClass.newInstance();
+ @TestFactory
+ public Collection generateTests() {
+ Collection tests = new ArrayList<>();
+ for (ConnectorProvider provider : testData()) {
+ HttpPatchTemplateTest test = new HttpPatchTemplateTest(provider) {};
+ DynamicContainer container = TestHelper.toTestContainer(test,
+ String.format("httpPatchTest (%s)", provider.getClass().getSimpleName()));
+ tests.add(container);
+ }
+ return tests;
}
- @Override
- protected Application configure() {
- set(TestProperties.RECORD_LOG_LEVEL, Level.WARNING.intValue());
- enable(TestProperties.LOG_TRAFFIC);
- return new ResourceConfig(PatchResource.class)
- .register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.HEADERS_ONLY));
- }
+ public abstract static class HttpPatchTemplateTest extends JerseyTest {
+ private final ConnectorProvider connectorProvider;
- @Override
- protected void configureClient(ClientConfig clientConfig) {
- clientConfig.connectorProvider(connectorProvider);
- }
+ public HttpPatchTemplateTest(ConnectorProvider connectorProvider) {
+ this.connectorProvider = connectorProvider;
+ }
- @Test
- public void testPatchResponse() throws Exception {
- Response response = target().request().method("PATCH", Entity.text("patch"));
+ @Override
+ protected Application configure() {
+ set(TestProperties.RECORD_LOG_LEVEL, Level.WARNING.intValue());
+ enable(TestProperties.LOG_TRAFFIC);
+ return new ResourceConfig(PatchResource.class)
+ .register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.HEADERS_ONLY));
+ }
- assertEquals(200, response.getStatus());
- assertEquals("patch", response.readEntity(String.class));
- }
+ @Override
+ protected void configureClient(ClientConfig clientConfig) {
+ clientConfig.connectorProvider(connectorProvider);
+ }
- @Test
- public void testPatchEntity() throws Exception {
- String response = target().request().method("PATCH", Entity.text("patch"), String.class);
+ @Test
+ public void testPatchResponse() throws Exception {
+ Response response = target().request().method("PATCH", Entity.text("patch"));
- assertEquals("patch", response);
- }
+ assertEquals(200, response.getStatus());
+ assertEquals("patch", response.readEntity(String.class));
+ }
- @Test
- public void testPatchGenericType() throws Exception {
- String response = target().request().method("PATCH", Entity.text("patch"), new GenericType() {
- });
+ @Test
+ public void testPatchEntity() throws Exception {
+ String response = target().request().method("PATCH", Entity.text("patch"), String.class);
- assertEquals("patch", response);
- }
+ assertEquals("patch", response);
+ }
- @Test
- public void testAsyncPatchResponse() throws Exception {
- Future response = target().request().async().method("PATCH", Entity.text("patch"));
+ @Test
+ public void testPatchGenericType() throws Exception {
+ String response = target().request().method("PATCH", Entity.text("patch"), new GenericType() {
+ });
- assertEquals(200, response.get().getStatus());
- assertEquals("patch", response.get().readEntity(String.class));
- }
+ assertEquals("patch", response);
+ }
- @Test
- public void testAsyncPatchEntity() throws Exception {
- Future response = target().request().async().method("PATCH", Entity.text("patch"), String.class);
+ @Test
+ public void testAsyncPatchResponse() throws Exception {
+ Future response = target().request().async().method("PATCH", Entity.text("patch"));
- assertEquals("patch", response.get());
- }
+ assertEquals(200, response.get().getStatus());
+ assertEquals("patch", response.get().readEntity(String.class));
+ }
- @Test
- public void testAsyncPatchGenericType() throws Exception {
- Future response = target().request().async().method("PATCH", Entity.text("patch"), new GenericType() {
- });
+ @Test
+ public void testAsyncPatchEntity() throws Exception {
+ Future response = target().request().async().method("PATCH", Entity.text("patch"), String.class);
- assertEquals("patch", response.get());
- }
+ assertEquals("patch", response.get());
+ }
- @Test
- public void testRxPatchResponse() throws Exception {
- CompletionStage response = target().request().rx().method("PATCH", Entity.text("patch"));
+ @Test
+ public void testAsyncPatchGenericType() throws Exception {
+ Future response = target().request().async().method("PATCH", Entity.text("patch"), new GenericType() {
+ });
- assertEquals(200, response.toCompletableFuture().get().getStatus());
- assertEquals("patch", response.toCompletableFuture().get().readEntity(String.class));
- }
+ assertEquals("patch", response.get());
+ }
- @Test
- public void testRxPatchEntity() throws Exception {
- CompletionStage response = target().request().rx().method("PATCH", Entity.text("patch"), String.class);
+ @Test
+ public void testRxPatchResponse() throws Exception {
+ CompletionStage response = target().request().rx().method("PATCH", Entity.text("patch"));
- assertEquals("patch", response.toCompletableFuture().get());
- }
+ assertEquals(200, response.toCompletableFuture().get().getStatus());
+ assertEquals("patch", response.toCompletableFuture().get().readEntity(String.class));
+ }
+
+ @Test
+ public void testRxPatchEntity() throws Exception {
+ CompletionStage response = target().request().rx().method("PATCH", Entity.text("patch"), String.class);
- @Test
- public void testRxPatchGenericType() throws Exception {
- CompletionStage response = target().request().rx()
- .method("PATCH", Entity.text("patch"), new GenericType() {
- });
+ assertEquals("patch", response.toCompletableFuture().get());
+ }
+
+ @Test
+ public void testRxPatchGenericType() throws Exception {
+ CompletionStage response = target().request().rx()
+ .method("PATCH", Entity.text("patch"), new GenericType() {
+ });
- assertEquals("patch", response.toCompletableFuture().get());
+ assertEquals("patch", response.toCompletableFuture().get());
+ }
}
@Path("/")
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/RequestHeaderModificationsTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/RequestHeaderModificationsTest.java
index f030077859..3d63a59c3b 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/RequestHeaderModificationsTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/RequestHeaderModificationsTest.java
@@ -21,7 +21,9 @@
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.Future;
@@ -62,23 +64,23 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
+import org.glassfish.jersey.test.spi.TestHelper;
+import org.junit.jupiter.api.DynamicContainer;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestFactory;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import static org.hamcrest.Matchers.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* JERSEY-2206 reproducer
*
* @author Libor Kramolis
*/
-@RunWith(Parameterized.class)
-public class RequestHeaderModificationsTest extends JerseyTest {
+public class RequestHeaderModificationsTest {
private static final Logger LOGGER = Logger.getLogger(RequestHeaderModificationsTest.class.getName());
private static final boolean GZIP = false; // change to true when JERSEY-2341 fixed
@@ -97,103 +99,117 @@ public class RequestHeaderModificationsTest extends JerseyTest {
private static final String REQUEST_HEADER_MODIFICATION_SUPPORTED = "modificationSupported";
private static final String PATH = "/resource";
- @Parameterized.Parameters(name = "{index}: {0} / modificationSupported= {1} / addHeader= {2}")
public static List testData() {
return Arrays.asList(new Object[][] {
- {HttpUrlConnectorProvider.class, true, false},
- {GrizzlyConnectorProvider.class, false, false}, // change to true when JERSEY-2341 fixed
- {JettyConnectorProvider.class, false, false}, // change to true when JERSEY-2341 fixed
- {ApacheConnectorProvider.class, false, false}, // change to true when JERSEY-2341 fixed
- {Apache5ConnectorProvider.class, false, false}, // change to true when JERSEY-2341 fixed
- {HttpUrlConnectorProvider.class, true, true},
- {GrizzlyConnectorProvider.class, false, true}, // change to true when JERSEY-2341 fixed
- {JettyConnectorProvider.class, false, true}, // change to true when JERSEY-2341 fixed
- {ApacheConnectorProvider.class, false, true}, // change to true when JERSEY-2341 fixed
- {Apache5ConnectorProvider.class, false, true}, // change to true when JERSEY-2341 fixed
+ {new HttpUrlConnectorProvider(), true, false},
+ {new GrizzlyConnectorProvider(), false, false}, // change to true when JERSEY-2341 fixed
+ {new JettyConnectorProvider(), false, false}, // change to true when JERSEY-2341 fixed
+ {new ApacheConnectorProvider(), false, false}, // change to true when JERSEY-2341 fixed
+ {new Apache5ConnectorProvider(), false, false}, // change to true when JERSEY-2341 fixed
+ {new HttpUrlConnectorProvider(), true, true},
+ {new GrizzlyConnectorProvider(), false, true}, // change to true when JERSEY-2341 fixed
+ {new JettyConnectorProvider(), false, true}, // change to true when JERSEY-2341 fixed
+ {new ApacheConnectorProvider(), false, true}, // change to true when JERSEY-2341 fixed
+ {new Apache5ConnectorProvider(), false, true}, // change to true when JERSEY-2341 fixed
});
}
- private final ConnectorProvider connectorProvider;
- private final boolean modificationSupported; // remove when JERSEY-2341 fixed
- private final boolean addHeader;
-
- public RequestHeaderModificationsTest(Class extends ConnectorProvider> connectorProviderClass,
- boolean modificationSupported, boolean addHeader)
- throws IllegalAccessException, InstantiationException {
- this.connectorProvider = connectorProviderClass.newInstance();
- this.modificationSupported = modificationSupported;
- this.addHeader = addHeader;
+ @TestFactory
+ public Collection generateTests() {
+ Collection tests = new ArrayList<>();
+ testData().forEach(arr -> {
+ RequestHeaderModificationsTemplateTest test = new RequestHeaderModificationsTemplateTest(
+ (ConnectorProvider) arr[0], (boolean) arr[1], (boolean) arr[2]) {};
+ tests.add(TestHelper.toTestContainer(test, String.format("%s (%s, %s, %s)",
+ RequestHeaderModificationsTemplateTest.class.getSimpleName(),
+ arr[0].getClass().getSimpleName(), arr[1], arr[2])));
+ });
+ return tests;
}
- @Override
- protected Application configure() {
- set(TestProperties.RECORD_LOG_LEVEL, Level.WARNING.intValue());
+ public abstract static class RequestHeaderModificationsTemplateTest extends JerseyTest {
+ private final ConnectorProvider connectorProvider;
+ private final boolean modificationSupported; // remove when JERSEY-2341 fixed
+ private final boolean addHeader;
- enable(TestProperties.LOG_TRAFFIC);
- if (DUMP_ENTITY) {
- enable(TestProperties.DUMP_ENTITY);
+ public RequestHeaderModificationsTemplateTest(ConnectorProvider connectorProvider,
+ boolean modificationSupported, boolean addHeader) {
+ this.connectorProvider = connectorProvider;
+ this.modificationSupported = modificationSupported;
+ this.addHeader = addHeader;
}
- return new ResourceConfig(TestResource.class).register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.HEADERS_ONLY));
- }
- @Override
- protected void configureClient(ClientConfig clientConfig) {
- clientConfig.register(MyClientRequestFilter.class);
- clientConfig.register(new MyWriterInterceptor(addHeader));
- clientConfig.register(new MyMessageBodyWriter(addHeader));
- clientConfig.connectorProvider(connectorProvider);
- }
+ @Override
+ protected Application configure() {
+ set(TestProperties.RECORD_LOG_LEVEL, Level.WARNING.intValue());
- @Test
- public void testWarningLogged() throws Exception {
- Response response = requestBuilder().post(requestEntity());
- assertResponse(response);
- }
+ enable(TestProperties.LOG_TRAFFIC);
+ if (DUMP_ENTITY) {
+ enable(TestProperties.DUMP_ENTITY);
+ }
+ return new ResourceConfig(TestResource.class)
+ .register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.HEADERS_ONLY));
+ }
- @Test
- public void testWarningLoggedAsync() throws Exception {
- AsyncInvoker asyncInvoker = requestBuilder().async();
- Future responseFuture = asyncInvoker.post(requestEntity());
- Response response = responseFuture.get();
- assertResponse(response);
- }
+ @Override
+ protected void configureClient(ClientConfig clientConfig) {
+ clientConfig.register(MyClientRequestFilter.class);
+ clientConfig.register(new MyWriterInterceptor(addHeader));
+ clientConfig.register(new MyMessageBodyWriter(addHeader));
+ clientConfig.connectorProvider(connectorProvider);
+ }
- private Invocation.Builder requestBuilder() {
- return target(PATH)
- .request()
- .header(REQUEST_HEADER_NAME_CLIENT, REQUEST_HEADER_VALUE_CLIENT)
- .header(REQUEST_HEADER_MODIFICATION_SUPPORTED, modificationSupported && addHeader)
- .header("hello", "double").header("hello", "value");
- }
+ @Test
+ public void testWarningLogged() throws Exception {
+ Response response = requestBuilder().post(requestEntity());
+ assertResponse(response);
+ }
- private Entity requestEntity() {
- return Entity.text(new MyEntity(QUESTION));
- }
+ @Test
+ public void testWarningLoggedAsync() throws Exception {
+ AsyncInvoker asyncInvoker = requestBuilder().async();
+ Future responseFuture = asyncInvoker.post(requestEntity());
+ Response response = responseFuture.get();
+ assertResponse(response);
+ }
- private void assertResponse(Response response) {
- if (!modificationSupported) {
- final String UNSENT_HEADER_CHANGES = "Unsent header changes";
- LogRecord logRecord = findLogRecord(UNSENT_HEADER_CHANGES);
- if (addHeader) {
- assertNotNull("Missing LogRecord for message '" + UNSENT_HEADER_CHANGES + "'.", logRecord);
- assertThat(logRecord.getMessage(), containsString(REQUEST_HEADER_NAME_INTERCEPTOR));
- assertThat(logRecord.getMessage(), containsString(REQUEST_HEADER_NAME_MBW));
- } else {
- assertNull("Unexpected LogRecord for message '" + UNSENT_HEADER_CHANGES + "'.", logRecord);
- }
+ private Invocation.Builder requestBuilder() {
+ return target(PATH)
+ .request()
+ .header(REQUEST_HEADER_NAME_CLIENT, REQUEST_HEADER_VALUE_CLIENT)
+ .header(REQUEST_HEADER_MODIFICATION_SUPPORTED, modificationSupported && addHeader)
+ .header("hello", "double").header("hello", "value");
}
- assertEquals(200, response.getStatus());
- assertEquals(ANSWER, response.readEntity(String.class));
- }
+ private Entity requestEntity() {
+ return Entity.text(new MyEntity(QUESTION));
+ }
+
+ private void assertResponse(Response response) {
+ if (!modificationSupported) {
+ final String UNSENT_HEADER_CHANGES = "Unsent header changes";
+ LogRecord logRecord = findLogRecord(UNSENT_HEADER_CHANGES);
+ if (addHeader) {
+ assertNotNull(logRecord, "Missing LogRecord for message '" + UNSENT_HEADER_CHANGES + "'.");
+ assertThat(logRecord.getMessage(), containsString(REQUEST_HEADER_NAME_INTERCEPTOR));
+ assertThat(logRecord.getMessage(), containsString(REQUEST_HEADER_NAME_MBW));
+ } else {
+ assertNull(logRecord, "Unexpected LogRecord for message '" + UNSENT_HEADER_CHANGES + "'.");
+ }
+ }
+
+ assertEquals(200, response.getStatus());
+ assertEquals(ANSWER, response.readEntity(String.class));
+ }
- private LogRecord findLogRecord(String messageContains) {
- for (final LogRecord record : getLoggedRecords()) {
- if (record.getMessage().contains(messageContains)) {
- return record;
+ private LogRecord findLogRecord(String messageContains) {
+ for (final LogRecord record : getLoggedRecords()) {
+ if (record.getMessage().contains(messageContains)) {
+ return record;
+ }
}
+ return null;
}
- return null;
}
@Path(PATH)
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/proxy/ProxySelectorTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/proxy/ProxySelectorTest.java
index a813e545c6..cb714f3c32 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/proxy/ProxySelectorTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/proxy/ProxySelectorTest.java
@@ -21,19 +21,13 @@
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
-import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
-import org.glassfish.jersey.apache5.connector.Apache5ConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
-import org.glassfish.jersey.client.spi.ConnectorProvider;
-import org.glassfish.jersey.jetty.connector.JettyConnectorProvider;
import org.glassfish.jersey.netty.connector.NettyConnectorProvider;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -42,40 +36,20 @@
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Moved from jetty-connector
* @author Marcelo Rubim
*/
-@RunWith(Parameterized.class)
public class ProxySelectorTest {
private static final String NO_PASS = "no-pass";
- @Parameterized.Parameters(name = "{index}: {0}")
- public static List testData() {
- return Arrays.asList(new Object[][]{
- // Apache, Grizzly, Jetty have the proxy set on constructor, i.e. ProxySelector cannot choose based on URI.
- // HttpUrlConnector ignores proxy on localhost.
- {NettyConnectorProvider.class},
- });
- }
-
- private final ConnectorProvider connectorProvider;
-
- public ProxySelectorTest(Class extends ConnectorProvider> connectorProviderClass)
- throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
- this.connectorProvider = connectorProviderClass.getConstructor().newInstance();
- }
-
protected void configureClient(ClientConfig config) {
- config.connectorProvider(connectorProvider);
+ config.connectorProvider(new NettyConnectorProvider());
}
@Test
@@ -90,12 +64,12 @@ public void testGet407() {
try (Response response = target("proxyTest").request().get()) {
assertEquals(407, response.getStatus());
} catch (ProcessingException pe) {
- Assert.assertTrue(pe.getMessage().contains("407")); // netty
+ Assertions.assertTrue(pe.getMessage().contains("407")); // netty
}
}
private static Server server;
- @BeforeClass
+ @BeforeAll
public static void startFakeProxy() {
server = new Server(9997);
server.setHandler(new ProxyHandler());
@@ -109,7 +83,7 @@ public static void startFakeProxy() {
System.setProperty("http.proxyPort", "9997");
}
- @AfterClass
+ @AfterAll
public static void tearDownProxy() {
try {
server.stop();
@@ -122,7 +96,7 @@ public static void tearDownProxy() {
}
private static Client client;
- @Before
+ @BeforeEach
public void beforeEach() {
ClientConfig config = new ClientConfig();
this.configureClient(config);
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/proxy/ProxyTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/proxy/ProxyTest.java
index 69be5f6591..cdd1bbe2a4 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/proxy/ProxyTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/proxy/ProxyTest.java
@@ -30,13 +30,11 @@
import org.glassfish.jersey.grizzly.connector.GrizzlyConnectorProvider;
import org.glassfish.jersey.jetty.connector.JettyConnectorProvider;
import org.glassfish.jersey.netty.connector.NettyConnectorProvider;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -47,19 +45,16 @@
import javax.ws.rs.core.Response;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.Charset;
-import java.util.Arrays;
import java.util.Base64;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Moved from jetty-connector
* @author Marcelo Rubim
*/
-@RunWith(Parameterized.class)
public class ProxyTest {
private static final Charset CHARACTER_SET = Charset.forName("iso-8859-1");
private static final String PROXY_URI = "http://127.0.0.1:9997";
@@ -67,94 +62,133 @@ public class ProxyTest {
private static final String PROXY_PASSWORD = "proxy-password";
private static final String NO_PASS = "no-pass";
- @Parameterized.Parameters(name = "{index}: {0}")
- public static List testData() {
- return Arrays.asList(new Object[][]{
- {ApacheConnectorProvider.class},
- {Apache5ConnectorProvider.class},
- {GrizzlyConnectorProvider.class},
- {JettyConnectorProvider.class},
- {NettyConnectorProvider.class},
- {HttpUrlConnectorProvider.class},
- });
+ public static class ApacheConnectorProviderProxyTest extends ProxyTemplateTest {
+ public ApacheConnectorProviderProxyTest()
+ throws NoSuchMethodException, InvocationTargetException, InstantiationException,
+ IllegalAccessException {
+ super(ApacheConnectorProvider.class);
+ }
}
- private final ConnectorProvider connectorProvider;
-
- public ProxyTest(Class extends ConnectorProvider> connectorProviderClass)
- throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
- this.connectorProvider = connectorProviderClass.getConstructor().newInstance();
+ public static class Apache5ConnectorProviderProxyTest extends ProxyTemplateTest {
+ public Apache5ConnectorProviderProxyTest()
+ throws NoSuchMethodException, InvocationTargetException, InstantiationException,
+ IllegalAccessException {
+ super(Apache5ConnectorProvider.class);
+ }
}
- protected void configureClient(ClientConfig config) {
- config.connectorProvider(connectorProvider);
+ public static class GrizzlyConnectorProviderProxyTest extends ProxyTemplateTest {
+ public GrizzlyConnectorProviderProxyTest()
+ throws NoSuchMethodException, InvocationTargetException, InstantiationException,
+ IllegalAccessException {
+ super(GrizzlyConnectorProvider.class);
+ }
}
- @Test
- public void testGetNoPass() {
- client().property(ClientProperties.PROXY_URI, ProxyTest.PROXY_URI);
- try (Response response = target("proxyTest").request().header(NO_PASS, 200).get()) {
- assertEquals(200, response.getStatus());
+ public static class JettyConnectorProviderProxyTest extends ProxyTemplateTest {
+ public JettyConnectorProviderProxyTest()
+ throws NoSuchMethodException, InvocationTargetException, InstantiationException,
+ IllegalAccessException {
+ super(JettyConnectorProvider.class);
}
}
- @Test
- public void testGet407() {
- // Grizzly sends (String)null password and username
- int expected = GrizzlyConnectorProvider.class.isInstance(connectorProvider) ? 400 : 407;
- client().property(ClientProperties.PROXY_URI, ProxyTest.PROXY_URI);
- try (Response response = target("proxyTest").request().get()) {
- assertEquals(expected, response.getStatus());
- } catch (ProcessingException pe) {
- Assert.assertTrue(pe.getMessage().contains("407")); // netty
+ public static class NettyConnectorProviderProxyTest extends ProxyTemplateTest {
+ public NettyConnectorProviderProxyTest()
+ throws NoSuchMethodException, InvocationTargetException, InstantiationException,
+ IllegalAccessException {
+ super(NettyConnectorProvider.class);
}
}
- @Test
- public void testGetSuccess() {
- client().property(ClientProperties.PROXY_URI, ProxyTest.PROXY_URI);
- client().property(ClientProperties.PROXY_USERNAME, ProxyTest.PROXY_USERNAME);
- client().property(ClientProperties.PROXY_PASSWORD, ProxyTest.PROXY_PASSWORD);
- Response response = target("proxyTest").request().get();
- response.bufferEntity();
- assertEquals(response.readEntity(String.class), 200, response.getStatus());
+ public static class HttpUrlConnectorProviderProxyTest extends ProxyTemplateTest {
+ public HttpUrlConnectorProviderProxyTest()
+ throws NoSuchMethodException, InvocationTargetException, InstantiationException,
+ IllegalAccessException {
+ super(HttpUrlConnectorProvider.class);
+ }
}
- private static Server server;
- @BeforeClass
- public static void startFakeProxy() {
- server = new Server(9997);
- server.setHandler(new ProxyHandler());
- try {
- server.start();
- } catch (Exception e) {
+ public abstract static class ProxyTemplateTest {
+ private final ConnectorProvider connectorProvider;
+ public ProxyTemplateTest(Class extends ConnectorProvider> connectorProviderClass)
+ throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
+ this.connectorProvider = connectorProviderClass.getConstructor().newInstance();
}
- }
- @AfterClass
- public static void tearDownProxy() {
- try {
- server.stop();
- } catch (Exception e) {
+ protected void configureClient(ClientConfig config) {
+ config.connectorProvider(connectorProvider);
}
- }
- private static Client client;
- @Before
- public void beforeEach() {
- ClientConfig config = new ClientConfig();
- this.configureClient(config);
- client = ClientBuilder.newClient(config);
- }
+ @Test
+ public void testGetNoPass() {
+ client().property(ClientProperties.PROXY_URI, ProxyTest.PROXY_URI);
+ try (Response response = target("proxyTest").request().header(NO_PASS, 200).get()) {
+ assertEquals(200, response.getStatus());
+ }
+ }
- private Client client() {
- return client;
- }
+ @Test
+ public void testGet407() {
+ // Grizzly sends (String)null password and username
+ int expected = GrizzlyConnectorProvider.class.isInstance(connectorProvider) ? 400 : 407;
+ client().property(ClientProperties.PROXY_URI, ProxyTest.PROXY_URI);
+ try (Response response = target("proxyTest").request().get()) {
+ assertEquals(expected, response.getStatus());
+ } catch (ProcessingException pe) {
+ Assertions.assertTrue(pe.getMessage().contains("407")); // netty
+ }
+ }
+
+ @Test
+ public void testGetSuccess() {
+ client().property(ClientProperties.PROXY_URI, ProxyTest.PROXY_URI);
+ client().property(ClientProperties.PROXY_USERNAME, ProxyTest.PROXY_USERNAME);
+ client().property(ClientProperties.PROXY_PASSWORD, ProxyTest.PROXY_PASSWORD);
+ Response response = target("proxyTest").request().get();
+ response.bufferEntity();
+ assertEquals(200, response.getStatus(), response.readEntity(String.class));
+ }
+
+ private static Server server;
+ @BeforeAll
+ public static void startFakeProxy() {
+ server = new Server(9997);
+ server.setHandler(new ProxyHandler());
+ try {
+ server.start();
+ } catch (Exception e) {
+
+ }
+ }
+
+ @AfterAll
+ public static void tearDownProxy() {
+ try {
+ server.stop();
+ } catch (Exception e) {
+
+ }
+ }
+
+ private static Client client;
+ @BeforeEach
+ public void beforeEach() {
+ ClientConfig config = new ClientConfig();
+ this.configureClient(config);
+ client = ClientBuilder.newClient(config);
+ }
- private WebTarget target(String path) {
- return client().target("http://localhost:9998").path(path);
+ private Client client() {
+ return client;
+ }
+
+ private WebTarget target(String path) {
+ return client().target("http://localhost:9998").path(path);
+ }
}
static class ProxyHandler extends AbstractHandler {
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java
index bc8ad45981..512e9fc428 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java
@@ -19,6 +19,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
+import java.util.stream.Stream;
import javax.net.ssl.SSLContext;
@@ -30,10 +31,8 @@
import org.glassfish.jersey.grizzly.connector.GrizzlyConnectorProvider;
import org.glassfish.jersey.jetty.connector.JettyConnectorProvider;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
import com.google.common.io.ByteStreams;
@@ -42,7 +41,6 @@
*
* @author Petr Bouda
*/
-@RunWith(Parameterized.class)
public abstract class AbstractConnectorServerTest {
// Default truststore and keystore
@@ -55,24 +53,20 @@ public abstract class AbstractConnectorServerTest {
*
* @return test parameters.
*/
- @Parameterized.Parameters(name = "{index}: {0}")
- public static Iterable testData() {
- return Arrays.asList(new Object[][] {
- {new HttpUrlConnectorProvider()},
- {new GrizzlyConnectorProvider()},
- {new JettyConnectorProvider()},
- {new ApacheConnectorProvider()},
- {new Apache5ConnectorProvider()}
- });
+ public static Stream testData() {
+ return Stream.of(
+ new HttpUrlConnectorProvider(),
+ new GrizzlyConnectorProvider(),
+ new JettyConnectorProvider(),
+ new ApacheConnectorProvider(),
+ new Apache5ConnectorProvider()
+ );
}
- @Parameterized.Parameter(0)
- public ConnectorProvider connectorProvider;
-
private final Object serverGuard = new Object();
private Server server = null;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
synchronized (serverGuard) {
if (server != null) {
@@ -83,7 +77,7 @@ public void setUp() throws Exception {
}
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
synchronized (serverGuard) {
if (server == null) {
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslConnectorConfigurationTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslConnectorConfigurationTest.java
index 608ba06334..d81b88aae3 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslConnectorConfigurationTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslConnectorConfigurationTest.java
@@ -25,13 +25,13 @@
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
+import org.glassfish.jersey.client.spi.ConnectorProvider;
import org.glassfish.jersey.logging.LoggingFeature;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* SSL connector tests.
@@ -40,7 +40,6 @@
* @author Arul Dhesiaseelan (aruld at acm.org)
* @author Marek Potociar
*/
-@RunWith(Parameterized.class)
public class SslConnectorConfigurationTest extends AbstractConnectorServerTest {
/**
@@ -48,8 +47,9 @@ public class SslConnectorConfigurationTest extends AbstractConnectorServerTest {
*
* @throws Exception in case of a test failure.
*/
- @Test
- public void testSSLWithAuth() throws Exception {
+ @ParameterizedTest
+ @MethodSource("testData")
+ public void testSSLWithAuth(ConnectorProvider connectorProvider) throws Exception {
final SSLContext sslContext = getSslContext();
final ClientConfig cc = new ClientConfig().connectorProvider(connectorProvider);
@@ -73,8 +73,9 @@ public void testSSLWithAuth() throws Exception {
*
* @throws Exception in case of a test failure.
*/
- @Test
- public void testHTTPBasicAuth1() throws Exception {
+ @ParameterizedTest
+ @MethodSource("testData")
+ public void testHTTPBasicAuth1(ConnectorProvider connectorProvider) throws Exception {
final SSLContext sslContext = getSslContext();
final ClientConfig cc = new ClientConfig().connectorProvider(connectorProvider);
@@ -96,8 +97,9 @@ public void testHTTPBasicAuth1() throws Exception {
*
* @throws Exception in case of a test failure.
*/
- @Test
- public void testSSLAuth1() throws Exception {
+ @ParameterizedTest
+ @MethodSource("testData")
+ public void testSSLAuth1(ConnectorProvider connectorProvider) throws Exception {
final SSLContext sslContext = getSslContext();
final ClientConfig cc = new ClientConfig().connectorProvider(connectorProvider);
@@ -121,8 +123,9 @@ public void testSSLAuth1() throws Exception {
/**
* Test that a response to an authentication challenge has the same SSL configuration as the original request.
*/
- @Test
- public void testSSLWithNonPreemptiveAuth() throws Exception {
+ @ParameterizedTest
+ @MethodSource("testData")
+ public void testSSLWithNonPreemptiveAuth(ConnectorProvider connectorProvider) throws Exception {
final SSLContext sslContext = getSslContext();
final ClientConfig cc = new ClientConfig().connectorProvider(connectorProvider);
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslConnectorHostnameVerifierTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslConnectorHostnameVerifierTest.java
index a41f2187e8..bf4f948138 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslConnectorHostnameVerifierTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslConnectorHostnameVerifierTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -33,18 +33,16 @@
import org.glassfish.jersey.grizzly.connector.GrizzlyConnectorProvider;
import org.glassfish.jersey.jetty.connector.JettyConnectorProvider;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* SSL connector hostname verification tests.
*
* @author Petr Bouda
*/
-@RunWith(Parameterized.class)
public class SslConnectorHostnameVerifierTest extends AbstractConnectorServerTest {
private static final String CLIENT_TRUST_STORE = "truststore-example_com-client";
@@ -65,10 +63,11 @@ protected String clientTrustStore() {
*
* @throws Exception in case of a test failure.
*/
- @Test
- public void testHostnameVerifierApplied() throws Exception {
+ @ParameterizedTest
+ @MethodSource("testData")
+ public void testHostnameVerifierApplied(ConnectorProvider connectorProvider) throws Exception {
// Grizzly and Jetty connectors don't support Hostname Verification
- if (isExcluded(Arrays.asList(GrizzlyConnectorProvider.class, JettyConnectorProvider.class))) {
+ if (isExcluded(Arrays.asList(GrizzlyConnectorProvider.class, JettyConnectorProvider.class), connectorProvider)) {
return;
}
@@ -93,7 +92,7 @@ public void testHostnameVerifierApplied() throws Exception {
}
}
- private boolean isExcluded(List> excluded) {
+ private boolean isExcluded(List> excluded, ConnectorProvider connectorProvider) {
for (Class> clazz : excluded) {
if (clazz.isAssignableFrom(connectorProvider.getClass())) {
return true;
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslHttpUrlConnectorTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslHttpUrlConnectorTest.java
index df3f1dcd4e..9b22f48a14 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslHttpUrlConnectorTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/SslHttpUrlConnectorTest.java
@@ -43,11 +43,15 @@
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
+import org.glassfish.jersey.client.spi.ConnectorProvider;
import org.glassfish.jersey.logging.LoggingFeature;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test custom socket factory in HttpUrlConnection using SSL
@@ -94,8 +98,9 @@ public HttpURLConnection getConnection(final URL url) throws IOException {
*
* @author Kevin Conaway
*/
- @Test
- public void testConcurrentRequestsWithCustomSSLContext() throws Exception {
+ @ParameterizedTest
+ @MethodSource("testData")
+ public void testConcurrentRequestsWithCustomSSLContext(ConnectorProvider connectorProvider) throws Exception {
if (HttpUrlConnectorProvider.class.isInstance(connectorProvider)
|| (ApacheConnectorProvider.class.isInstance(connectorProvider))
|| (Apache5ConnectorProvider.class.isInstance(connectorProvider))) {
@@ -132,14 +137,9 @@ public void testConcurrentRequestsWithCustomSSLContext() throws Exception {
service.shutdown();
- assertTrue(
- service.awaitTermination(1, TimeUnit.MINUTES)
- );
+ assertTrue(service.awaitTermination(1, TimeUnit.MINUTES));
- assertTrue(
- toString(exceptions),
- exceptions.isEmpty()
- );
+ assertTrue(exceptions.isEmpty(), toString(exceptions));
}
private String toString(List exceptions) {
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/grizzlyconnector/NonBlockingTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/grizzlyconnector/NonBlockingTest.java
index 5006b190b2..66414de9a3 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/grizzlyconnector/NonBlockingTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/grizzlyconnector/NonBlockingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -29,9 +29,9 @@
import org.glassfish.jersey.grizzly.connector.GrizzlyConnectorProvider;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Grizzly connector non blocking test.
@@ -82,9 +82,9 @@ public void failed(Throwable throwable) {
String response = future.get();
assertNotNull(response);
- assertTrue("Invocation callback was not invoked",
- countDownLatch.await(5, TimeUnit.SECONDS));
- assertTrue("Invocation callback is not executed on the NIO pool thread.",
- !invocationCallbackThreadName.contains("jersey-client-async-executor"));
+ assertTrue(countDownLatch.await(5, TimeUnit.SECONDS),
+ "Invocation callback was not invoked");
+ assertTrue(!invocationCallbackThreadName.contains("jersey-client-async-executor"),
+ "Invocation callback is not executed on the NIO pool thread.");
}
}
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/httpurlconnector/AsyncTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/httpurlconnector/AsyncTest.java
index a67f40937d..43a8172de4 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/httpurlconnector/AsyncTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/httpurlconnector/AsyncTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -43,14 +43,14 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.hamcrest.Matchers;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Asynchronous connector test.
@@ -228,7 +228,7 @@ private void sleep() {
}
@Test
- @Ignore("Unstable test.")
+ @Disabled("Unstable test.")
public void testClientThreadPool() throws Exception {
final AsyncInvoker invoker = ClientBuilder
.newClient(new ClientConfig().property(ClientProperties.ASYNC_THREADPOOL_SIZE, 9))
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/httpurlconnector/Expect100ContinueTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/httpurlconnector/Expect100ContinueTest.java
index 1616824478..e80fabdf69 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/httpurlconnector/Expect100ContinueTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/httpurlconnector/Expect100ContinueTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -23,7 +23,7 @@
import org.glassfish.jersey.client.http.Expect100ContinueFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
@@ -33,7 +33,7 @@
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class Expect100ContinueTest extends JerseyTest {
@@ -72,7 +72,7 @@ protected Application configure() {
@Test
public void testExpect100Continue() {
final Response response = target(RESOURCE_PATH).request().post(Entity.text(ENTITY_STRING));
- assertEquals("Expected 200", 200, response.getStatus()); //no Expect header sent - responce OK
+ assertEquals(200, response.getStatus(), "Expected 200"); //no Expect header sent - responce OK
}
@Test
@@ -80,7 +80,7 @@ public void testExpect100ContinueChunked() {
final Response response = target(RESOURCE_PATH).register(Expect100ContinueFeature.basic())
.property(ClientProperties.REQUEST_ENTITY_PROCESSING,
RequestEntityProcessing.CHUNKED).request().post(Entity.text(ENTITY_STRING));
- assertEquals("Expected 204", 204, response.getStatus()); //Expect header sent - No Content response
+ assertEquals(204, response.getStatus(), "Expected 204"); //Expect header sent - No Content response
}
@Test
@@ -89,7 +89,7 @@ public void testExpect100ContinueBuffered() {
.property(ClientProperties.REQUEST_ENTITY_PROCESSING,
RequestEntityProcessing.BUFFERED).request().header(HttpHeaders.CONTENT_LENGTH, 67000L)
.post(Entity.text(ENTITY_STRING));
- assertEquals("Expected 204", 204, response.getStatus()); //Expect header sent - No Content response
+ assertEquals(204, response.getStatus(), "Expected 204"); //Expect header sent - No Content response
}
@Test
@@ -97,7 +97,7 @@ public void testExpect100ContinueCustomLength() {
final Response response = target(RESOURCE_PATH).register(Expect100ContinueFeature.withCustomThreshold(100L))
.request().header(HttpHeaders.CONTENT_LENGTH, 101L)
.post(Entity.text(ENTITY_STRING));
- assertEquals("Expected 204", 204, response.getStatus()); //Expect header sent - No Content response
+ assertEquals(204, response.getStatus(), "Expected 204"); //Expect header sent - No Content response
}
@Test
@@ -105,7 +105,7 @@ public void testExpect100ContinueCustomLengthWrong() {
final Response response = target(RESOURCE_PATH).register(Expect100ContinueFeature.withCustomThreshold(100L))
.request().header(HttpHeaders.CONTENT_LENGTH, 99L)
.post(Entity.text(ENTITY_STRING));
- assertEquals("Expected 200", 200, response.getStatus()); //Expect header NOT sent - low request size
+ assertEquals(200, response.getStatus(), "Expected 200"); //Expect header NOT sent - low request size
}
@Test
@@ -115,7 +115,7 @@ public void testExpect100ContinueCustomLengthProperty() {
.register(Expect100ContinueFeature.basic())
.request().header(HttpHeaders.CONTENT_LENGTH, 666L)
.post(Entity.text(ENTITY_STRING));
- assertEquals("Expected 204", 204, response.getStatus()); //Expect header sent - No Content response
+ assertEquals(204, response.getStatus(), "Expected 204"); //Expect header sent - No Content response
}
@Test
@@ -125,6 +125,6 @@ public void testExpect100ContinueRegisterViaCustomProperty() {
.property(ClientProperties.EXPECT_100_CONTINUE, Boolean.TRUE)
.request().header(HttpHeaders.CONTENT_LENGTH, 44L)
.post(Entity.text(ENTITY_STRING));
- assertEquals("Expected 204", 204, response.getStatus()); //Expect header sent - No Content response
+ assertEquals(204, response.getStatus(), "Expected 204"); //Expect header sent - No Content response
}
}
diff --git a/tests/e2e-core-common/pom.xml b/tests/e2e-core-common/pom.xml
index fb49a82ab5..4163e869b8 100644
--- a/tests/e2e-core-common/pom.xml
+++ b/tests/e2e-core-common/pom.xml
@@ -39,8 +39,8 @@
test
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter
test
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/TestRuntimeDelegate.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/TestRuntimeDelegate.java
index 4e5403d4fa..a4d3736353 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/TestRuntimeDelegate.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/TestRuntimeDelegate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -28,7 +28,7 @@
import org.glassfish.jersey.internal.AbstractRuntimeDelegate;
import org.glassfish.jersey.message.internal.MessagingBinders;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
/**
* Test runtime delegate.
@@ -49,31 +49,31 @@ public T createEndpoint(Application application, Class endpointType)
public void testMediaType() {
MediaType m = new MediaType("text", "plain");
- Assert.assertNotNull(m);
+ Assertions.assertNotNull(m);
}
public void testUriBuilder() {
UriBuilder ub = RuntimeDelegate.getInstance().createUriBuilder();
- Assert.assertNotNull(ub);
+ Assertions.assertNotNull(ub);
}
public void testResponseBuilder() {
Response.ResponseBuilder rb = RuntimeDelegate.getInstance().createResponseBuilder();
- Assert.assertNotNull(rb);
+ Assertions.assertNotNull(rb);
}
public void testVariantListBuilder() {
Variant.VariantListBuilder vlb = RuntimeDelegate.getInstance().createVariantListBuilder();
- Assert.assertNotNull(vlb);
+ Assertions.assertNotNull(vlb);
}
public void testLinkBuilder() {
final Link.Builder linkBuilder = RuntimeDelegate.getInstance().createLinkBuilder();
- Assert.assertNotNull(linkBuilder);
+ Assertions.assertNotNull(linkBuilder);
}
public void testWebApplicationException() {
WebApplicationException wae = new WebApplicationException();
- Assert.assertNotNull(wae);
+ Assertions.assertNotNull(wae);
}
}
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/config/ServiceFinderBinderTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/config/ServiceFinderBinderTest.java
index 15b031ffd1..2663dd9b38 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/config/ServiceFinderBinderTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/config/ServiceFinderBinderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -28,11 +28,11 @@
import org.glassfish.jersey.internal.inject.Injections;
import org.glassfish.jersey.internal.inject.Providers;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Service finder injection binder unit test.
@@ -46,7 +46,7 @@ public class ServiceFinderBinderTest {
public ServiceFinderBinderTest() {
}
- @BeforeClass
+ @BeforeAll
public static void setUpClass() throws Exception {
AbstractBinder binder = new AbstractBinder() {
@Override
@@ -60,7 +60,7 @@ protected void configure() {
injectionManager.completeRegistration();
}
- @AfterClass
+ @AfterAll
public static void tearDownClass() throws Exception {
}
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ContextResolverFactoryTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ContextResolverFactoryTest.java
index d69b010b07..d8d5dd6073 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ContextResolverFactoryTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ContextResolverFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -32,10 +32,10 @@
import org.glassfish.jersey.internal.inject.ProviderBinder;
import org.glassfish.jersey.tests.e2e.common.TestRuntimeDelegate;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
/**
* Context resolvers factory unit test.
@@ -107,7 +107,7 @@ public ContextResolverFactoryTest() {
RuntimeDelegate.setInstance(new TestRuntimeDelegate());
}
- @Before
+ @BeforeEach
public void setUp() {
InjectionManager injectionManager = Injections.createInjectionManager();
ProviderBinder providerBinder = new ProviderBinder(injectionManager);
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ExceptionMapperFactoryTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ExceptionMapperFactoryTest.java
index 24b4ffac3e..530662dd78 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ExceptionMapperFactoryTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ExceptionMapperFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -27,8 +27,8 @@
import org.glassfish.jersey.internal.inject.Injections;
import org.glassfish.jersey.spi.ExtendedExceptionMapper;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
/**
* Unit test of {@link ExceptionMapperFactory}.
@@ -85,8 +85,8 @@ public void testFindMappingExtendedExceptions() throws Exception {
final ExceptionMapper mapper = mapperFactory.findMapping(new IllegalArgumentException());
- Assert.assertTrue("IllegalArgumentExceptionMapper should be returned",
- mapper instanceof IllegalArgumentExceptionMapper);
+ Assertions.assertTrue(mapper instanceof IllegalArgumentExceptionMapper,
+ "IllegalArgumentExceptionMapper should be returned");
}
/**
@@ -116,7 +116,7 @@ public void testFindMapping() throws Exception {
final ExceptionMapper mapper = mapperFactory.findMapping(new RuntimeException());
- Assert.assertTrue("RuntimeExceptionMapper should be returned", mapper instanceof RuntimeExceptionMapper);
+ Assertions.assertTrue(mapper instanceof RuntimeExceptionMapper, "RuntimeExceptionMapper should be returned");
}
/**
@@ -147,8 +147,7 @@ public void testFindExtendedExceptions() throws Exception {
final ExceptionMapper mapper = mapperFactory.find(IllegalArgumentException.class);
- Assert.assertTrue("IllegalStateExceptionMapper should be returned",
- mapper instanceof IllegalStateExceptionMapper);
+ Assertions.assertTrue(mapper instanceof IllegalStateExceptionMapper, "IllegalStateExceptionMapper should be returned");
}
/**
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/JaxrsProvidersTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/JaxrsProvidersTest.java
index 49f6cc482c..37746780c9 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/JaxrsProvidersTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/JaxrsProvidersTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -44,9 +44,9 @@
import org.glassfish.jersey.process.internal.RequestScope;
import org.glassfish.jersey.tests.e2e.common.TestRuntimeDelegate;
-import org.junit.Test;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
/**®
* @author Marek Potociar
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/LocalizationMessagesTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/LocalizationMessagesTest.java
index 22c679f37b..e05696435a 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/LocalizationMessagesTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/LocalizationMessagesTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -19,8 +19,8 @@
import org.glassfish.jersey.internal.LocalizationMessages;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
/**
* Tests {@link org.glassfish.jersey.internal.LocalizationMessages}.
@@ -30,7 +30,7 @@ public class LocalizationMessagesTest {
@Test
public void test() {
- Assert.assertTrue(LocalizationMessages.COMPONENT_CONTRACTS_EMPTY_OR_NULL("TYPE")
+ Assertions.assertTrue(LocalizationMessages.COMPONENT_CONTRACTS_EMPTY_OR_NULL("TYPE")
.contains("Attempt to register component of type TYPE"));
}
}
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ProviderBinderTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ProviderBinderTest.java
index b17a6b2177..17d5e9ead6 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ProviderBinderTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/ProviderBinderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -52,9 +52,9 @@
import org.glassfish.jersey.message.internal.MessagingBinders;
import org.glassfish.jersey.tests.e2e.common.TestRuntimeDelegate;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* ServiceProviders unit test.
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/inject/ReferencingFactoryTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/inject/ReferencingFactoryTest.java
index 76429b0150..4d84e0993c 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/inject/ReferencingFactoryTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/internal/inject/ReferencingFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -32,8 +32,8 @@
import org.glassfish.jersey.internal.inject.ReferencingFactory;
import org.glassfish.jersey.internal.util.collection.Ref;
-import org.junit.Test;
-import static org.junit.Assert.assertSame;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertSame;
/**
* Referencing factory test.
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/AcceptableMediaTypeStringRepresentationTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/AcceptableMediaTypeStringRepresentationTest.java
index 2faf424a89..740549ab6d 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/AcceptableMediaTypeStringRepresentationTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/AcceptableMediaTypeStringRepresentationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,19 +16,18 @@
package org.glassfish.jersey.tests.e2e.common.message.internal;
-import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
+import java.util.stream.Stream;
import org.glassfish.jersey.message.internal.AcceptableMediaType;
import org.glassfish.jersey.message.internal.MediaTypeProvider;
import org.glassfish.jersey.message.internal.Quality;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/**
@@ -36,38 +35,28 @@
*
* @author Adam Lindenthal
*/
-@RunWith(Parameterized.class)
public class AcceptableMediaTypeStringRepresentationTest {
- @Parameterized.Parameters
// expected result, acceptable media type
- public static List getParameters() {
+ public static Stream getParameters() {
final Map emptyParams = new HashMap();
final Map params = new HashMap();
params.put("myParam", "myValue");
- return Arrays.asList(new Object[][]{
- {"*/*", new AcceptableMediaType("*", "*")},
- {"*/*", new AcceptableMediaType("*", "*", Quality.DEFAULT, emptyParams)},
- {"*/*;q=0.75", new AcceptableMediaType("*", "*", 750, emptyParams)},
- {"text/html", new AcceptableMediaType("text", "html", Quality.DEFAULT, null)},
- {"text/html;q=0.5", new AcceptableMediaType("text", "html", 500, emptyParams)},
- {"image/*;myparam=myValue;q=0.8", new AcceptableMediaType("image", "*", 800, params)},
- });
+ return Stream.of(
+ Arguments.of("*/*", new AcceptableMediaType("*", "*")),
+ Arguments.of("*/*", new AcceptableMediaType("*", "*", Quality.DEFAULT, emptyParams)),
+ Arguments.of("*/*;q=0.75", new AcceptableMediaType("*", "*", 750, emptyParams)),
+ Arguments.of("text/html", new AcceptableMediaType("text", "html", Quality.DEFAULT, null)),
+ Arguments.of("text/html;q=0.5", new AcceptableMediaType("text", "html", 500, emptyParams)),
+ Arguments.of("image/*;myparam=myValue;q=0.8", new AcceptableMediaType("image", "*", 800, params))
+ );
}
- private final String expectedValue;
- private final AcceptableMediaType testedType;
-
- public AcceptableMediaTypeStringRepresentationTest(final String expectedValue,
- final AcceptableMediaType testedType) {
- this.expectedValue = expectedValue;
- this.testedType = testedType;
- }
-
- @Test
- public void testStringRepresentation() {
+ @ParameterizedTest
+ @MethodSource("getParameters")
+ public void testStringRepresentation(String expectedValue, AcceptableMediaType testedType) {
final MediaTypeProvider provider = new MediaTypeProvider();
- Assert.assertEquals(expectedValue, testedType.toString());
+ Assertions.assertEquals(expectedValue, testedType.toString());
provider.fromString(testedType.toString());
}
}
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/AcceptableMediaTypeTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/AcceptableMediaTypeTest.java
index 7821bfa617..013d410007 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/AcceptableMediaTypeTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/AcceptableMediaTypeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,57 +16,47 @@
package org.glassfish.jersey.tests.e2e.common.message.internal;
-import java.util.Arrays;
-import java.util.List;
+import java.util.stream.Stream;
import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.message.internal.AcceptableMediaType;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/**
* Acceptable media type unit tests.
*
* @author Marek Potociar
*/
-@RunWith(Parameterized.class)
public class AcceptableMediaTypeTest {
- @Parameterized.Parameters
// expected result, media type, acceptable media type
- public static List testBeds() {
- return Arrays.asList(new Object[][]{
- {Boolean.TRUE, MediaType.APPLICATION_JSON_TYPE, new AcceptableMediaType("application", "json")},
- {Boolean.TRUE, MediaType.APPLICATION_JSON_TYPE, new AcceptableMediaType("application", "json", 1000, null)},
- {Boolean.FALSE, MediaType.APPLICATION_JSON_TYPE, new AcceptableMediaType("application", "json", 500, null)},
- {Boolean.FALSE, MediaType.APPLICATION_JSON_TYPE, new AcceptableMediaType("application", "xml")}
- });
+ public static Stream testBeds() {
+ return Stream.of(
+ Arguments.of(Boolean.TRUE, MediaType.APPLICATION_JSON_TYPE, new AcceptableMediaType("application", "json")),
+ Arguments.of(Boolean.TRUE, MediaType.APPLICATION_JSON_TYPE,
+ new AcceptableMediaType("application", "json", 1000, null)),
+ Arguments.of(Boolean.FALSE, MediaType.APPLICATION_JSON_TYPE,
+ new AcceptableMediaType("application", "json", 500, null)),
+ Arguments.of(Boolean.FALSE, MediaType.APPLICATION_JSON_TYPE, new AcceptableMediaType("application", "xml"))
+ );
}
- private final boolean expectEquality;
- private final MediaType mediaType;
- private final AcceptableMediaType acceptableMediaType;
-
- public AcceptableMediaTypeTest(boolean expectEquality, MediaType mediaType, AcceptableMediaType acceptableMediaType) {
- this.expectEquality = expectEquality;
- this.mediaType = mediaType;
- this.acceptableMediaType = acceptableMediaType;
- }
-
- @Test
- public void testEquals() throws Exception {
+ @ParameterizedTest
+ @MethodSource("testBeds")
+ public void testEquals(boolean expectEquality, MediaType mediaType,
+ AcceptableMediaType acceptableMediaType) throws Exception {
if (expectEquality) {
- Assert.assertEquals("Types not equal.", mediaType, acceptableMediaType);
- Assert.assertEquals("Types not equal.", acceptableMediaType, mediaType);
- Assert.assertEquals(
- String.format("Hash codes not equal for %s and %s.", mediaType.toString(), acceptableMediaType.toString()),
- mediaType.hashCode(), acceptableMediaType.hashCode());
+ Assertions.assertEquals(mediaType, acceptableMediaType, "Types not equal.");
+ Assertions.assertEquals(acceptableMediaType, mediaType, "Types not equal.");
+ Assertions.assertEquals(mediaType.hashCode(), acceptableMediaType.hashCode(),
+ String.format("Hash codes not equal for %s and %s.", mediaType.toString(), acceptableMediaType.toString()));
} else {
- Assert.assertFalse(String.format("False equality of %s and %s", mediaType.toString(), acceptableMediaType.toString()),
- acceptableMediaType.equals(mediaType));
+ Assertions.assertFalse(acceptableMediaType.equals(mediaType),
+ String.format("False equality of %s and %s", mediaType.toString(), acceptableMediaType.toString()));
}
}
}
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/CommittingOutputStreamTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/CommittingOutputStreamTest.java
index 23f88b7516..fc49c618a6 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/CommittingOutputStreamTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/CommittingOutputStreamTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -32,11 +32,11 @@
import org.glassfish.jersey.model.internal.CommonConfig;
import org.glassfish.jersey.model.internal.ComponentBag;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Test the {@link CommittingOutputStream}.
@@ -295,7 +295,7 @@ public OutputStream getOutputStream(int contentLength) throws IOException {
if (i >= expectedSize + 1) {
break;
} else {
- assertFalse("committed already with byte #" + i, passed.b);
+ assertFalse(passed.b, "committed already with byte #" + i);
}
}
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/CookiesParserTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/CookiesParserTest.java
index 77ce25b128..540d44b748 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/CookiesParserTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/CookiesParserTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -23,7 +23,7 @@
import org.glassfish.jersey.message.internal.CookiesParser;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/HeaderUtilsTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/HeaderUtilsTest.java
index bc370e4c8f..3ac47823cd 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/HeaderUtilsTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/HeaderUtilsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -32,14 +32,14 @@
import org.glassfish.jersey.message.internal.HeaderUtils;
import org.glassfish.jersey.tests.e2e.common.TestRuntimeDelegate;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* {@link HeaderUtils} unit tests.
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/InboundMessageContextTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/InboundMessageContextTest.java
index bd29bb4852..9a3fdd71ce 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/InboundMessageContextTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/InboundMessageContextTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -35,11 +35,11 @@
import org.glassfish.jersey.message.internal.InboundMessageContext;
import org.glassfish.jersey.tests.e2e.common.TestRuntimeDelegate;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* {@link org.glassfish.jersey.message.internal.InboundMessageContext} test.
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/JerseyLinkTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/JerseyLinkTest.java
index 7e25df847a..7110355796 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/JerseyLinkTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/JerseyLinkTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -26,11 +26,11 @@
import org.glassfish.jersey.tests.e2e.common.TestRuntimeDelegate;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Tests for LinkTest class.
@@ -55,12 +55,12 @@ public String notSelf() {
}
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
RuntimeDelegate.setInstance(new TestRuntimeDelegate());
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
RuntimeDelegate.setInstance(null);
}
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/LinkProviderTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/LinkProviderTest.java
index 0f8f3c7edc..7691af79e5 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/LinkProviderTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/LinkProviderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -21,10 +21,10 @@
import org.glassfish.jersey.tests.e2e.common.TestRuntimeDelegate;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Tests for LinkProvider class.
@@ -33,12 +33,12 @@
*/
public class LinkProviderTest {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
RuntimeDelegate.setInstance(new TestRuntimeDelegate());
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
RuntimeDelegate.setInstance(null);
}
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/MatchingEntityTagTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/MatchingEntityTagTest.java
index 19ad5e1ed4..36dcc2326c 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/MatchingEntityTagTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/MatchingEntityTagTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -24,14 +24,14 @@
import org.glassfish.jersey.message.internal.HttpHeaderReader;
import org.glassfish.jersey.message.internal.MatchingEntityTag;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* {@link MatchingEntityTag} unit tests ported from Jersey 1.x.
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/MediaTypesTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/MediaTypesTest.java
index 12dcd81210..c9531a148d 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/MediaTypesTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/MediaTypesTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -27,10 +27,10 @@
import org.glassfish.jersey.message.internal.HttpHeaderReader;
import org.glassfish.jersey.message.internal.MediaTypes;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* MediaTypes utility method tests.
@@ -43,16 +43,16 @@ public class MediaTypesTest {
@Test
public void testConvertToString() {
final List emptyList = Collections.emptyList();
- Assert.assertEquals("", MediaTypes.convertToString(emptyList));
+ Assertions.assertEquals("", MediaTypes.convertToString(emptyList));
- Assert.assertEquals("\"text/plain\"", MediaTypes.convertToString(Collections.singleton(MediaType.TEXT_PLAIN_TYPE)));
+ Assertions.assertEquals("\"text/plain\"", MediaTypes.convertToString(Collections.singleton(MediaType.TEXT_PLAIN_TYPE)));
- Assert.assertEquals("\"text/plain\", \"application/json\"",
+ Assertions.assertEquals("\"text/plain\", \"application/json\"",
MediaTypes.convertToString(Arrays.asList(MediaType.TEXT_PLAIN_TYPE,
MediaType.APPLICATION_JSON_TYPE)));
- Assert.assertEquals("\"text/plain\", \"application/json\", \"text/html\"",
+ Assertions.assertEquals("\"text/plain\", \"application/json\", \"text/html\"",
MediaTypes.convertToString(Arrays.asList(MediaType.TEXT_PLAIN_TYPE,
MediaType.APPLICATION_JSON_TYPE,
MediaType.TEXT_HTML_TYPE)));
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundJaxrsResponseBuilderTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundJaxrsResponseBuilderTest.java
index f0257cdc32..2a026dfae1 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundJaxrsResponseBuilderTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundJaxrsResponseBuilderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -26,8 +26,8 @@
import org.glassfish.jersey.message.internal.OutboundMessageContext;
import org.glassfish.jersey.tests.e2e.common.TestRuntimeDelegate;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* JaxrsResponseViewTest class.
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundJaxrsResponseTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundJaxrsResponseTest.java
index 3267ad2dc3..d3c8621b41 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundJaxrsResponseTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundJaxrsResponseTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -29,11 +29,11 @@
import org.glassfish.jersey.message.internal.OutboundMessageContext;
import org.glassfish.jersey.tests.e2e.common.TestRuntimeDelegate;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* OutboundJaxrsResponse unit tests.
@@ -96,7 +96,7 @@ public OutboundJaxrsResponseTest() {
RuntimeDelegate.setInstance(new TestRuntimeDelegate());
}
- @Before
+ @BeforeEach
public void setUp() {
rb = new OutboundJaxrsResponse.Builder(new OutboundMessageContext((Configuration) null)).status(Response.Status.OK);
}
@@ -110,7 +110,7 @@ public void testBufferEmptyEntity() {
final OutboundJaxrsResponse r = OutboundJaxrsResponse.from(rb.build(), null);
r.getContext().setStreamProvider(TEST_PROVIDER);
- assertFalse("Buffer entity should return 'false' if no entity.", r.bufferEntity());
+ assertFalse(r.bufferEntity(), "Buffer entity should return 'false' if no entity.");
}
/**
@@ -121,7 +121,7 @@ public void testBufferNonStreamEntity() {
final OutboundJaxrsResponse r = OutboundJaxrsResponse.from(rb.entity(new Object()).build(), null);
r.getContext().setStreamProvider(TEST_PROVIDER);
- assertFalse("Buffer entity should return 'false' for non-stream entity.", r.bufferEntity());
+ assertFalse(r.bufferEntity(), "Buffer entity should return 'false' for non-stream entity.");
}
/**
@@ -133,10 +133,10 @@ public void testBufferStreamEntity() {
final OutboundJaxrsResponse r = OutboundJaxrsResponse.from(rb.entity(tis).build(), null);
r.getContext().setStreamProvider(TEST_PROVIDER);
- assertTrue("Buffer entity should return 'true' for stream entity.", r.bufferEntity());
- assertTrue("Second call to buffer entity should return 'true' for stream entity.", r.bufferEntity()); // second call
- assertTrue("Buffered stream has not been fully read.", tis.isRead);
- assertTrue("Buffered stream has not been closed after buffering.", tis.isClosed);
+ assertTrue(r.bufferEntity(), "Buffer entity should return 'true' for stream entity.");
+ assertTrue(r.bufferEntity(), "Second call to buffer entity should return 'true' for stream entity."); // second call
+ assertTrue(tis.isRead, "Buffered stream has not been fully read.");
+ assertTrue(tis.isClosed, "Buffered stream has not been closed after buffering.");
}
/**
@@ -193,8 +193,8 @@ public void testCloseStreamEntity() {
}
r.close(); // second call should pass
- assertFalse("Unbuffered closed response stream entity should not be read.", tis.isRead);
- assertTrue("Closed response stream entity should have been closed.", tis.isClosed);
+ assertFalse(tis.isRead, "Unbuffered closed response stream entity should not be read.");
+ assertTrue(tis.isClosed, "Closed response stream entity should have been closed.");
}
/**
@@ -245,8 +245,8 @@ public void testCloseStreamEntityNoStreamProvider() {
}
r.close(); // second call should pass
- assertFalse("Unbuffered closed response stream entity should not be read.", tis.isRead);
- assertTrue("Closed response stream entity should have been closed.", tis.isClosed);
+ assertFalse(tis.isRead, "Unbuffered closed response stream entity should not be read.");
+ assertTrue(tis.isClosed, "Closed response stream entity should have been closed.");
}
}
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundMessageContextTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundMessageContextTest.java
index 28775941b2..537078079e 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundMessageContextTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/OutboundMessageContextTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -36,15 +36,15 @@
import org.glassfish.jersey.message.internal.OutboundMessageContext;
import org.glassfish.jersey.tests.e2e.common.TestRuntimeDelegate;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* {@link OutboundMessageContext} test.
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/QualitySourceMediaTypeTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/QualitySourceMediaTypeTest.java
index 1841774431..8e20a44d6f 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/QualitySourceMediaTypeTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/message/internal/QualitySourceMediaTypeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,57 +16,46 @@
package org.glassfish.jersey.tests.e2e.common.message.internal;
-import java.util.Arrays;
-import java.util.List;
+import java.util.stream.Stream;
import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.message.internal.QualitySourceMediaType;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/**
* Quality source media type unit tests.
*
* @author Marek Potociar
*/
-@RunWith(Parameterized.class)
public class QualitySourceMediaTypeTest {
- @Parameterized.Parameters
// expected result, media type, quality source media type
- public static List testBeds() {
- return Arrays.asList(new Object[][]{
- {Boolean.TRUE, MediaType.APPLICATION_JSON_TYPE, new QualitySourceMediaType("application", "json")},
- {Boolean.TRUE, MediaType.APPLICATION_JSON_TYPE, new QualitySourceMediaType("application", "json", 1000, null)},
- {Boolean.FALSE, MediaType.APPLICATION_JSON_TYPE, new QualitySourceMediaType("application", "json", 500, null)},
- {Boolean.FALSE, MediaType.APPLICATION_JSON_TYPE, new QualitySourceMediaType("application", "xml")}
- });
+ public static Stream testBeds() {
+ return Stream.of(
+ Arguments.of(Boolean.TRUE, MediaType.APPLICATION_JSON_TYPE, new QualitySourceMediaType("application", "json")),
+ Arguments.of(Boolean.TRUE, MediaType.APPLICATION_JSON_TYPE,
+ new QualitySourceMediaType("application", "json", 1000, null)),
+ Arguments.of(Boolean.FALSE, MediaType.APPLICATION_JSON_TYPE,
+ new QualitySourceMediaType("application", "json", 500, null)),
+ Arguments.of(Boolean.FALSE, MediaType.APPLICATION_JSON_TYPE, new QualitySourceMediaType("application", "xml"))
+ );
}
- private final boolean expectEquality;
- private final MediaType mediaType;
- private final QualitySourceMediaType qsMediaType;
-
- public QualitySourceMediaTypeTest(boolean expectEquality, MediaType mediaType, QualitySourceMediaType qsMediaType) {
- this.expectEquality = expectEquality;
- this.mediaType = mediaType;
- this.qsMediaType = qsMediaType;
- }
-
- @Test
- public void testEquals() throws Exception {
+ @ParameterizedTest
+ @MethodSource("testBeds")
+ public void testEquals(boolean expectEquality, MediaType mediaType, QualitySourceMediaType qsMediaType) throws Exception {
if (expectEquality) {
- Assert.assertEquals("Types not equal.", mediaType, qsMediaType);
- Assert.assertEquals("Types not equal.", qsMediaType, mediaType);
- Assert.assertEquals(
- String.format("Hash codes not equal for %s and %s.", mediaType.toString(), qsMediaType.toString()),
- mediaType.hashCode(), qsMediaType.hashCode());
+ Assertions.assertEquals(mediaType, qsMediaType, "Types not equal.");
+ Assertions.assertEquals(qsMediaType, mediaType, "Types not equal.");
+ Assertions.assertEquals(mediaType.hashCode(), qsMediaType.hashCode(),
+ String.format("Hash codes not equal for %s and %s.", mediaType.toString(), qsMediaType.toString()));
} else {
- Assert.assertFalse(String.format("False equality of %s and %s", mediaType.toString(), qsMediaType.toString()),
- qsMediaType.equals(mediaType));
+ Assertions.assertFalse(qsMediaType.equals(mediaType),
+ String.format("False equality of %s and %s", mediaType.toString(), qsMediaType.toString()));
}
}
}
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/model/internal/CommonConfigTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/model/internal/CommonConfigTest.java
index e9319121f0..fb1a982aba 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/model/internal/CommonConfigTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/model/internal/CommonConfigTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -52,21 +52,21 @@
import org.glassfish.jersey.model.internal.ManagedObjectsFinalizer;
import org.glassfish.jersey.model.internal.RankedComparator;
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.lessThan;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Test cases for {@link javax.ws.rs.core.Configuration}.
@@ -77,7 +77,7 @@ public class CommonConfigTest {
private CommonConfig config;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
config = new CommonConfig(null, ComponentBag.INCLUDE_ALL);
}
@@ -442,9 +442,9 @@ public void testRegisterClassContracts() throws Exception {
final ContractProvider contractProvider = config.getComponentBag().getModel(ComplexEmptyProvider.class);
final Set> contracts = contractProvider.getContracts();
assertEquals(2, contracts.size());
- assertTrue(ReaderInterceptor.class + " is not registered.", contracts.contains(ReaderInterceptor.class));
- assertTrue(ContainerRequestFilter.class + " is not registered.", contracts.contains(ContainerRequestFilter.class));
- assertFalse(WriterInterceptor.class + " should not be registered.", contracts.contains(WriterInterceptor.class));
+ assertTrue(contracts.contains(ReaderInterceptor.class), ReaderInterceptor.class + " is not registered.");
+ assertTrue(contracts.contains(ContainerRequestFilter.class), ContainerRequestFilter.class + " is not registered.");
+ assertFalse(contracts.contains(WriterInterceptor.class), WriterInterceptor.class + " should not be registered.");
assertTrue(config.getInstances().isEmpty());
assertTrue(config.getClasses().contains(ComplexEmptyProvider.class));
@@ -466,9 +466,9 @@ public void testRegisterInstancesContracts() throws Exception {
final ContractProvider contractProvider = config.getComponentBag().getModel(ComplexEmptyProvider.class);
final Set> contracts = contractProvider.getContracts();
assertEquals(2, contracts.size());
- assertTrue(ReaderInterceptor.class + " is not registered.", contracts.contains(ReaderInterceptor.class));
- assertTrue(ContainerRequestFilter.class + " is not registered.", contracts.contains(ContainerRequestFilter.class));
- assertFalse(WriterInterceptor.class + " should not be registered.", contracts.contains(WriterInterceptor.class));
+ assertTrue(contracts.contains(ReaderInterceptor.class), ReaderInterceptor.class + " is not registered.");
+ assertTrue(contracts.contains(ContainerRequestFilter.class), ContainerRequestFilter.class + " is not registered.");
+ assertFalse(contracts.contains(WriterInterceptor.class), WriterInterceptor.class + " should not be registered.");
assertTrue(config.getInstances().contains(complexEmptyProvider));
assertTrue(config.getClasses().isEmpty());
@@ -689,7 +689,7 @@ private void _testCollectionsCommon(final String testName, final Collection<
throws Exception {
// Not null.
- assertNotNull(testName + " - returned collection is null.", collection);
+ assertNotNull(collection, testName + " - returned collection is null.");
// Immutability.
try {
@@ -965,7 +965,7 @@ protected void configure() {
@Test
public void testFeatureInjections() throws Exception {
- Assume.assumeTrue(Hk2InjectionManagerFactory.isImmediateStrategy());
+ Assumptions.assumeTrue(Hk2InjectionManagerFactory.isImmediateStrategy());
config.register(InjectIntoFeatureClass.class)
.register(new InjectIntoFeatureInstance())
@@ -985,7 +985,7 @@ protected void configure() {
}
@Test
- @Ignore
+ @Disabled
public void testFeatureInjectionsBindInFeature() throws Exception {
config.register(new BindInjectMeInFeature());
config.register(InjectIntoFeatureClass.class);
@@ -1078,9 +1078,9 @@ public void testBinderOrderingInGetClasses() {
config.configureMetaProviders(injectionManager, finalizer);
Object[] classes = config.getComponentBag().getClasses(contractProvider -> true).toArray();
- Assert.assertEquals(classes[0], ContractBinderOne.class);
- Assert.assertEquals(classes[1], ContractBinderTwo.class);
- Assert.assertEquals(classes[2], ContractBinder.class);
+ Assertions.assertEquals(classes[0], ContractBinderOne.class);
+ Assertions.assertEquals(classes[1], ContractBinderTwo.class);
+ Assertions.assertEquals(classes[2], ContractBinder.class);
}
@Test
@@ -1093,9 +1093,9 @@ public void testBinderOrderingInGetInstances() {
config.configureMetaProviders(injectionManager, finalizer);
Object[] instances = config.getComponentBag().getInstances(contractProvider -> true).toArray();
- Assert.assertEquals(instances[0], binders[2]);
- Assert.assertEquals(instances[1], binders[1]);
- Assert.assertEquals(instances[2], binders[0]);
+ Assertions.assertEquals(instances[0], binders[2]);
+ Assertions.assertEquals(instances[1], binders[1]);
+ Assertions.assertEquals(instances[2], binders[0]);
}
public static class ContractBinderOne extends ContractBinder {
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/ExecutorProvidersTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/ExecutorProvidersTest.java
index ccbc53d8e3..f5b0b0a077 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/ExecutorProvidersTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/ExecutorProvidersTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -40,10 +40,10 @@
import org.glassfish.jersey.spi.ThreadPoolExecutorProvider;
import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* ExecutorProviders unit tests.
@@ -205,7 +205,7 @@ protected void configure() {
/**
* Set-up the tests.
*/
- @Before
+ @BeforeEach
public void setup() {
injectionManager = Injections.createInjectionManager(this);
ExecutorProviders.registerExecutorBindings(injectionManager);
@@ -262,8 +262,8 @@ public void testExecutorInjectionAndReleasing() throws Exception {
}
private void testShutDown(String name, ExecutorService executorService) throws InterruptedException {
- assertTrue(name + " not shutdown", executorService.isShutdown());
- assertTrue(name + " not terminated", executorService.isTerminated());
+ assertTrue(executorService.isShutdown(), name + " not shutdown");
+ assertTrue(executorService.isTerminated(), name + " not terminated");
}
}
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/RequestScopeTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/RequestScopeTest.java
index 36a23e9124..758289401b 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/RequestScopeTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/RequestScopeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -25,10 +25,10 @@
import org.glassfish.hk2.api.ServiceHandle;
import org.glassfish.hk2.utilities.AbstractActiveDescriptor;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test of the {@link RequestScope request scope}.
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/uri/internal/JerseyUriBuilderTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/uri/internal/JerseyUriBuilderTest.java
index 06799b8d4b..d9a391b6b9 100644
--- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/uri/internal/JerseyUriBuilderTest.java
+++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/uri/internal/JerseyUriBuilderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -37,11 +37,11 @@
import org.glassfish.jersey.uri.UriComponent;
import org.glassfish.jersey.uri.internal.JerseyUriBuilder;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Uri builder implementation test.
@@ -314,7 +314,7 @@ public void testUriBuilderTemplatesSimple() {
}
@Test
- @Ignore
+ @Disabled
public void failingTests() {
testUri("a://#fragment"); // fails in JerseyUriBuilder
testUri("a://?query");
@@ -413,107 +413,107 @@ private void testUri(final String input) {
assertEquals(input, uri.toString());
}
- @org.junit.Test
+ @Test
public void testOpaqueUri() {
final URI uri = UriBuilder.fromUri("mailto:a@b").build();
- Assert.assertEquals("mailto:a@b", uri.toString());
+ Assertions.assertEquals("mailto:a@b", uri.toString());
}
@Test
public void testOpaqueUriReplaceSchemeSpecificPart() {
final URI uri = UriBuilder.fromUri("mailto:a@b").schemeSpecificPart("c@d").build();
- Assert.assertEquals("mailto:c@d", uri.toString());
+ Assertions.assertEquals("mailto:c@d", uri.toString());
}
@Test
public void testOpaqueReplaceUri() {
final URI uri = UriBuilder.fromUri("mailto:a@b").uri(URI.create("c@d")).build();
- Assert.assertEquals("mailto:c@d", uri.toString());
+ Assertions.assertEquals("mailto:c@d", uri.toString());
}
@Test
public void testReplaceScheme() {
URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").scheme("https").build();
- Assert.assertEquals("https://localhost:8080/a/b/c", uri.toString());
+ Assertions.assertEquals("https://localhost:8080/a/b/c", uri.toString());
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").scheme(null).build();
- Assert.assertEquals("//localhost:8080/a/b/c", uri.toString());
+ Assertions.assertEquals("//localhost:8080/a/b/c", uri.toString());
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").scheme(null).host(null).build();
- Assert.assertEquals("//:8080/a/b/c", uri.toString());
+ Assertions.assertEquals("//:8080/a/b/c", uri.toString());
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").scheme(null).host(null).port(-1).build();
- Assert.assertEquals("/a/b/c", uri.toString());
+ Assertions.assertEquals("/a/b/c", uri.toString());
}
@Test
public void testReplaceSchemeSpecificPart() {
final URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").schemeSpecificPart("//localhost:8080/a/b/c/d").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/d"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/d"), uri);
}
@Test
public void testNameAuthorityUri() {
final URI uri = UriBuilder.fromUri("http://x_y/a/b/c").build();
- Assert.assertEquals(URI.create("http://x_y/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://x_y/a/b/c"), uri);
}
@Test
public void testReplaceNameAuthorityUriWithHost() {
final URI uri = UriBuilder.fromUri("http://x_y.com/a/b/c").host("xy.com").build();
- Assert.assertEquals(URI.create("http://xy.com/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://xy.com/a/b/c"), uri);
}
@Test
public void testReplaceNameAuthorityUriWithSSP() {
URI uri = UriBuilder.fromUri("http://x_y.com/a/b/c").schemeSpecificPart("//xy.com/a/b/c").build();
- Assert.assertEquals(URI.create("http://xy.com/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://xy.com/a/b/c"), uri);
uri = UriBuilder.fromUri("http://x_y.com/a/b/c").schemeSpecificPart("//v_w.com/a/b/c").build();
- Assert.assertEquals(URI.create("http://v_w.com/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://v_w.com/a/b/c"), uri);
}
@Test
public void testReplaceUserInfo() {
final URI uri = UriBuilder.fromUri("http://bob@localhost:8080/a/b/c").userInfo("sue").build();
- Assert.assertEquals(URI.create("http://sue@localhost:8080/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://sue@localhost:8080/a/b/c"), uri);
}
@Test
public void testReplaceHost() {
URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").host("a.com").build();
- Assert.assertEquals(URI.create("http://a.com:8080/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://a.com:8080/a/b/c"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").host("[::FFFF:129.144.52.38]").build();
- Assert.assertEquals(URI.create("http://[::FFFF:129.144.52.38]:8080/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://[::FFFF:129.144.52.38]:8080/a/b/c"), uri);
}
@Test
public void testReplacePort() {
URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").port(9090).build();
- Assert.assertEquals(URI.create("http://localhost:9090/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:9090/a/b/c"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").port(-1).build();
- Assert.assertEquals(URI.create("http://localhost/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://localhost/a/b/c"), uri);
}
@Test
public void testReplacePath() {
final URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").replacePath("/x/y/z").build();
- Assert.assertEquals(URI.create("http://localhost:8080/x/y/z"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/x/y/z"), uri);
}
@Test
public void testReplacePathNull() {
final URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").replacePath(null).build();
- Assert.assertEquals(URI.create("http://localhost:8080"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080"), uri);
}
@Test
public void testReplaceMatrix() {
final URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c;a=x;b=y").replaceMatrix("x=a;y=b").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c;x=a;y=b"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c;x=a;y=b"), uri);
}
@Test
@@ -525,12 +525,12 @@ public void testReplaceMatrixParams() {
final List ps = UriComponent.decodePath(uri, true);
final MultivaluedMap mps = ps.get(2).getMatrixParameters();
final List a = mps.get("a");
- Assert.assertEquals(2, a.size());
- Assert.assertEquals("z", a.get(0));
- Assert.assertEquals("zz", a.get(1));
+ Assertions.assertEquals(2, a.size());
+ Assertions.assertEquals("z", a.get(0));
+ Assertions.assertEquals("zz", a.get(1));
final List b = mps.get("b");
- Assert.assertEquals(1, b.size());
- Assert.assertEquals("y", b.get(0));
+ Assertions.assertEquals(1, b.size());
+ Assertions.assertEquals("y", b.get(0));
}
{
@@ -538,12 +538,12 @@ public void testReplaceMatrixParams() {
final List ps = UriComponent.decodePath(uri, true);
final MultivaluedMap mps = ps.get(2).getMatrixParameters();
final List a = mps.get("a");
- Assert.assertEquals(2, a.size());
- Assert.assertEquals("_z_", a.get(0));
- Assert.assertEquals("_zz_", a.get(1));
+ Assertions.assertEquals(2, a.size());
+ Assertions.assertEquals("_z_", a.get(0));
+ Assertions.assertEquals("_zz_", a.get(1));
final List b = mps.get("b");
- Assert.assertEquals(1, b.size());
- Assert.assertEquals("y", b.get(0));
+ Assertions.assertEquals(1, b.size());
+ Assertions.assertEquals("y", b.get(0));
}
{
@@ -554,15 +554,15 @@ public void testReplaceMatrixParams() {
final List ps = UriComponent.decodePath(uri, true);
final MultivaluedMap mps = ps.get(2).getMatrixParameters();
final List a = mps.get("a");
- Assert.assertEquals(2, a.size());
- Assert.assertEquals("z", a.get(0));
- Assert.assertEquals("zz", a.get(1));
+ Assertions.assertEquals(2, a.size());
+ Assertions.assertEquals("z", a.get(0));
+ Assertions.assertEquals("zz", a.get(1));
final List b = mps.get("b");
- Assert.assertEquals(1, b.size());
- Assert.assertEquals("y", b.get(0));
+ Assertions.assertEquals(1, b.size());
+ Assertions.assertEquals("y", b.get(0));
final List c = mps.get("c");
- Assert.assertEquals(1, c.size());
- Assert.assertEquals("c", c.get(0));
+ Assertions.assertEquals(1, c.size());
+ Assertions.assertEquals("c", c.get(0));
}
{
@@ -573,24 +573,24 @@ public void testReplaceMatrixParams() {
MultivaluedMap mps = ps.get(0).getMatrixParameters();
List w = mps.get("w");
- Assert.assertEquals(1, w.size());
- Assert.assertEquals("123", w.get(0));
+ Assertions.assertEquals(1, w.size());
+ Assertions.assertEquals("123", w.get(0));
w = mps.get("q");
- Assert.assertEquals(1, w.size());
- Assert.assertEquals("15", w.get(0));
+ Assertions.assertEquals(1, w.size());
+ Assertions.assertEquals("15", w.get(0));
mps = ps.get(2).getMatrixParameters();
final List a = mps.get("a");
- Assert.assertEquals(2, a.size());
- Assert.assertEquals("z", a.get(0));
- Assert.assertEquals("zz", a.get(1));
+ Assertions.assertEquals(2, a.size());
+ Assertions.assertEquals("z", a.get(0));
+ Assertions.assertEquals("zz", a.get(1));
final List b = mps.get("b");
- Assert.assertEquals(1, b.size());
- Assert.assertEquals("y", b.get(0));
+ Assertions.assertEquals(1, b.size());
+ Assertions.assertEquals("y", b.get(0));
final List c = mps.get("c");
- Assert.assertEquals(1, c.size());
- Assert.assertEquals("c", c.get(0));
+ Assertions.assertEquals(1, c.size());
+ Assertions.assertEquals("c", c.get(0));
}
}
@@ -602,9 +602,9 @@ public void testReplaceMatrixParamsEmpty() {
final List ps = UriComponent.decodePath(uri, true);
final MultivaluedMap mps = ps.get(2).getMatrixParameters();
final List a = mps.get("a");
- Assert.assertEquals(2, a.size());
- Assert.assertEquals("z", a.get(0));
- Assert.assertEquals("zz", a.get(1));
+ Assertions.assertEquals(2, a.size());
+ Assertions.assertEquals("z", a.get(0));
+ Assertions.assertEquals("zz", a.get(1));
}
}
@@ -614,7 +614,7 @@ public void testReplaceMatrixParamsEncoded() throws URISyntaxException {
ubu.replaceMatrixParam("limit", 100);
final URI uri = ubu.build();
- Assert.assertEquals(URI.create("http://localhost/;limit=100;sql=select+*+from+users"), uri);
+ Assertions.assertEquals(URI.create("http://localhost/;limit=100;sql=select+*+from+users"), uri);
}
@Test
@@ -623,7 +623,7 @@ public void testMatrixParamsWithTheSameName() {
first = first.path("/child");
first = first.replaceMatrixParam("example", "another");
- Assert.assertEquals("http://www.com/;example=one;example=two/child;example=another", first.build().toString());
+ Assertions.assertEquals("http://www.com/;example=one;example=two/child;example=another", first.build().toString());
}
@Test
@@ -632,23 +632,23 @@ public void testMatrixParamsWithTheDifferentName() {
first = first.path("/child");
first = first.replaceMatrixParam("other", "another");
- Assert.assertEquals("http://www.com/;example=one;example=two/child;other=another", first.build().toString());
+ Assertions.assertEquals("http://www.com/;example=one;example=two/child;other=another", first.build().toString());
}
@Test
public void testReplaceQuery() {
final URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c?a=x&b=y").replaceQuery("x=a&y=b").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c?x=a&y=b"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c?x=a&y=b"), uri);
}
@Test
public void testBuildEncodedQuery() {
URI u = UriBuilder.fromPath("").queryParam("y", "1 %2B 2").build();
- Assert.assertEquals(URI.create("?y=1+%2B+2"), u);
+ Assertions.assertEquals(URI.create("?y=1+%2B+2"), u);
// Issue 216
u = UriBuilder.fromPath("http://localhost:8080").path("/{x}/{y}/{z}/{x}").buildFromEncoded("%xy", " ", "=");
- Assert.assertEquals(URI.create("http://localhost:8080/%25xy/%20/=/%25xy"), u);
+ Assertions.assertEquals(URI.create("http://localhost:8080/%25xy/%20/=/%25xy"), u);
}
@Test
@@ -661,15 +661,15 @@ public void testReplaceQueryParams() {
final MultivaluedMap qps = UriComponent.decodeQuery(uri, true);
final List a = qps.get("a");
- Assert.assertEquals(2, a.size());
- Assert.assertEquals("z", a.get(0));
- Assert.assertEquals("zz", a.get(1));
+ Assertions.assertEquals(2, a.size());
+ Assertions.assertEquals("z", a.get(0));
+ Assertions.assertEquals("zz", a.get(1));
final List b = qps.get("b");
- Assert.assertEquals(1, b.size());
- Assert.assertEquals("y", b.get(0));
+ Assertions.assertEquals(1, b.size());
+ Assertions.assertEquals("y", b.get(0));
final List c = qps.get("c");
- Assert.assertEquals(1, c.size());
- Assert.assertEquals("c", c.get(0));
+ Assertions.assertEquals(1, c.size());
+ Assertions.assertEquals("c", c.get(0));
}
{
@@ -677,15 +677,15 @@ public void testReplaceQueryParams() {
final MultivaluedMap qps = UriComponent.decodeQuery(uri, true);
final List a = qps.get("a");
- Assert.assertEquals(2, a.size());
- Assert.assertEquals("_z_", a.get(0));
- Assert.assertEquals("_zz_", a.get(1));
+ Assertions.assertEquals(2, a.size());
+ Assertions.assertEquals("_z_", a.get(0));
+ Assertions.assertEquals("_zz_", a.get(1));
final List b = qps.get("b");
- Assert.assertEquals(1, b.size());
- Assert.assertEquals("y", b.get(0));
+ Assertions.assertEquals(1, b.size());
+ Assertions.assertEquals("y", b.get(0));
final List c = qps.get("c");
- Assert.assertEquals(1, c.size());
- Assert.assertEquals("c", c.get(0));
+ Assertions.assertEquals(1, c.size());
+ Assertions.assertEquals("c", c.get(0));
}
// issue 257 - param is removed after setting it to null
@@ -693,10 +693,10 @@ public void testReplaceQueryParams() {
final URI u1 = UriBuilder.fromPath("http://localhost:8080").queryParam("x", "10")
.replaceQueryParam("x", (Object[]) null)
.build();
- Assert.assertTrue(u1.toString().equals("http://localhost:8080"));
+ Assertions.assertTrue(u1.toString().equals("http://localhost:8080"));
final URI u2 = UriBuilder.fromPath("http://localhost:8080").queryParam("x", "10").replaceQueryParam("x").build();
- Assert.assertTrue(u2.toString().equals("http://localhost:8080"));
+ Assertions.assertTrue(u2.toString().equals("http://localhost:8080"));
}
// issue 257 - IllegalArgumentException
@@ -709,7 +709,7 @@ public void testReplaceQueryParams() {
caught = true;
}
- Assert.assertTrue(caught);
+ Assertions.assertTrue(caught);
}
}
@@ -724,12 +724,12 @@ public void testReplaceQueryParamsEmpty() {
final MultivaluedMap qps = UriComponent.decodeQuery(uri, true);
final List a = qps.get("a");
- Assert.assertEquals(2, a.size());
- Assert.assertEquals("z", a.get(0));
- Assert.assertEquals("zz", a.get(1));
+ Assertions.assertEquals(2, a.size());
+ Assertions.assertEquals("z", a.get(0));
+ Assertions.assertEquals("zz", a.get(1));
final List c = qps.get("c");
- Assert.assertEquals(1, c.size());
- Assert.assertEquals("c", c.get(0));
+ Assertions.assertEquals(1, c.size());
+ Assertions.assertEquals("c", c.get(0));
}
}
@@ -739,7 +739,7 @@ public void testReplaceQueryParamsEncoded1() throws URISyntaxException {
ubu.replaceQueryParam("limit", 100);
final URI uri = ubu.build();
- Assert.assertEquals(URI.create("http://localhost/?limit=100&sql=select+%2A+from+users"), uri);
+ Assertions.assertEquals(URI.create("http://localhost/?limit=100&sql=select+%2A+from+users"), uri);
}
@Test
@@ -748,7 +748,7 @@ public void testReplaceQueryParamsEncoded2() throws URISyntaxException {
ubu.replaceQueryParam("limit", 100);
final URI uri = ubu.build();
- Assert.assertEquals(URI.create("http://localhost/?limit=100&sql=select+%2A+from+users"), uri);
+ Assertions.assertEquals(URI.create("http://localhost/?limit=100&sql=select+%2A+from+users"), uri);
}
@Test
@@ -757,7 +757,7 @@ public void testReplaceQueryParamsEncoded3() throws URISyntaxException {
ubu.replaceQueryParam("limit", 100);
final URI uri = ubu.build();
- Assert.assertEquals(URI.create("http://localhost/?limit=100&sql=select+%2A+from+users"), uri);
+ Assertions.assertEquals(URI.create("http://localhost/?limit=100&sql=select+%2A+from+users"), uri);
}
@Test
@@ -766,13 +766,13 @@ public void testReplaceQueryParamsEncoded4() throws URISyntaxException {
ubu.replaceQueryParam("limit", 100);
final URI uri = ubu.build();
- Assert.assertEquals(URI.create("http://localhost/?limit=100&sql=select+%2A+from+users"), uri);
+ Assertions.assertEquals(URI.create("http://localhost/?limit=100&sql=select+%2A+from+users"), uri);
}
@Test
public void testReplaceFragment() {
final URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c?a=x&b=y#frag").fragment("ment").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c?a=x&b=y#ment"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c?a=x&b=y#ment"), uri);
}
@Test
@@ -780,22 +780,22 @@ public void testReplaceUri() {
final URI u = URI.create("http://bob@localhost:8080/a/b/c?a=x&b=y#frag");
URI uri = UriBuilder.fromUri(u).uri(URI.create("https://bob@localhost:8080")).build();
- Assert.assertEquals(URI.create("https://bob@localhost:8080/a/b/c?a=x&b=y#frag"), uri);
+ Assertions.assertEquals(URI.create("https://bob@localhost:8080/a/b/c?a=x&b=y#frag"), uri);
uri = UriBuilder.fromUri(u).uri(URI.create("https://sue@localhost:8080")).build();
- Assert.assertEquals(URI.create("https://sue@localhost:8080/a/b/c?a=x&b=y#frag"), uri);
+ Assertions.assertEquals(URI.create("https://sue@localhost:8080/a/b/c?a=x&b=y#frag"), uri);
uri = UriBuilder.fromUri(u).uri(URI.create("https://sue@localhost:9090")).build();
- Assert.assertEquals(URI.create("https://sue@localhost:9090/a/b/c?a=x&b=y#frag"), uri);
+ Assertions.assertEquals(URI.create("https://sue@localhost:9090/a/b/c?a=x&b=y#frag"), uri);
uri = UriBuilder.fromUri(u).uri(URI.create("/x/y/z")).build();
- Assert.assertEquals(URI.create("http://bob@localhost:8080/x/y/z?a=x&b=y#frag"), uri);
+ Assertions.assertEquals(URI.create("http://bob@localhost:8080/x/y/z?a=x&b=y#frag"), uri);
uri = UriBuilder.fromUri(u).uri(URI.create("?x=a&b=y")).build();
- Assert.assertEquals(URI.create("http://bob@localhost:8080/a/b/c?x=a&b=y#frag"), uri);
+ Assertions.assertEquals(URI.create("http://bob@localhost:8080/a/b/c?x=a&b=y#frag"), uri);
uri = UriBuilder.fromUri(u).uri(URI.create("#ment")).build();
- Assert.assertEquals(URI.create("http://bob@localhost:8080/a/b/c?a=x&b=y#ment"), uri);
+ Assertions.assertEquals(URI.create("http://bob@localhost:8080/a/b/c?a=x&b=y#ment"), uri);
}
@Test
@@ -803,46 +803,46 @@ public void testSchemeSpecificPart() {
final URI u = URI.create("http://bob@localhost:8080/a/b/c?a=x&b=y#frag");
final URI uri = UriBuilder.fromUri(u).schemeSpecificPart("//sue@remotehost:9090/x/y/z?x=a&y=b").build();
- Assert.assertEquals(URI.create("http://sue@remotehost:9090/x/y/z?x=a&y=b#frag"), uri);
+ Assertions.assertEquals(URI.create("http://sue@remotehost:9090/x/y/z?x=a&y=b#frag"), uri);
}
@Test
public void testAppendPath() {
URI uri = UriBuilder.fromUri("http://localhost:8080").path("a/b/c").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/").path("a/b/c").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c"), uri);
uri = UriBuilder.fromUri("http://localhost:8080").path("/a/b/c").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c/").path("/").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c/").path("/x/y/z").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").path("/x/y/z").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").path("x/y/z").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").path("/").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").path("").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/a%20/b%20/c%20").path("/x /y /z ").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a%20/b%20/c%20/x%20/y%20/z%20"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a%20/b%20/c%20/x%20/y%20/z%20"), uri);
}
@Test
public void testAppendSegment() {
final URI uri = UriBuilder.fromUri("http://localhost:8080").segment("a/b/c;x").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a%2Fb%2Fc%3Bx"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a%2Fb%2Fc%3Bx"), uri);
}
@Test
@@ -889,65 +889,65 @@ public void testWhitespacesInQueryParamsByResolve() {
@Test
public void testRelativeFromUri() {
URI uri = UriBuilder.fromUri("a/b/c").build();
- Assert.assertEquals(URI.create("a/b/c"), uri);
+ Assertions.assertEquals(URI.create("a/b/c"), uri);
uri = UriBuilder.fromUri("a/b/c").path("d").build();
- Assert.assertEquals(URI.create("a/b/c/d"), uri);
+ Assertions.assertEquals(URI.create("a/b/c/d"), uri);
uri = UriBuilder.fromUri("a/b/c/").path("d").build();
- Assert.assertEquals(URI.create("a/b/c/d"), uri);
+ Assertions.assertEquals(URI.create("a/b/c/d"), uri);
uri = UriBuilder.fromUri("a/b/c").path("/d").build();
- Assert.assertEquals(URI.create("a/b/c/d"), uri);
+ Assertions.assertEquals(URI.create("a/b/c/d"), uri);
uri = UriBuilder.fromUri("a/b/c/").path("/d").build();
- Assert.assertEquals(URI.create("a/b/c/d"), uri);
+ Assertions.assertEquals(URI.create("a/b/c/d"), uri);
uri = UriBuilder.fromUri("").queryParam("x", "y").build();
- Assert.assertEquals(URI.create("?x=y"), uri);
+ Assertions.assertEquals(URI.create("?x=y"), uri);
}
@Test
public void testRelativefromPath() {
URI uri = UriBuilder.fromPath("a/b/c").build();
- Assert.assertEquals(URI.create("a/b/c"), uri);
+ Assertions.assertEquals(URI.create("a/b/c"), uri);
uri = UriBuilder.fromPath("a/b/c").path("d").build();
- Assert.assertEquals(URI.create("a/b/c/d"), uri);
+ Assertions.assertEquals(URI.create("a/b/c/d"), uri);
uri = UriBuilder.fromPath("a/b/c/").path("d").build();
- Assert.assertEquals(URI.create("a/b/c/d"), uri);
+ Assertions.assertEquals(URI.create("a/b/c/d"), uri);
uri = UriBuilder.fromPath("a/b/c").path("/d").build();
- Assert.assertEquals(URI.create("a/b/c/d"), uri);
+ Assertions.assertEquals(URI.create("a/b/c/d"), uri);
uri = UriBuilder.fromPath("a/b/c/").path("/d").build();
- Assert.assertEquals(URI.create("a/b/c/d"), uri);
+ Assertions.assertEquals(URI.create("a/b/c/d"), uri);
uri = UriBuilder.fromPath("").queryParam("x", "y").build();
- Assert.assertEquals(URI.create("?x=y"), uri);
+ Assertions.assertEquals(URI.create("?x=y"), uri);
}
@Test
public void testAppendQueryParams() throws URISyntaxException {
URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c?a=x&b=y").queryParam("c", "z").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c?a=x&b=y&c=z"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c?a=x&b=y&c=z"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c?a=x&b=y").queryParam("c= ", "z= ").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c?a=x&b=y&c%3D+=z%3D+"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c?a=x&b=y&c%3D+=z%3D+"), uri);
uri = UriBuilder.fromUri(new URI("http://localhost:8080/")).queryParam("c", "z").build();
- Assert.assertEquals(URI.create("http://localhost:8080/?c=z"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/?c=z"), uri);
uri = UriBuilder.fromUri(new URI("http://localhost:8080")).queryParam("c", "z").build();
- Assert.assertEquals(URI.create("http://localhost:8080/?c=z"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/?c=z"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/").queryParam("c", "z").build();
- Assert.assertEquals(URI.create("http://localhost:8080/?c=z"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/?c=z"), uri);
uri = UriBuilder.fromUri("http://localhost:8080").queryParam("c", "z").build();
- Assert.assertEquals(URI.create("http://localhost:8080/?c=z"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/?c=z"), uri);
try {
UriBuilder.fromPath("http://localhost:8080").queryParam("name", "x", null).build();
@@ -960,10 +960,10 @@ public void testAppendQueryParams() throws URISyntaxException {
@Test
public void testAppendMatrixParams() {
URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c;a=x;b=y").matrixParam("c", "z").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c;a=x;b=y;c=z"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c;a=x;b=y;c=z"), uri);
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c;a=x;b=y").matrixParam("c=/ ;", "z=/ ;").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c;a=x;b=y;c%3D%2F%20%3B=z%3D%2F%20%3B"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c;a=x;b=y;c%3D%2F%20%3B=z%3D%2F%20%3B"), uri);
}
@Test
@@ -971,7 +971,7 @@ public void testAppendPathAndMatrixParams() {
final URI uri = UriBuilder.fromUri("http://localhost:8080/").path(
"a").matrixParam("x", "foo").matrixParam("y", "bar").path("b").matrixParam("x", "foo").matrixParam("y", "bar")
.build();
- Assert.assertEquals(URI.create("http://localhost:8080/a;x=foo;y=bar/b;x=foo;y=bar"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a;x=foo;y=bar/b;x=foo;y=bar"), uri);
}
@Path("resource")
@@ -992,15 +992,15 @@ public Object locator() {
@Test
public void testResourceAppendPath() throws NoSuchMethodException {
URI ub = UriBuilder.fromUri("http://localhost:8080/base").path(Resource.class).build();
- Assert.assertEquals(URI.create("http://localhost:8080/base/resource"), ub);
+ Assertions.assertEquals(URI.create("http://localhost:8080/base/resource"), ub);
ub = UriBuilder.fromUri("http://localhost:8080/base").path(Resource.class, "get").build();
- Assert.assertEquals(URI.create("http://localhost:8080/base/method"), ub);
+ Assertions.assertEquals(URI.create("http://localhost:8080/base/method"), ub);
final Method get = Resource.class.getMethod("get");
final Method locator = Resource.class.getMethod("locator");
ub = UriBuilder.fromUri("http://localhost:8080/base").path(get).path(locator).build();
- Assert.assertEquals(URI.create("http://localhost:8080/base/method/locator"), ub);
+ Assertions.assertEquals(URI.create("http://localhost:8080/base/method/locator"), ub);
}
@Path("resource/{id}")
@@ -1021,15 +1021,15 @@ public Object locator() {
@Test
public void testResourceWithTemplateAppendPath() throws NoSuchMethodException {
URI ub = UriBuilder.fromUri("http://localhost:8080/base").path(ResourceWithTemplate.class).build("foo");
- Assert.assertEquals(URI.create("http://localhost:8080/base/resource/foo"), ub);
+ Assertions.assertEquals(URI.create("http://localhost:8080/base/resource/foo"), ub);
ub = UriBuilder.fromUri("http://localhost:8080/base").path(ResourceWithTemplate.class, "get").build("foo");
- Assert.assertEquals(URI.create("http://localhost:8080/base/method/foo"), ub);
+ Assertions.assertEquals(URI.create("http://localhost:8080/base/method/foo"), ub);
final Method get = ResourceWithTemplate.class.getMethod("get");
final Method locator = ResourceWithTemplate.class.getMethod("locator");
ub = UriBuilder.fromUri("http://localhost:8080/base").path(get).path(locator).build("foo", "bar");
- Assert.assertEquals(URI.create("http://localhost:8080/base/method/foo/locator/bar"), ub);
+ Assertions.assertEquals(URI.create("http://localhost:8080/base/method/foo/locator/bar"), ub);
}
@Path("resource/{id: .+}")
@@ -1050,15 +1050,15 @@ public Object locator() {
@Test
public void testResourceWithTemplateRegexAppendPath() throws NoSuchMethodException {
URI ub = UriBuilder.fromUri("http://localhost:8080/base").path(ResourceWithTemplateRegex.class).build("foo");
- Assert.assertEquals(URI.create("http://localhost:8080/base/resource/foo"), ub);
+ Assertions.assertEquals(URI.create("http://localhost:8080/base/resource/foo"), ub);
ub = UriBuilder.fromUri("http://localhost:8080/base").path(ResourceWithTemplateRegex.class, "get").build("foo");
- Assert.assertEquals(URI.create("http://localhost:8080/base/method/foo"), ub);
+ Assertions.assertEquals(URI.create("http://localhost:8080/base/method/foo"), ub);
final Method get = ResourceWithTemplateRegex.class.getMethod("get");
final Method locator = ResourceWithTemplateRegex.class.getMethod("locator");
ub = UriBuilder.fromUri("http://localhost:8080/base").path(get).path(locator).build("foo", "bar");
- Assert.assertEquals(URI.create("http://localhost:8080/base/method/foo/locator/bar"), ub);
+ Assertions.assertEquals(URI.create("http://localhost:8080/base/method/foo/locator/bar"), ub);
}
interface GenericInterface {
@@ -1081,20 +1081,20 @@ public Object find(@PathParam("id") final String s) {
public void testResourceWithGenericInterfaceAppendPath() {
final URI ub = UriBuilder.fromUri("http://localhost:8080/base").path(ResourceWithGenericInterface.class, "find")
.build("foo");
- Assert.assertEquals(URI.create("http://localhost:8080/base/foo"), ub);
+ Assertions.assertEquals(URI.create("http://localhost:8080/base/foo"), ub);
}
@Test
public void testBuildTemplates() {
URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").build("x", "y", "z");
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x"), uri);
final Map m = new HashMap();
m.put("foo", "x");
m.put("bar", "y");
m.put("baz", "z");
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").buildFromMap(m);
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x"), uri);
}
@Test
@@ -1107,20 +1107,20 @@ public void testBuildTemplatesByResolve() {
final URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").resolveTemplates(m)
.build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x"), uri);
}
@Test
public void testBuildTemplatesWithNameAuthority() {
URI uri = UriBuilder.fromUri("http://x_y.com:8080/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").build("x", "y", "z");
- Assert.assertEquals(URI.create("http://x_y.com:8080/a/b/c/x/y/z/x"), uri);
+ Assertions.assertEquals(URI.create("http://x_y.com:8080/a/b/c/x/y/z/x"), uri);
final Map m = new HashMap();
m.put("foo", "x");
m.put("bar", "y");
m.put("baz", "z");
uri = UriBuilder.fromUri("http://x_y.com:8080/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").buildFromMap(m);
- Assert.assertEquals(URI.create("http://x_y.com:8080/a/b/c/x/y/z/x"), uri);
+ Assertions.assertEquals(URI.create("http://x_y.com:8080/a/b/c/x/y/z/x"), uri);
}
@Test
@@ -1131,7 +1131,7 @@ public void testBuildTemplatesWithNameAuthorityByResolve() {
m.put("baz", "z");
final URI uri = UriBuilder.fromUri("http://x_y.com:8080/a/b/c")
.path("/{foo}/{bar}/{baz}/{foo}").buildFromMap(m);
- Assert.assertEquals(URI.create("http://x_y.com:8080/a/b/c/x/y/z/x"), uri);
+ Assertions.assertEquals(URI.create("http://x_y.com:8080/a/b/c/x/y/z/x"), uri);
}
@Test
@@ -1152,7 +1152,7 @@ public void testBuildFromMap() {
caught = true;
}
- Assert.assertTrue(caught);
+ Assertions.assertTrue(caught);
}
@Test
@@ -1173,29 +1173,29 @@ public void testBuildFromMapByResolve() {
caught = true;
}
- Assert.assertTrue(caught);
+ Assertions.assertTrue(caught);
}
@Test
public void testBuildQueryTemplates() {
URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").queryParam("a", "{b}").build("=+&%xx%20");
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%2520"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%2520"), uri);
final Map m = new HashMap();
m.put("b", "=+&%xx%20");
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").queryParam("a", "{b}").buildFromMap(m);
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%2520"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%2520"), uri);
}
@Test
public void testBuildFromEncodedQueryTemplates() {
URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").queryParam("a", "{b}").buildFromEncoded("=+&%xx%20");
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%20"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%20"), uri);
final Map m = new HashMap();
m.put("b", "=+&%xx%20");
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").queryParam("a", "{b}").buildFromEncodedMap(m);
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%20"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%20"), uri);
}
@Test
@@ -1207,19 +1207,19 @@ public void testBuildFromEncodedSlashInParamValue() {
public void testResolveTemplateFromEncodedQueryTemplates() {
URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").queryParam("a", "{b}")
.resolveTemplateFromEncoded("b", "=+&%xx%20").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%20"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%20"), uri);
final Map m = new HashMap();
m.put("b", "=+&%xx%20");
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").queryParam("a", "{b}").resolveTemplatesFromEncoded(m).build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%20"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c?a=%3D%2B%26%25xx%20"), uri);
}
@Test
public void testBuildFragmentTemplates() {
URI uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").fragment("{foo}")
.build("x", "y", "z");
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x#x"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x#x"), uri);
final Map m = new HashMap();
m.put("foo", "x");
@@ -1227,7 +1227,7 @@ public void testBuildFragmentTemplates() {
m.put("baz", "z");
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").fragment("{foo}")
.buildFromMap(m);
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x#x"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x#x"), uri);
}
@Test
@@ -1236,7 +1236,7 @@ public void testResolveTemplateFromFragmentTemplates() {
.resolveTemplate("foo", "x").resolveTemplate("bar", "y")
.resolveTemplate("baz", "z").build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x#x"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x#x"), uri);
final Map m = new HashMap();
m.put("foo", "x");
@@ -1244,34 +1244,34 @@ public void testResolveTemplateFromFragmentTemplates() {
m.put("baz", "z");
uri = UriBuilder.fromUri("http://localhost:8080/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").fragment("{foo}")
.resolveTemplates(m).build();
- Assert.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x#x"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/a/b/c/x/y/z/x#x"), uri);
}
@Test
public void testTemplatesDefaultPort() {
URI uri = UriBuilder.fromUri("http://localhost/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").build("x", "y", "z");
- Assert.assertEquals(URI.create("http://localhost/a/b/c/x/y/z/x"), uri);
+ Assertions.assertEquals(URI.create("http://localhost/a/b/c/x/y/z/x"), uri);
final Map m = new HashMap();
m.put("foo", "x");
m.put("bar", "y");
m.put("baz", "z");
uri = UriBuilder.fromUri("http://localhost/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").buildFromMap(m);
- Assert.assertEquals(URI.create("http://localhost/a/b/c/x/y/z/x"), uri);
+ Assertions.assertEquals(URI.create("http://localhost/a/b/c/x/y/z/x"), uri);
}
@Test
public void testResolveTemplatesDefaultPort() {
URI uri = UriBuilder.fromUri("http://localhost/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").resolveTemplate("foo", "x")
.resolveTemplate("bar", "y").resolveTemplate("baz" + "", "z").build();
- Assert.assertEquals(URI.create("http://localhost/a/b/c/x/y/z/x"), uri);
+ Assertions.assertEquals(URI.create("http://localhost/a/b/c/x/y/z/x"), uri);
final Map m = new HashMap();
m.put("foo", "x");
m.put("bar", "y");
m.put("baz", "z");
uri = UriBuilder.fromUri("http://localhost/a/b/c").path("/{foo}/{bar}/{baz}/{foo}").resolveTemplates(m).build();
- Assert.assertEquals(URI.create("http://localhost/a/b/c/x/y/z/x"), uri);
+ Assertions.assertEquals(URI.create("http://localhost/a/b/c/x/y/z/x"), uri);
}
@Test
@@ -1280,8 +1280,8 @@ public void testClone() {
final URI full = ub.clone().path("b").build();
final URI base = ub.build();
- Assert.assertEquals(URI.create("http://user@localhost:8080/a?query#fragment"), base);
- Assert.assertEquals(URI.create("http://user@localhost:8080/a/b?query#fragment"), full);
+ Assertions.assertEquals(URI.create("http://user@localhost:8080/a?query#fragment"), base);
+ Assertions.assertEquals(URI.create("http://user@localhost:8080/a/b?query#fragment"), full);
}
@Test
@@ -1292,7 +1292,7 @@ public void testIllegalArgumentException() {
} catch (final IllegalArgumentException e) {
caught = true;
}
- Assert.assertTrue(caught);
+ Assertions.assertTrue(caught);
caught = false;
try {
@@ -1300,7 +1300,7 @@ public void testIllegalArgumentException() {
} catch (final IllegalArgumentException e) {
caught = true;
}
- Assert.assertTrue(caught);
+ Assertions.assertTrue(caught);
caught = false;
try {
@@ -1308,7 +1308,7 @@ public void testIllegalArgumentException() {
} catch (final IllegalArgumentException e) {
caught = true;
}
- Assert.assertTrue(caught);
+ Assertions.assertTrue(caught);
}
@Test
@@ -1334,7 +1334,7 @@ public void testVariableWithoutValue() {
} catch (final IllegalArgumentException e) {
caught = true;
}
- Assert.assertTrue(caught);
+ Assertions.assertTrue(caught);
}
@Test
@@ -1345,7 +1345,7 @@ public void testPortValue() {
} catch (final IllegalArgumentException e) {
caught = true;
}
- Assert.assertTrue(caught);
+ Assertions.assertTrue(caught);
}
@Test
@@ -1353,16 +1353,16 @@ public void testPortSetting() throws URISyntaxException {
URI uri;
uri = new JerseyUriBuilder().uri("http://localhost").port(8080).build();
- Assert.assertEquals(URI.create("http://localhost:8080"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080"), uri);
uri = new JerseyUriBuilder().uri(new URI("http://localhost")).port(8080).build();
- Assert.assertEquals(URI.create("http://localhost:8080"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080"), uri);
uri = new JerseyUriBuilder().uri("http://localhost/").port(8080).build();
- Assert.assertEquals(URI.create("http://localhost:8080/"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/"), uri);
uri = new JerseyUriBuilder().uri(new URI("http://localhost/")).port(8080).build();
- Assert.assertEquals(URI.create("http://localhost:8080/"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/"), uri);
}
@Test
@@ -1373,13 +1373,13 @@ public void testHostValue() {
} catch (final IllegalArgumentException e) {
caught = true;
}
- Assert.assertTrue(caught);
+ Assertions.assertTrue(caught);
URI uri = UriBuilder.fromPath("").host("abc").build();
- Assert.assertEquals(URI.create("//abc"), uri);
+ Assertions.assertEquals(URI.create("//abc"), uri);
uri = UriBuilder.fromPath("").host("abc").host(null).build();
- Assert.assertEquals(URI.create(""), uri);
+ Assertions.assertEquals(URI.create(""), uri);
}
/**
@@ -1392,7 +1392,7 @@ public void testHostValue() {
public void testEncodeTemplateNames() {
final URI uri = URI.create(UriComponent.encodeTemplateNames(UriBuilder.fromPath("http://localhost:8080").path(
"/{a}/{b}").replaceQuery("q={c}").toTemplate()));
- Assert.assertEquals(URI.create("http://localhost:8080/%7Ba%7D/%7Bb%7D?q=%7Bc%7D"), uri);
+ Assertions.assertEquals(URI.create("http://localhost:8080/%7Ba%7D/%7Bb%7D?q=%7Bc%7D"), uri);
}
@Test
@@ -1405,7 +1405,7 @@ public void resolveTemplateTest() {
m.put("a", "ignored-a");
m.put("b", "param-b");
m.put("q", "ignored-q");
- Assert.assertEquals(URI.create("http://localhost:8080/param-a/param-b?query=param-q"), uriBuilder.buildFromMap(m));
+ Assertions.assertEquals(URI.create("http://localhost:8080/param-a/param-b?query=param-q"), uriBuilder.buildFromMap(m));
}
@Test
@@ -1419,7 +1419,7 @@ public void resolveTemplateFromEncodedTest() {
m.put("a", "ignored-a");
m.put("b", "param-b/aaa");
m.put("q", "ignored-q");
- Assert.assertEquals("http://localhost:8080/x/y/z%3F%20/param-b/aaa/paramc1%2Fparamc2?query=q%3F%20%26",
+ Assertions.assertEquals("http://localhost:8080/x/y/z%3F%20/param-b/aaa/paramc1%2Fparamc2?query=q%3F%20%26",
uriBuilder.buildFromEncodedMap(m).toString());
}
@@ -1434,7 +1434,7 @@ public void resolveTemplateWithoutEncodedTest() {
m.put("a", "ignored-a");
m.put("b", "param-b/aaa");
m.put("q", "ignored-q");
- Assert.assertEquals("http://localhost:8080/x%2Fy%2Fz%253F%2520/param-b%2Faaa/paramc1%2Fparamc2?query=q%3F%2520%2526",
+ Assertions.assertEquals("http://localhost:8080/x%2Fy%2Fz%253F%2520/param-b%2Faaa/paramc1%2Fparamc2?query=q%3F%2520%2526",
uriBuilder.buildFromMap(m).toString());
}
@@ -1445,7 +1445,7 @@ public void resolveTemplateWithEncodedSlashTest() {
uriBuilder.resolveTemplate("a", "param-a/withSlash", false);
uriBuilder.resolveTemplate("b", "param-b/withEncodedSlash", true);
uriBuilder.resolveTemplate("q", "param-q", true);
- Assert.assertEquals(URI.create("http://localhost:8080/param-a/withSlash/param-b%2FwithEncodedSlash?query=param-q"),
+ Assertions.assertEquals(URI.create("http://localhost:8080/param-a/withSlash/param-b%2FwithEncodedSlash?query=param-q"),
uriBuilder.build());
uriBuilder.build();
}
@@ -1461,7 +1461,7 @@ public void resolveTemplatesTest() {
buildMap.put("a", "ignored-a");
buildMap.put("b", "param-b");
buildMap.put("q", "ignored-q");
- Assert.assertEquals(URI.create("http://localhost:8080/param-a/param-b?query=param-q"), uriBuilder.buildFromMap(buildMap));
+ Assertions.assertEquals(URI.create("http://localhost:8080/param-a/param-b?query=param-q"), uriBuilder.buildFromMap(buildMap));
}
@Test
@@ -1476,7 +1476,7 @@ public void resolveTemplatesFromEncodedTest() {
uriBuilder.resolveTemplatesFromEncoded(resolveMap);
final Map buildMap = new HashMap();
buildMap.put("b", "param-b/aaa");
- Assert.assertEquals("http://localhost:8080/x/y/z%3F%20/param-b/aaa/paramc1/paramc2?query=q%3F%20%26",
+ Assertions.assertEquals("http://localhost:8080/x/y/z%3F%20/param-b/aaa/paramc1/paramc2?query=q%3F%20%26",
uriBuilder.buildFromEncodedMap(buildMap).toString());
}
@@ -1492,7 +1492,7 @@ public void resolveTemplatesFromNotEncodedTest() {
uriBuilder.resolveTemplates(resolveMap);
final Map buildMap = new HashMap();
buildMap.put("b", "param-b/aaa");
- Assert.assertEquals("http://localhost:8080/x%2Fy%2Fz%253F%2520/param-b%2Faaa/paramc1%2Fparamc2?query=q%3F%2520%2526",
+ Assertions.assertEquals("http://localhost:8080/x%2Fy%2Fz%253F%2520/param-b%2Faaa/paramc1%2Fparamc2?query=q%3F%2520%2526",
uriBuilder.buildFromMap(buildMap).toString());
}
@@ -1508,7 +1508,7 @@ public void resolveTemplatesEncodeSlash() {
uriBuilder.resolveTemplates(resolveMap, false);
final Map buildMap = new HashMap();
buildMap.put("b", "param-b/aaa");
- Assert.assertEquals("http://localhost:8080/x/y/z%253F%2520/param-b/aaa/paramc1/paramc2?query=q%3F%2520%2526",
+ Assertions.assertEquals("http://localhost:8080/x/y/z%253F%2520/param-b/aaa/paramc1/paramc2?query=q%3F%2520%2526",
uriBuilder.buildFromMap(buildMap, false).toString());
}
@@ -1521,7 +1521,7 @@ public void resolveTemplatesWithEncodedSlashTest() {
resolveMap.put("q", "param-q");
uriBuilder.resolveTemplates(resolveMap, false);
uriBuilder.resolveTemplate("b", "param-b/withEncodedSlash", true);
- Assert.assertEquals(URI.create("http://localhost:8080/param-a/withSlash/param-b%2FwithEncodedSlash?query=param-q"),
+ Assertions.assertEquals(URI.create("http://localhost:8080/param-a/withSlash/param-b%2FwithEncodedSlash?query=param-q"),
uriBuilder.build());
uriBuilder.build();
}
@@ -1532,7 +1532,7 @@ public void resolveTemplateMultipleCall() {
.resolveTemplate("a", "first-a").path("{a}").resolveTemplate("a", "second-a")
.path("{a}/{a}").resolveTemplate("a", "twice-a");
- Assert.assertEquals(URI.create("http://localhost:8080/start-path/first-a/second-a/twice-a/twice-a"),
+ Assertions.assertEquals(URI.create("http://localhost:8080/start-path/first-a/second-a/twice-a/twice-a"),
uriBuilder.build("start-path"));
}
@@ -1541,7 +1541,7 @@ public void replaceWithEmtpySchemeFromUriTest() throws URISyntaxException {
final String uriOrig = "ftp://ftp.is.co.za/rfc/rfc1808.txt";
final URI uriReplace = new URI(null, "ftp.is.co.za", "/test/rfc1808.txt", null, null);
final URI uri = UriBuilder.fromUri(new URI(uriOrig)).uri(uriReplace).build();
- Assert.assertEquals("ftp://ftp.is.co.za/test/rfc1808.txt", uri.toString());
+ Assertions.assertEquals("ftp://ftp.is.co.za/test/rfc1808.txt", uri.toString());
}
@Test
@@ -1550,7 +1550,7 @@ public void replaceWithEmptySchemeFromStringTest() throws URISyntaxException {
final URI uriReplace = new URI(null, "ftp.is.co.za", "/test/rfc1808.txt", null, null);
final URI uri = UriBuilder.fromUri(new URI(uriOrig)).uri(uriReplace.toASCIIString()).build();
- Assert.assertEquals("ftp://ftp.is.co.za/test/rfc1808.txt", uri.toString());
+ Assertions.assertEquals("ftp://ftp.is.co.za/test/rfc1808.txt", uri.toString());
}
@Test
@@ -1559,7 +1559,7 @@ public void replaceWithEmptyQueryFromStringTest() throws URISyntaxException {
final URI uriReplace = new URI(null, "ftp.is.co.za", "/test/rfc1808.txt", null, null);
final URI uri = UriBuilder.fromUri(new URI(uriOrig)).uri(uriReplace.toASCIIString()).build();
- Assert.assertEquals("ftp://ftp.is.co.za/test/rfc1808.txt?a=1", uri.toString());
+ Assertions.assertEquals("ftp://ftp.is.co.za/test/rfc1808.txt?a=1", uri.toString());
}
@Test
@@ -1568,7 +1568,7 @@ public void replaceWithEmptyFragmentFromStringTest() throws URISyntaxException {
final URI uriReplace = new URI(null, "ftp.is.co.za", "/test/rfc1808.txt", null, null);
final URI uri = UriBuilder.fromUri(new URI(uriOrig)).uri(uriReplace.toASCIIString()).build();
- Assert.assertEquals("ftp://ftp.is.co.za/test/rfc1808.txt#myFragment", uri.toString());
+ Assertions.assertEquals("ftp://ftp.is.co.za/test/rfc1808.txt#myFragment", uri.toString());
}
@Test
@@ -1596,35 +1596,35 @@ public void replaceOpaqueUriWithNonOpaqueFromUriTest() throws URISyntaxException
public void testQueryParamEncoded() {
final UriBuilder uriBuilder = UriBuilder.fromUri("http://localhost:8080/path");
uriBuilder.queryParam("query", "%dummy23");
- Assert.assertEquals("http://localhost:8080/path?query=%25dummy23", uriBuilder.build().toString());
+ Assertions.assertEquals("http://localhost:8080/path?query=%25dummy23", uriBuilder.build().toString());
}
@Test
public void testQueryParamEncoded2() {
final UriBuilder uriBuilder = UriBuilder.fromUri("http://localhost:8080/path");
uriBuilder.queryParam("query", "{param}");
- Assert.assertEquals("http://localhost:8080/path?query=%25dummy23", uriBuilder.build("%dummy23").toString());
+ Assertions.assertEquals("http://localhost:8080/path?query=%25dummy23", uriBuilder.build("%dummy23").toString());
}
@Test
public void testQueryParamEncoded3() {
final UriBuilder uriBuilder = UriBuilder.fromUri("http://localhost:8080/path");
uriBuilder.queryParam("query", "{param}");
- Assert.assertEquals("http://localhost:8080/path?query=%2525test", uriBuilder.build("%25test").toString());
+ Assertions.assertEquals("http://localhost:8080/path?query=%2525test", uriBuilder.build("%25test").toString());
}
@Test
public void testQueryParamEncoded4() {
final UriBuilder uriBuilder = UriBuilder.fromUri("http://localhost:8080/path");
uriBuilder.queryParam("query", "{param}");
- Assert.assertEquals("http://localhost:8080/path?query=%25test", uriBuilder.buildFromEncoded("%25test").toString());
+ Assertions.assertEquals("http://localhost:8080/path?query=%25test", uriBuilder.buildFromEncoded("%25test").toString());
}
@Test
public void testQueryParamEncoded5() {
final UriBuilder uriBuilder = UriBuilder.fromUri("http://localhost:8080/path");
uriBuilder.queryParam("query", "! # $ & ' ( ) * + , / : ; = ? @ [ ]");
- Assert.assertEquals(
+ Assertions.assertEquals(
"http://localhost:8080/path?query=%21+%23+%24+%26+%27+%28+%29+%2A+%2B+%2C+%2F+%3A+%3B+%3D+%3F+%40+%5B+%5D",
uriBuilder.build().toString());
}
@@ -1664,7 +1664,7 @@ private void checkQueryFormat(String fromUri, JerseyQueryParamStyle queryParamSt
.queryParam("key2", "val1")
.queryParam("key1", "val3")
.build();
- Assert.assertEquals(expected, uri.getQuery());
+ Assertions.assertEquals(expected, uri.getQuery());
}
}
diff --git a/tests/e2e-entity/pom.xml b/tests/e2e-entity/pom.xml
index f4560b62f3..be1e63642c 100644
--- a/tests/e2e-entity/pom.xml
+++ b/tests/e2e-entity/pom.xml
@@ -175,16 +175,16 @@
jersey-test-framework-util
test
-
- org.hamcrest
- hamcrest
+ org.junit.platform
+ junit-platform-suite
+ ${junit-platform-suite.version}
test
- xmlunit
- xmlunit
+ org.hamcrest
+ hamcrest
test
diff --git a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/AbstractTypeTester.java b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/AbstractTypeTester.java
index 2ca9ddd64e..5cf22c3091 100644
--- a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/AbstractTypeTester.java
+++ b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/AbstractTypeTester.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -44,7 +44,7 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Abstract entity type tester base class.
@@ -166,7 +166,7 @@ protected static void _verify(byte[] in, byte[] out) {
assertEquals(in.length, out.length);
for (int i = 0; i < in.length; i++) {
if (in[i] != out[i]) {
- assertEquals("Index: " + i, in[i], out[i]);
+ assertEquals(in[i], out[i], "Index: " + i);
}
}
}
diff --git a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/BeanStreamingTest.java b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/BeanStreamingTest.java
index 8882e6e249..bf4ac93784 100644
--- a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/BeanStreamingTest.java
+++ b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/BeanStreamingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -42,10 +42,10 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Test;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Paul Sandoz
diff --git a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/CharsetTest.java b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/CharsetTest.java
index f81aa04c09..ed9e64f1fc 100644
--- a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/CharsetTest.java
+++ b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/CharsetTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -46,8 +46,7 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONObject;
-import org.glassfish.jersey.client.ClientResponse;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* @author Paul Sandoz
diff --git a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/ContextResolverMediaTypeTest.java b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/ContextResolverMediaTypeTest.java
index e9250e3246..0a7de6630a 100644
--- a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/ContextResolverMediaTypeTest.java
+++ b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/ContextResolverMediaTypeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -33,22 +33,20 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.runners.Enclosed;
-import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Paul Sandoz
* @author Martin Matula
*/
-@RunWith(Enclosed.class)
public class ContextResolverMediaTypeTest {
@Produces("text/plain")
@Provider
- @Ignore("This class is not a test class & must be ignored by the Enclosed test runner.")
+ @Disabled("This class is not a test class & must be ignored by the Enclosed test runner.")
public static class TextPlainContextResolver implements ContextResolver {
public String getContext(Class> objectType) {
@@ -58,7 +56,7 @@ public String getContext(Class> objectType) {
@Produces("text/*")
@Provider
- @Ignore("This class is not a test class & must be ignored by the Enclosed test runner.")
+ @Disabled("This class is not a test class & must be ignored by the Enclosed test runner.")
public static class TextContextResolver implements ContextResolver {
public String getContext(Class> objectType) {
@@ -68,7 +66,7 @@ public String getContext(Class> objectType) {
@Produces("*/*")
@Provider
- @Ignore("This class is not a test class & must be ignored by the Enclosed test runner.")
+ @Disabled("This class is not a test class & must be ignored by the Enclosed test runner.")
public static class WildcardContextResolver implements ContextResolver {
public String getContext(Class> objectType) {
@@ -78,7 +76,7 @@ public String getContext(Class> objectType) {
@Produces({"text/plain", "text/html"})
@Provider
- @Ignore("This class is not a test class & must be ignored by the Enclosed test runner.")
+ @Disabled("This class is not a test class & must be ignored by the Enclosed test runner.")
public static class TextPlainHtmlContextResolver implements ContextResolver {
public String getContext(Class> objectType) {
@@ -89,7 +87,7 @@ public String getContext(Class> objectType) {
@Produces("text/html")
@Provider
- @Ignore("This class is not a test class & must be ignored by the Enclosed test runner.")
+ @Disabled("This class is not a test class & must be ignored by the Enclosed test runner.")
public static class TextHtmlContextResolver implements ContextResolver {
public String getContext(Class> objectType) {
@@ -99,7 +97,7 @@ public String getContext(Class> objectType) {
}
@Path("/")
- @Ignore("This class is not a test class & must be ignored by the Enclosed test runner.")
+ @Disabled("This class is not a test class & must be ignored by the Enclosed test runner.")
public static class ContextResource {
@Context
@@ -125,6 +123,7 @@ public String get(@PathParam("id") MediaType m) {
}
}
+ @Nested
public static class ProduceTest extends JerseyTest {
@Override
@@ -151,6 +150,7 @@ public void testProduce() throws IOException {
}
}
+ @Nested
public static class ProducesTest extends JerseyTest {
@Override
@@ -177,6 +177,7 @@ public void testProduces() throws IOException {
}
}
+ @Nested
public static class ProducesSeparateTest extends JerseyTest {
@Override
@@ -204,6 +205,7 @@ public void testProducesSeparate() throws IOException {
}
}
+ @Nested
public static class ProducesXXXTest extends JerseyTest {
@Override
diff --git a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyEntityTest.java b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyEntityTest.java
index dac06e6e63..9b64a7409c 100644
--- a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyEntityTest.java
+++ b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyEntityTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -48,11 +48,11 @@
import org.glassfish.jersey.message.internal.ReaderWriter;
import org.glassfish.jersey.test.TestProperties;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* JERSEY-1540.
diff --git a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestToEntityParamTest.java b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestToEntityParamTest.java
index 4b7865d14f..50b7fa963b 100644
--- a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestToEntityParamTest.java
+++ b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestToEntityParamTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -26,8 +26,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
/**
* Test for JERSEY-1579.
@@ -46,13 +46,13 @@ public static class EntityResource {
@DELETE
public void delete(Map entity) {
- Assert.assertNull(entity);
+ Assertions.assertNull(entity);
}
}
@Test
public void testEmptyRequest() {
Response response = target().request().delete(Response.class);
- Assert.assertEquals(204, response.getStatus());
+ Assertions.assertEquals(204, response.getStatus());
}
}
diff --git a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestWithJaxbTest.java b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestWithJaxbTest.java
index a7c4f0d811..5588da69ad 100644
--- a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestWithJaxbTest.java
+++ b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestWithJaxbTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -39,22 +39,20 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.runners.Enclosed;
-import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Paul Sandoz
* @author Martin Matula
*/
-@RunWith(Enclosed.class)
public class EmptyRequestWithJaxbTest {
@SuppressWarnings("UnusedParameters")
@Path("/")
- @Ignore("This class is not a test class & must be ignored by the Enclosed test runner.")
+ @Disabled("This class is not a test class & must be ignored by the Enclosed test runner.")
public static class Resource {
@POST
@@ -88,6 +86,7 @@ public void arrayType(JaxbBeanType[] b) {
}
+ @Nested
public static class EmptyRequestTest extends JerseyTest {
@Override
@@ -129,7 +128,7 @@ public void testEmptyXmlRequest() {
}
}
- @Ignore("This class is not a test class & must be ignored by the Enclosed test runner.")
+ @Disabled("This class is not a test class & must be ignored by the Enclosed test runner.")
public abstract static class CR implements ContextResolver {
private final JAXBContext context;
@@ -153,6 +152,7 @@ public JAXBContext getContext(Class> objectType) {
}
}
+ @Nested
public static class MappedJettisonCRTest extends JerseyTest {
@Override
@@ -178,6 +178,7 @@ public void testMappedJettisonCR() {
}
}
+ @Nested
public static class BadgerFishCRTest extends JerseyTest {
@Override
diff --git a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EntityTypesTest.java b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EntityTypesTest.java
index 39ed8f202e..2a28919909 100644
--- a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EntityTypesTest.java
+++ b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EntityTypesTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -73,24 +73,25 @@
import org.glassfish.jersey.jettison.JettisonFeature;
import org.glassfish.jersey.message.internal.FileProvider;
import org.glassfish.jersey.server.ResourceConfig;
-import org.glassfish.jersey.test.util.runner.ConcurrentRunner;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONObject;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* @author Paul Sandoz
* @author Martin Matula
*/
-@RunWith(ConcurrentRunner.class)
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class EntityTypesTest extends AbstractTypeTester {
@Path("InputStreamResource")
@@ -110,6 +111,7 @@ public InputStream post(final InputStream in) throws IOException {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testInputStream() {
final ByteArrayInputStream in = new ByteArrayInputStream("CONTENT".getBytes());
_test(in, InputStreamResource.class);
@@ -120,6 +122,7 @@ public static class StringResource extends AResource {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testString() {
_test("CONTENT", StringResource.class);
}
@@ -133,6 +136,7 @@ public static class ByteArrayResource extends AResource {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testByteArrayRepresentation() {
_test("CONTENT".getBytes(), ByteArrayResource.class);
}
@@ -144,6 +148,7 @@ public static class JaxbBeanResource extends AResource {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJaxbBeanRepresentation() {
_test(new JaxbBean("CONTENT"), JaxbBeanResource.class, MediaType.APPLICATION_XML_TYPE);
}
@@ -155,11 +160,13 @@ public static class JaxbBeanResourceMediaType extends AResource {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJaxbBeanRepresentationMediaType() {
_test(new JaxbBean("CONTENT"), JaxbBeanResourceMediaType.class, MediaType.valueOf("application/foo+xml"));
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJaxbBeanRepresentationError() {
final WebTarget target = target("JaxbBeanResource");
@@ -175,6 +182,7 @@ public static class JaxbBeanTextResource extends AResource {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJaxbBeanTextRepresentation() {
_test(new JaxbBean("CONTENT"), JaxbBeanTextResource.class, MediaType.TEXT_XML_TYPE);
}
@@ -186,6 +194,7 @@ public static class JAXBElementBeanResource extends AResource> getJAXBElementList() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJAXBElementListXMLRepresentation() {
_testListOrArray(true, MediaType.APPLICATION_XML_TYPE);
}
@@ -218,14 +228,15 @@ public void _testListOrArray(final boolean isList, final MediaType mt) {
.asList((JAXBElement[]) in);
final List> outList = isList ? ((List>) out) : Arrays
.asList((JAXBElement[]) out);
- assertEquals("Lengths differ", inList.size(), outList.size());
+ assertEquals(inList.size(), outList.size(), "Lengths differ");
for (int i = 0; i < inList.size(); i++) {
- assertEquals("Names of elements at index " + i + " differ", inList.get(i).getName(), outList.get(i).getName());
- assertEquals("Values of elements at index " + i + " differ", inList.get(i).getValue(), outList.get(i).getValue());
+ assertEquals(inList.get(i).getName(), outList.get(i).getName(), "Names of elements at index " + i + " differ");
+ assertEquals(inList.get(i).getValue(), outList.get(i).getValue(), "Values of elements at index " + i + " differ");
}
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJAXBElementListJSONRepresentation() {
_testListOrArray(true, MediaType.APPLICATION_JSON_TYPE);
}
@@ -244,11 +255,13 @@ private JAXBElement[] getJAXBElementArray() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJAXBElementArrayXMLRepresentation() {
_testListOrArray(false, MediaType.APPLICATION_XML_TYPE);
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJAXBElementArrayJSONRepresentation() {
_testListOrArray(false, MediaType.APPLICATION_JSON_TYPE);
}
@@ -260,11 +273,13 @@ public static class JAXBElementBeanResourceMediaType extends AResource
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJaxbBeanRepresentationMediaTypeAtom() {
_test(new JaxbBean("CONTENT"), JaxbBeanResourceAtom.class, MediaType.valueOf("application/atom+xml"));
}
@@ -318,6 +335,7 @@ protected void configureClient(final ClientConfig config) {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJAXBTypeRepresentation() {
final WebTarget target = target("JAXBTypeResource");
final JaxbBean in = new JaxbBean("CONTENT");
@@ -332,6 +350,7 @@ public static class JAXBTypeResourceMediaType extends JAXBTypeResource {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJAXBTypeRepresentationMediaType() {
final WebTarget target = target("JAXBTypeResourceMediaType");
final JaxbBean in = new JaxbBean("CONTENT");
@@ -365,6 +384,7 @@ public JAXBContext getContext(final Class> c) {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJAXBObjectRepresentation() {
final WebTarget target = target("JAXBObjectResource");
final Object in = new JaxbBean("CONTENT");
@@ -379,6 +399,7 @@ public static class JAXBObjectResourceMediaType extends JAXBObjectResource {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJAXBObjectRepresentationMediaType() {
final WebTarget target = target("JAXBObjectResourceMediaType");
final Object in = new JaxbBean("CONTENT");
@@ -387,6 +408,7 @@ public void testJAXBObjectRepresentationMediaType() {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testJAXBObjectRepresentationError() {
final WebTarget target = target("JAXBObjectResource");
@@ -400,6 +422,7 @@ public static class FileResource extends AResource {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testFileRepresentation() throws IOException {
final FileProvider fp = new FileProvider();
final File in = fp.readFrom(File.class, File.class, null, null, null,
@@ -415,6 +438,7 @@ public static class FormResource extends AResource