From 6a8461ac86a2a01d0d067ffb806123519db22799 Mon Sep 17 00:00:00 2001
From: melloware
Date: Sun, 22 Nov 2026 09:07:33 -0500
Subject: [PATCH] MYFACES-4785: Upgrade tests to JUnit 6
Migrate tests to JUnit 6 via OpenRewrite and fix the resulting breakage:
- restore cross-package visibility and renamed overrides
- fix lambdas that assigned captured locals
- restore assertEquals delta in ResourceLoaderUtilsTest
- keep Quarkus showcase on JUnit 5.13.4 (Quarkus 3.27 does not support JUnit 6)
Co-Authored-By: Claude Opus 5.5
---
extensions/quarkus/showcase/pom.xml | 4 +-
.../showcase/QuarkusMyFacesShowcaseTest.java | 13 +-
.../jakarta/faces/FacesExceptionTest.java | 30 +-
.../java/jakarta/faces/FactoryFinderTest.java | 125 +-
.../faces/application/FacesMessageTest.java | 115 +-
.../faces/application/StateManagerTest.java | 25 +-
.../faces/application/ViewHandlerTest.java | 28 +-
.../AbstractUIComponentPropertyTest.java | 18 +-
.../component/InvokeOnComponentTest.java | 35 +-
.../component/UIComponentAttributesTest.java | 4 +-
.../UIComponentBaseFacesListenerTest.java | 45 +-
.../UIComponentBaseGetChildrenTest.java | 72 +-
.../UIComponentBaseGetClientIdTest.java | 49 +-
...ponentBaseProcessSaveRestoreStateTest.java | 19 +-
.../UIComponentBaseRestoreCollectionTest.java | 79 +-
...omponentBaseRestoreEmptyFullStateTest.java | 37 +-
.../faces/component/UIComponentBaseTest.java | 104 +-
.../component/UIComponentEncodeAllTest.java | 22 +-
.../UIComponentEventListenerWrapperTest.java | 191 +--
.../UIComponentFindComponentTest.java | 57 +-
.../UIComponentInvokeOnComponentTest.java | 32 +-
.../faces/component/UIComponentTest.java | 17 +-
.../UIComponentValueExpressionTest.java | 58 +-
.../faces/component/UIDataRowStateTest.java | 35 +-
.../jakarta/faces/component/UIDataTest.java | 246 +--
.../faces/component/UIGraphicTest.java | 18 +-
.../faces/component/UIInputPSSTest.java | 29 +-
.../jakarta/faces/component/UIInputTest.java | 118 +-
.../faces/component/UIOutputPSSTest.java | 137 +-
.../faces/component/UISelectItemsTest.java | 16 +-
.../faces/component/UISelectManyTest.java | 24 +-
.../faces/component/UISelectOneTest.java | 55 +-
.../faces/component/UIViewParameterTest.java | 19 +-
.../faces/component/UIViewRootTest.java | 26 +-
.../_AttachedListStateWrapperTest.java | 15 +-
.../component/_AttachedStateWrapperTest.java | 24 +-
.../faces/component/_ComponentUtilsTest.java | 16 +-
.../component/_Delta2StateHelperTest.java | 215 +--
.../_DeltaFacesListenerListTest.java | 217 +--
.../faces/component/_DeltaListTest.java | 239 +--
.../component/_DeltaStateHelperTest.java | 91 +-
.../faces/component/_SelectItemsUtilTest.java | 45 +-
.../component/_SharedRendererUtilsTest.java | 75 +-
.../BehaviorRestoreCollectionTest.java | 13 +-
.../component/html/HtmlOutputLinkTest.java | 9 +-
.../faces/convert/DateTimeConverterTest.java | 79 +-
.../faces/convert/DoubleConverterTest.java | 29 +-
.../faces/convert/EnumConverterTest.java | 33 +-
.../faces/convert/MessageUtilsTest.java | 17 +-
.../faces/convert/NumberConverterTest.java | 99 +-
.../MethodExpressionActionListenerTest.java | 41 +-
...ethodExpressionPartialStateHolderTest.java | 52 +-
...thodExpressionValueChangeListenerTest.java | 41 +-
.../MethodExpressionValidatorTest.java | 39 +-
.../validator/ValidatorExceptionTest.java | 18 +-
.../faces/validator/_MessageUtilsTest.java | 12 +-
.../ApplicationImplAnnotationTest.java | 133 +-
.../application/ApplicationImplJsfTest.java | 13 +-
.../application/ApplicationImplTest.java | 53 +-
.../application/ClientBehaviorTestCase.java | 12 +-
.../NavigationHandlerImplTest.java | 219 +--
.../ResourceHandlerImplContractTest.java | 6 +-
.../application/ResourceHandlerImplTest.java | 111 +-
.../application/ViewHandlerImplTest.java | 59 +-
.../application/ViewIdSupportMockTest.java | 29 +-
.../application/ViewIdSupportTest.java | 47 +-
...sCreateResourceMyFacesRequestTestCase.java | 41 +-
...ContractsConfigMyFacesRequestTestCase.java | 33 +-
.../SingleContractMyFacesRequestTestCase.java | 84 +-
.../flow/FlowMyFacesCDIRequestTestCase.java | 191 +--
.../flow/FlowMyFacesRequestTestCase.java | 551 +++---
...ResourceHandlerMyFacesRequestTestCase.java | 14 +-
.../viewstate/AbstractStateUtilsTest.java | 54 +-
.../CachedStateUtilsAES_CBCTest.java | 2 +-
.../CachedStateUtilsBlowfish_ECBTest.java | 2 +-
.../CachedStateUtilsDefaultTest.java | 2 +-
.../CachedStateUtilsTripleDES_ECBTest.java | 2 +-
.../viewstate/ClientSideStateCacheTest.java | 28 +-
.../viewstate/InitVector_CBCTestCase.java | 15 +-
.../viewstate/SecretKeyCacheTest.java | 31 +-
.../viewstate/SecretKeyConfigurationTest.java | 31 +-
.../SerializedViewCollectionTestCase.java | 215 +--
.../viewstate/ServerSideStateCacheTest.java | 32 +-
.../viewstate/StateUtilsAES_CBCTest.java | 2 +-
.../viewstate/StateUtilsBlowfish_ECBTest.java | 2 +-
.../viewstate/StateUtilsDefaultTest.java | 2 +-
.../StateUtilsTripleDES_ECBTest.java | 2 +-
.../CDIGenericConverterValidatorTest.java | 15 +-
.../DynamicManagedPropertyProducerTest.java | 10 +-
.../myfaces/cdi/view/ViewScopeCDIMapTest.java | 15 +-
.../search/SearchExpressionImplTest.java | 201 ++-
.../visit/PartialVisitContextTest.java | 15 +-
...ConfigFilesXmlValidationUtilsTestCase.java | 29 +-
.../config/FacesConfigValidatorTestCase.java | 11 +-
...ConfiguratorDefaultValidatorsTestCase.java | 46 +-
.../config/LogMetaInfUtilsTestCase.java | 33 +-
.../config/OrderingFacesConfigTest.java | 58 +-
.../impl/FacesConfigUnmarshallerImplTest.java | 201 +--
.../myfaces/context/ContextRegexpTest.java | 31 +-
.../context/ExecutePhaseClientIdsTest.java | 38 +-
.../myfaces/context/IsRenderedTest.java | 12 +-
.../PartialResponseWriterImplTest.java | 113 +-
.../context/RenderPhaseClientIdsTest.java | 40 +-
.../context/ResponseWrapperSwitchTest.java | 31 +-
.../myfaces/context/TestIsAjaxRequest.java | 10 +-
.../myfaces/context/flash/FlashImplTest.java | 201 +--
.../servlet/FacesContextImplBaseTest.java | 13 +-
.../ServletExternalContextImplTest.java | 35 +-
.../ParametrizableFacesMessageTest.java | 24 +-
.../myfaces/el/ResolverBuilderBaseTest.java | 15 +-
.../event/GlobalPostAddToViewEventTest.java | 28 +-
.../myfaces/event/PostAddToViewEventTest.java | 59 +-
.../apache/myfaces/flow/FlowBuilderTest.java | 127 +-
.../myfaces/lifecycle/RedirectTest.java | 10 +-
.../lifecycle/RenderResponseExecutorTest.java | 21 +-
.../lifecycle/RestoreViewExecutorTest.java | 7 +-
.../apache/myfaces/push/JsonEncodingTest.java | 4 +-
.../renderkit/ContentTypeUtilsTest.java | 36 +-
.../renderkit/ErrorPageWriterTest.java | 10 +-
.../renderkit/HtmlRenderKitImplTest.java | 73 +-
.../renderkit/JavascriptUtilsTest.java | 12 +-
.../myfaces/renderkit/RendererUtilsTest.java | 43 +-
.../html/ClientBehaviorRendererUtilsTest.java | 35 +-
.../renderkit/html/HtmlBodyRendererTest.java | 17 +-
.../html/HtmlButtonRendererTest.java | 43 +-
.../html/HtmlCheckboxRendererTest.java | 51 +-
.../html/HtmlDoctypeRendererTest.java | 14 +-
.../html/HtmlEscapeRendererTest.java | 35 +-
.../renderkit/html/HtmlFormRendererTest.java | 36 +-
.../html/HtmlFormatRendererTest.java | 22 +-
.../renderkit/html/HtmlGridRendererTest.java | 35 +-
.../renderkit/html/HtmlGroupRendererTest.java | 28 +-
.../renderkit/html/HtmlHeadRendererTest.java | 11 +-
.../renderkit/html/HtmlImageRendererTest.java | 35 +-
.../renderkit/html/HtmlLabelRendererTest.java | 34 +-
.../renderkit/html/HtmlLinkRendererTest.java | 145 +-
.../html/HtmlListboxRendererTest.java | 49 +-
.../renderkit/html/HtmlMenuRendererTest.java | 49 +-
.../html/HtmlMessageRendererTest.java | 17 +-
.../html/HtmlMessagesRendererTest.java | 57 +-
.../HtmlOutcomeTargetButtonRendererTest.java | 90 +-
.../renderkit/html/HtmlRadioRendererTest.java | 28 +-
.../html/HtmlResponseStateManagerTest.java | 16 +-
.../html/HtmlResponseWriterImplTest.java | 172 +-
.../html/HtmlRolePassedThroughTestCase.java | 40 +-
.../html/HtmlSecretRendererTest.java | 29 +-
.../renderkit/html/HtmlTableRendererTest.java | 77 +-
.../renderkit/html/HtmlTextRendererTest.java | 87 +-
.../html/HtmlTextareaRendererTest.java | 35 +-
.../AbstractClientBehaviorTestCase.java | 64 +-
...lHtmlEventsClientBehaviorRendererTest.java | 123 +-
.../behavior/AjaxBehaviorRenderTestCase.java | 61 +-
.../HtmlBodyClientBehaviorRendererTest.java | 74 +-
...mmandButtonClientBehaviorRendererTest.java | 2 +-
...CommandLinkClientBehaviorRendererTest.java | 2 +-
...mlDataTableClientBehaviorRendererTest.java | 2 +-
.../HtmlFormClientBehaviorRendererTest.java | 2 +-
...raphicImageClientBehaviorRendererTest.java | 2 +-
...argetButtonClientBehaviorRendererTest.java | 2 +-
...eTargetLinkClientBehaviorRendererTest.java | 2 +-
...OutputLabelClientBehaviorRendererTest.java | 2 +-
...lOutputLinkClientBehaviorRendererTest.java | 2 +-
...mlPanelGridClientBehaviorRendererTest.java | 2 +-
.../HtmlSecretClientBehaviorRendererTest.java | 2 +-
...eanCheckboxClientBehaviorRendererTest.java | 2 +-
...anyCheckboxClientBehaviorRendererTest.java | 20 +-
...ManyListboxClientBehaviorRendererTest.java | 2 +-
...ectManyMenuClientBehaviorRendererTest.java | 2 +-
...tOneListboxClientBehaviorRendererTest.java | 2 +-
...lectOneMenuClientBehaviorRendererTest.java | 2 +-
...ectOneRadioClientBehaviorRendererTest.java | 20 +-
.../HtmlTextClientBehaviorRendererTest.java | 2 +-
...tmlTextareaClientBehaviorRendererTest.java | 2 +-
.../html/util/AjaxScriptBuilderTest.java | 14 +-
.../renderkit/html/util/HTMLEncoderTest.java | 357 ++--
.../html/util/HTMLEncoderWriterTest.java | 176 +-
.../html/util/JavascriptUtilsTest.java | 41 +-
.../html/util/UnicodeEncoderTest.java | 27 +-
.../myfaces/renderkits/OwnRenderkitTest.java | 7 +-
.../resource/ResourceLoaderUtilsTest.java | 27 +-
.../resource/ResourceValidationUtilsTest.java | 121 +-
.../spi/FactoryFinderProviderTest.java | 13 +-
.../test/core/mock/MockMyFacesClient.java | 5 +-
.../mock/MockRenderedValueExpression.java | 6 +-
.../apache/myfaces/util/CommentUtilsTest.java | 58 +-
.../apache/myfaces/util/MessageUtilsTest.java | 61 +-
.../util/lang/AbstractAttributeMapTest.java | 18 +-
.../util/lang/ConcurrentLRUCacheTest.java | 157 +-
.../util/lang/LRULinkedHashMapTest.java | 274 +--
.../myfaces/util/lang/XorShiftRandomTest.java | 13 +-
.../myfaces/view/facelets/BrokenTestCase.java | 4 +-
.../view/facelets/EncodingTestCase.java | 6 +-
.../view/facelets/ExceptionTestCase.java | 130 +-
.../FaceletViewDeclarationLanguageTest.java | 17 +-
.../facelets/ImportConstantsMetadataTest.java | 9 +-
.../view/facelets/ImportConstantsTest.java | 10 +-
.../view/facelets/InstructionsTestCase.java | 4 +-
.../PartialStateManagementStrategyTest.java | 150 +-
...tateManagerWithFaceletsClientSideTest.java | 8 +-
.../StateManagerWithFaceletsTest.java | 13 +-
.../myfaces/view/facelets/TagTestCase.java | 8 +-
.../view/facelets/TemplateClientTestCase.java | 10 +-
.../TemplateInResourcesDirTestCase.java | 13 +-
.../CompressSpacesTextUnitTestCase.java | 67 +-
.../DynamicComponentFaceletTestCase.java | 6 +-
.../facelets/compiler/ELParserTestCase.java | 6 +-
.../HTML5FaceletsProcessingTestCase.java | 22 +-
.../compiler/SkipNamespaceUnitTest.java | 9 +-
.../facelets/compiler/TagLibraryTestCase.java | 11 +-
.../compiler/UniqueComponentIdTestCase.java | 243 +--
.../facelets/compiler/WhitespaceTestCase.java | 20 +-
.../XHTMLFaceletsProcessingTestCase.java | 26 +-
.../XMLFaceletsProcessingTestCase.java | 23 +-
.../compiler/doctype/DoctypeTestCase.java | 52 +-
.../UIRepeatResetSaveStateModeTest.java | 18 +-
.../view/facelets/component/UIRepeatTest.java | 70 +-
.../rowstate/RowStatePreservedNestedTest.java | 13 +-
.../rowstate/RowStatePreservedNewRowTest.java | 23 +-
.../RowStatePreservedUpdateModelTest.java | 14 +-
.../rowstate/RowStateRerenderTest.java | 19 +-
.../RowStateSharedSavedStateTest.java | 18 +-
...eELExpressionsAlwaysRecompileTestCase.java | 39 +-
.../el/CacheELExpressionsTestCase.java | 29 +-
.../el/CompositeComponentELUtilsTestCase.java | 28 +-
.../myfaces/view/facelets/el/ELTextTest.java | 43 +-
.../el/SerializableELExpressionsTestCase.java | 29 +-
...faultFaceletFactoryPathValidationTest.java | 31 +-
.../impl/DefaultFaceletFactoryTest.java | 33 +-
.../facelets/impl/ProgrammaticViewTest.java | 18 +-
.../facelets/impl/ResourceMarkDeleteTest.java | 24 +-
.../impl/SectionUniqueIdCounterTest.java | 196 +--
.../pool/ViewPoolFaceletsTestCase.java | 24 +-
.../pool/ViewPoolMyFacesRequestTestCase.java | 551 +++---
.../pss/acid/AcidMyFacesRequestTestCase.java | 1481 +++++++++--------
.../DynamicChildInPostAddToViewTestCase.java | 26 +-
.../facelets/stateless/StatelessTest.java | 17 +-
...yfaces4585FaceletsIntegrationTestCase.java | 11 +-
...yfaces4589FaceletsIntegrationTestCase.java | 13 +-
.../facelets/tag/TagAttributesImplTest.java | 35 +-
...positeComponentActionListenerTestCase.java | 267 +--
.../CompositeComponentAttributeTestCase.java | 198 +--
.../CompositeComponentBeanValidationTest.java | 16 +-
.../CompositeComponentCCRefTestCase.java | 24 +-
...CompositeComponentCConIncludeTestCase.java | 25 +-
...positeComponentClientBehaviorTestCase.java | 127 +-
...iteComponentConditionalButtonTestCase.java | 30 +-
...siteComponentMethodExpressionTestCase.java | 306 ++--
.../CompositeComponentNestedCCTestCase.java | 216 +--
.../composite/CompositeComponentTestCase.java | 359 ++--
.../CompositeComponentValidatorTestCase.java | 153 +-
...eComponentValueChangeListenerTestCase.java | 267 +--
.../OverwriteRequiredCompositeTest.java | 23 +-
.../SerializableAttributesTestCase.java | 21 +-
.../LocalizedCompositeComponentTestCase.java | 22 +-
.../tag/faces/core/AjaxListenerTestCase.java | 33 +-
.../facelets/tag/faces/core/CoreTestCase.java | 181 +-
.../tag/faces/core/ValidateBeanTestCase.java | 121 +-
.../tag/faces/core/ViewMetadataTestCase.java | 11 +-
.../faces/core/reset/ResetValuesTestCase.java | 131 +-
.../BeanValidationCDIRequestTestCase.java | 22 +-
.../html/AdditionalHtmlEventsTestCase.java | 25 +-
.../tag/faces/html/DataTableTestCase.java | 4 +-
.../tag/faces/html/DataTableTestCaseUrn.java | 4 +-
.../html/DefaultHtmlDecoratorTestCase.java | 299 ++--
.../html/DefaultHtmlDecoratorTestCaseUrn.java | 299 ++--
.../faces/html/HtmlOutputLabelTestCase.java | 13 +-
.../faces/html/HtmlOutputScriptTestCase.java | 27 +-
.../facelets/tag/faces/html/HtmlTestCase.java | 33 +-
.../facelets/tag/faces/html/MockNbsp.java | 6 +-
.../faces/html/SelectOneItemGroupTest.java | 15 +-
.../tag/faces/html/SelectOneItemsTest.java | 15 +-
.../tag/faces/html/SelectTestCase.java | 4 +-
.../tag/faces/html/Spec2242TestCase.java | 95 +-
.../facelets/tag/jstl/core/CifTestCase.java | 60 +-
.../facelets/tag/jstl/core/CsetTestCase.java | 50 +-
.../tag/jstl/core/JstlCoreTestCase.java | 111 +-
.../tag/ui/DefineIncludeTestCase.java | 12 +-
.../tag/ui/ELExprTemplateTestCase.java | 4 +-
.../tag/ui/IncludeHandler4577TestCase.java | 12 +-
.../facelets/tag/ui/IncludeParamTestCase.java | 88 +-
.../view/facelets/tag/ui/RemoveTestCase.java | 20 +-
.../view/facelets/tag/ui/RepeatTestCase.java | 361 ++--
.../facelets/tag/ui/TemplateTestCase.java | 33 +-
.../view/facelets/tag/ui/TestUserTags.java | 28 +-
.../view/facelets/tag/ui/UITestCase.java | 27 +-
.../tag/ui/template/CompositionTestCase.java | 74 +-
.../tag/ui/template/DecorateTestCase.java | 80 +-
.../tag/ui/template/IncludeTestCase.java | 11 +-
.../tag/ui/template/UserTagTestCase.java | 64 +-
...onentAnnotationMyFacesRequestTestCase.java | 45 +-
.../UpdateHeadDynamicViewTestCase.java | 30 +-
.../view/facelets/util/ClasspathTest.java | 24 +-
.../view/facelets/util/FastWriterTest.java | 22 +-
...ViewScopeClientSideStateLimitTestCase.java | 11 +-
.../ViewScopeFormlessLeakTestCase.java | 11 +-
parent/pom.xml | 4 +-
.../junit/AbstractViewControllerTestCase.java | 9 +-
297 files changed, 9132 insertions(+), 9147 deletions(-)
diff --git a/extensions/quarkus/showcase/pom.xml b/extensions/quarkus/showcase/pom.xml
index 30df4ae7ac..c1b38c2648 100644
--- a/extensions/quarkus/showcase/pom.xml
+++ b/extensions/quarkus/showcase/pom.xml
@@ -30,8 +30,8 @@
Apache MyFaces Core 5.0 - Extensions - Quarkus - Showcase
- 3.2.5
- 3.2.5
+ 3.6.1
+ 3.6.1
UTF-8
17
diff --git a/extensions/quarkus/showcase/src/test/java/org/apache/myfaces/core/extensions/quarkus/showcase/QuarkusMyFacesShowcaseTest.java b/extensions/quarkus/showcase/src/test/java/org/apache/myfaces/core/extensions/quarkus/showcase/QuarkusMyFacesShowcaseTest.java
index 86b871165f..d53a5b7bde 100644
--- a/extensions/quarkus/showcase/src/test/java/org/apache/myfaces/core/extensions/quarkus/showcase/QuarkusMyFacesShowcaseTest.java
+++ b/extensions/quarkus/showcase/src/test/java/org/apache/myfaces/core/extensions/quarkus/showcase/QuarkusMyFacesShowcaseTest.java
@@ -34,7 +34,6 @@
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import java.io.IOException;
import java.net.URL;
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
@@ -49,7 +48,7 @@ public class QuarkusMyFacesShowcaseTest
private static WebClient webClient;
@BeforeAll
- public static void initWebClient()
+ static void initWebClient()
{
webClient = new WebClient(BrowserVersion.CHROME);
webClient.getOptions().setJavaScriptEnabled(true);
@@ -61,7 +60,7 @@ public static void initWebClient()
}
@AfterAll
- public static void closeWebClient()
+ static void closeWebClient()
{
if (webClient != null)
{
@@ -71,7 +70,7 @@ public static void closeWebClient()
@Test
- public void shouldOpenIndexPage() throws Exception
+ void shouldOpenIndexPage() throws Exception
{
final HtmlPage page = webClient.getPage(url + "/index.xhtml");
final HtmlDivision datatable = (HtmlDivision) page.getElementById("form:carTable");
@@ -81,7 +80,7 @@ public void shouldOpenIndexPage() throws Exception
}
@Test
- public void shouldObserveEvents() throws Exception
+ void shouldObserveEvents() throws Exception
{
final HtmlPage page = webClient.getPage(url + "/index.xhtml");
final HtmlInput called = (HtmlInput) page.getElementById("called");
@@ -92,7 +91,7 @@ public void shouldObserveEvents() throws Exception
}
@Test
- public void shouldMapExtensionlessSubFolderView() throws Exception
+ void shouldMapExtensionlessSubFolderView() throws Exception
{
// MYFACES-4729: AUTOMATIC_EXTENSIONLESS_MAPPING must also register views in sub-folders
final HtmlPage page = webClient.getPage(url + "/test/subFolder/bar");
@@ -109,7 +108,7 @@ public void shouldMapExtensionlessSubFolderView() throws Exception
@Test
@Disabled("Check HtmlUnit websocket support, for now this test is not working")
- public void shouldCallWebSocket() throws IOException
+ void shouldCallWebSocket() throws Exception
{
HtmlPage page = webClient.getPage(url + "/socket.xhtml");
final HtmlSubmitInput sendMessageBtn = (HtmlSubmitInput) page.getElementById("form:sendMessage");
diff --git a/impl/src/test/java/jakarta/faces/FacesExceptionTest.java b/impl/src/test/java/jakarta/faces/FacesExceptionTest.java
index fce2e6c3bd..620bfe0ad9 100644
--- a/impl/src/test/java/jakarta/faces/FacesExceptionTest.java
+++ b/impl/src/test/java/jakarta/faces/FacesExceptionTest.java
@@ -19,8 +19,10 @@
package jakarta.faces;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -32,12 +34,12 @@ public FacesExceptionTest()
}
@BeforeEach
- public void setUp() throws Exception
+ void setUp() throws Exception
{
}
@AfterEach
- public void tearDown() throws Exception
+ void tearDown() throws Exception
{
}
@@ -45,53 +47,53 @@ public void tearDown() throws Exception
* Test method for 'jakarta.faces.FacesException.FacesException()'
*/
@Test
- public void testFacesException()
+ void facesException()
{
FacesException e = new FacesException();
- Assertions.assertNull(e.getCause());
- Assertions.assertNull(e.getMessage());
+ assertNull(e.getCause());
+ assertNull(e.getMessage());
}
/*
* Test method for 'jakarta.faces.FacesException.FacesException(Throwable)'
*/
@Test
- public void testFacesExceptionThrowable()
+ void facesExceptionThrowable()
{
Throwable t = new Throwable();
FacesException fe = new FacesException(t);
- Assertions.assertEquals(t, fe.getCause());
+ assertEquals(t, fe.getCause());
}
/*
* Test method for 'jakarta.faces.FacesException.FacesException(String)'
*/
@Test
- public void testFacesExceptionString()
+ void facesExceptionString()
{
String m = "Message";
FacesException e = new FacesException(m);
- Assertions.assertEquals(e.getMessage(), m);
+ assertEquals(e.getMessage(), m);
}
/*
* Test method for 'jakarta.faces.FacesException.FacesException(String, Throwable)'
*/
@Test
- public void testFacesExceptionStringThrowable()
+ void facesExceptionStringThrowable()
{
String m = "Message";
Throwable t = new Throwable();
FacesException fe = new FacesException(m, t);
- Assertions.assertEquals(t, fe.getCause());
- Assertions.assertEquals(fe.getMessage(), m);
+ assertEquals(t, fe.getCause());
+ assertEquals(fe.getMessage(), m);
}
/*
* Test method for 'jakarta.faces.FacesException.getCause()'
*/
@Test
- public void testGetCause()
+ void getCause()
{
}
diff --git a/impl/src/test/java/jakarta/faces/FactoryFinderTest.java b/impl/src/test/java/jakarta/faces/FactoryFinderTest.java
index dcfbe69558..f7489f2c97 100644
--- a/impl/src/test/java/jakarta/faces/FactoryFinderTest.java
+++ b/impl/src/test/java/jakarta/faces/FactoryFinderTest.java
@@ -19,6 +19,8 @@
package jakarta.faces;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
@@ -37,7 +39,7 @@ public FactoryFinderTest()
}
@BeforeEach
- public void setUp() throws Exception
+ void setUp() throws Exception
{
// this needs to be called *before* the first Test test is run,
// as there may be left over FactoryFinder configurations from
@@ -46,7 +48,7 @@ public void setUp() throws Exception
}
@AfterEach
- public void tearDown() throws Exception
+ void tearDown() throws Exception
{
// call this again so there is no possibility of messing up tests that will
// run after this one
@@ -103,53 +105,43 @@ private Map>> getRegisteredFactoryNames()
* Test method for 'jakarta.faces.FactoryFinder.getFactory(String)'
*/
@Test
- public void testGetFactory() throws Exception
+ void getFactory() throws Exception
{
// no catch because if this fails the test fails, i.e. not trying to test
// setFactory here
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, MockApplicationFactory.class.getName());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
Object factory = FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
- Assertions.assertNotNull(factory);
- Assertions.assertTrue(factory.getClass().equals(MockApplicationFactory.class));
- }
- catch (IllegalStateException e)
- {
- Assertions.fail("Should not throw an illegal state exception");
- }
+ assertNotNull(factory);
+ assertEquals(MockApplicationFactory.class, factory.getClass());
+ }, "Should not throw an illegal state exception");
}
/*
* Test method for 'jakarta.faces.FactoryFinder.getFactory(String)'
*/
@Test
- public void testGetFactoryTwice() throws Exception
+ void getFactoryTwice() throws Exception
{
// this test just makes sure that things work when the get has been called
// more than once
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, MockApplicationFactory.class.getName());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
Object factory1 = FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
- Assertions.assertNotNull(factory1);
- Assertions.assertTrue(factory1.getClass().equals(MockApplicationFactory.class));
+ assertNotNull(factory1);
+ assertEquals(MockApplicationFactory.class, factory1.getClass());
Object factory2 = FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
- Assertions.assertNotNull(factory2);
- Assertions.assertTrue(factory2.getClass().equals(MockApplicationFactory.class));
- Assertions.assertEquals(factory1, factory2);
- }
- catch (IllegalStateException e)
- {
- Assertions.fail("Should not throw an illegal state exception");
- }
+ assertNotNull(factory2);
+ assertEquals(MockApplicationFactory.class, factory2.getClass());
+ assertEquals(factory1, factory2);
+ }, "Should not throw an illegal state exception");
}
/*
* Test method for 'jakarta.faces.FactoryFinder.getFactory(String)'
*/
@Test
- public void testGetFactoryNoFactory() throws Exception
+ void getFactoryNoFactory() throws Exception
{
// no catch because if this fails the test fails, i.e. not trying to test
// setFactory here
@@ -157,11 +149,11 @@ public void testGetFactoryNoFactory() throws Exception
try
{
FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
- Assertions.fail("Should have thrown an illegal state exception");
+ fail("Should have thrown an illegal state exception");
}
catch (IllegalArgumentException e)
{
- Assertions.assertNotNull(e.getMessage());
+ assertNotNull(e.getMessage());
}
}
@@ -170,17 +162,17 @@ public void testGetFactoryNoFactory() throws Exception
* 'jakarta.faces.FactoryFinder.getFactory(String)'
*/
@Test
- public void testGetFactoryNoConfiguration() throws Exception
+ void getFactoryNoConfiguration() throws Exception
{
try
{
FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
- Assertions.fail("Should have thrown an illegal state exception");
+ fail("Should have thrown an illegal state exception");
}
catch (IllegalStateException e)
{
- Assertions.assertNotNull(e.getMessage());
- Assertions.assertTrue(e.getMessage().startsWith("No Factories configured for this Application"));
+ assertNotNull(e.getMessage());
+ assertTrue(e.getMessage().startsWith("No Factories configured for this Application"));
}
}
@@ -188,16 +180,16 @@ public void testGetFactoryNoConfiguration() throws Exception
* Bogus factory name test Test method for 'jakarta.faces.FactoryFinder.setFactory(String, String)'
*/
@Test
- public void testSetFactoryBogusName()
+ void setFactoryBogusName()
{
try
{
FactoryFinder.setFactory("BogusFactoryName", MockApplicationFactory.class.getName());
- Assertions.fail("Should have thrown an illegal argument exception");
+ fail("Should have thrown an illegal argument exception");
}
catch (IllegalArgumentException e)
{
- Assertions.assertNotNull(e.getMessage());
+ assertNotNull(e.getMessage());
}
}
@@ -205,18 +197,13 @@ public void testSetFactoryBogusName()
* Test method for 'jakarta.faces.FactoryFinder.setFactory(String, String)'
*/
@Test
- public void testSetFactory() throws Exception
+ void setFactory() throws Exception
{
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, MockApplicationFactory.class.getName());
- Assertions.assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
- MockApplicationFactory.class.getName()));
- }
- catch (IllegalArgumentException e)
- {
- Assertions.fail("Should not throw an illegal argument exception");
- }
+ assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
+ MockApplicationFactory.class.getName()));
+ }, "Should not throw an illegal argument exception");
}
/*
@@ -224,29 +211,24 @@ public void testSetFactory() throws Exception
* checks to see if that is true. Test method for 'jakarta.faces.FactoryFinder.setFactory(String, String)'
*/
@Test
- public void testSetFactoryNoEffect() throws Exception
+ void setFactoryNoEffect() throws Exception
{
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, MockApplicationFactory.class.getName());
- Assertions.assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
- MockApplicationFactory.class.getName()));
- Assertions.assertFalse(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
+ assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
+ MockApplicationFactory.class.getName()));
+ assertFalse(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
MockApplicationFactory2.class.getName()));
// getFactory should cause setFactory to stop changing the
// registered classes
FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
// this should essentially be a no-op
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, MockApplicationFactory2.class.getName());
- Assertions.assertFalse(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
+ assertFalse(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
MockApplicationFactory2.class.getName()));
- Assertions.assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
- MockApplicationFactory.class.getName()));
- }
- catch (IllegalArgumentException e)
- {
- Assertions.fail("Should not throw an illegal argument exception");
- }
+ assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
+ MockApplicationFactory.class.getName()));
+ }, "Should not throw an illegal argument exception");
}
/*
@@ -254,32 +236,27 @@ public void testSetFactoryNoEffect() throws Exception
* 'jakarta.faces.FactoryFinder.setFactory(String, String)'
*/
@Test
- public void testSetFactoryAdditiveClassNames() throws Exception
+ void setFactoryAdditiveClassNames() throws Exception
{
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, MockApplicationFactory.class.getName());
- Assertions.assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
- MockApplicationFactory.class.getName()));
- Assertions.assertFalse(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
+ assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
+ MockApplicationFactory.class.getName()));
+ assertFalse(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
MockApplicationFactory2.class.getName()));
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, MockApplicationFactory2.class.getName());
- Assertions.assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
+ assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
MockApplicationFactory2.class.getName()));
- Assertions.assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
- MockApplicationFactory.class.getName()));
- }
- catch (IllegalArgumentException e)
- {
- Assertions.fail("Should not throw an illegal argument exception");
- }
+ assertTrue(registeredFactoryNames(FactoryFinder.APPLICATION_FACTORY).contains(
+ MockApplicationFactory.class.getName()));
+ }, "Should not throw an illegal argument exception");
}
/*
* Test method for 'jakarta.faces.FactoryFinder.releaseFactories()'
*/
@Test
- public void testReleaseFactories()
+ void releaseFactories()
{
}
diff --git a/impl/src/test/java/jakarta/faces/application/FacesMessageTest.java b/impl/src/test/java/jakarta/faces/application/FacesMessageTest.java
index 931e5aeaab..c2b404fde4 100644
--- a/impl/src/test/java/jakarta/faces/application/FacesMessageTest.java
+++ b/impl/src/test/java/jakarta/faces/application/FacesMessageTest.java
@@ -20,82 +20,85 @@
package jakarta.faces.application;
import jakarta.faces.application.FacesMessage.Severity;
+
import java.io.ByteArrayInputStream;
+
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Map;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class FacesMessageTest
+class FacesMessageTest
{
/*
* Test method for 'jakarta.faces.application.FacesMessage.FacesMessage()'
*/
@Test
- public void testFacesMessage()
+ void facesMessage()
{
FacesMessage msg = new FacesMessage();
- Assertions.assertEquals(msg.getSeverity(), Severity.INFO);
- Assertions.assertNull(msg.getSummary());
- Assertions.assertNull(msg.getDetail());
+ assertEquals(Severity.INFO, msg.getSeverity());
+ assertNull(msg.getSummary());
+ assertNull(msg.getDetail());
}
/*
* Test method for 'jakarta.faces.application.FacesMessage.FacesMessage(String)'
*/
@Test
- public void testFacesMessageString()
+ void facesMessageString()
{
String summary = "summary";
FacesMessage msg = new FacesMessage(summary);
- Assertions.assertEquals(msg.getSeverity(), Severity.INFO);
- Assertions.assertEquals(msg.getSummary(), summary);
- Assertions.assertEquals(msg.getDetail(), summary);
+ assertEquals(Severity.INFO, msg.getSeverity());
+ assertEquals(msg.getSummary(), summary);
+ assertEquals(msg.getDetail(), summary);
}
/*
* Test method for 'jakarta.faces.application.FacesMessage.FacesMessage(String, String)'
*/
@Test
- public void testFacesMessageStringString()
+ void facesMessageStringString()
{
String summary = "summary";
String detail = "detail";
FacesMessage msg = new FacesMessage(summary, detail);
- Assertions.assertEquals(msg.getSeverity(), Severity.INFO);
- Assertions.assertEquals(msg.getSummary(), summary);
- Assertions.assertEquals(msg.getDetail(), detail);
+ assertEquals(Severity.INFO, msg.getSeverity());
+ assertEquals(msg.getSummary(), summary);
+ assertEquals(msg.getDetail(), detail);
}
/*
* Test method for 'jakarta.faces.application.FacesMessage.FacesMessage(Severity, String, String)'
*/
@Test
- public void testFacesMessageSeverityStringString()
+ void facesMessageSeverityStringString()
{
String summary = "summary";
String detail = "detail";
FacesMessage msg = new FacesMessage(Severity.ERROR, summary, detail);
- Assertions.assertEquals(msg.getSeverity(), Severity.ERROR);
- Assertions.assertEquals(msg.getSummary(), summary);
- Assertions.assertEquals(msg.getDetail(), detail);
+ assertEquals(Severity.ERROR, msg.getSeverity());
+ assertEquals(msg.getSummary(), summary);
+ assertEquals(msg.getDetail(), detail);
}
/*
* Test method for 'jakarta.faces.application.FacesMessage.FacesMessage(Severity, String, String)'
*/
@Test
- public void testFacesMessageNullSeverityStringString()
+ void facesMessageNullSeverityStringString()
{
String summary = "summary";
String detail = "detail";
try
{
new FacesMessage(null, summary, detail);
- Assertions.fail("Should have thrown an exception");
+ fail("Should have thrown an exception");
}
catch (NullPointerException e)
{
@@ -106,25 +109,25 @@ public void testFacesMessageNullSeverityStringString()
* Test method for 'jakarta.faces.application.FacesMessage.setSeverity(Severity)'
*/
@Test
- public void testSetSeverity()
+ void setSeverity()
{
FacesMessage msg = new FacesMessage();
- Assertions.assertEquals(msg.getSeverity(), Severity.INFO);
+ assertEquals(Severity.INFO, msg.getSeverity());
msg.setSeverity(Severity.FATAL);
- Assertions.assertEquals(msg.getSeverity(), Severity.FATAL);
+ assertEquals(Severity.FATAL, msg.getSeverity());
}
/*
* Test method for 'jakarta.faces.application.FacesMessage.setSeverity(Severity)'
*/
@Test
- public void testSetNullSeverity()
+ void setNullSeverity()
{
FacesMessage msg = new FacesMessage();
try
{
msg.setSeverity(null);
- Assertions.fail("Should have thrown an exception");
+ fail("Should have thrown an exception");
}
catch (NullPointerException e)
{
@@ -135,86 +138,86 @@ public void testSetNullSeverity()
* Test method for 'jakarta.faces.application.FacesMessage.setSummary(String)'
*/
@Test
- public void testSetSummary()
+ void setSummary()
{
FacesMessage msg = new FacesMessage();
String summary = "summary";
msg.setSummary(summary);
- Assertions.assertEquals(msg.getSummary(), summary);
- Assertions.assertEquals(msg.getDetail(), summary);
+ assertEquals(msg.getSummary(), summary);
+ assertEquals(msg.getDetail(), summary);
}
/*
* Test method for 'jakarta.faces.application.FacesMessage.setDetail(String)'
*/
@Test
- public void testSetDetail()
+ void setDetail()
{
FacesMessage msg = new FacesMessage();
String detail = "detail";
msg.setDetail(detail);
- Assertions.assertEquals(msg.getSummary(), null);
- Assertions.assertEquals(msg.getDetail(), detail);
+ assertNull(msg.getSummary());
+ assertEquals(msg.getDetail(), detail);
}
@Test
- public void testSeverityOrdering()
+ void severityOrdering()
{
// make sure they are ordered correctly from least to worst
- Assertions.assertTrue(0 > Severity.INFO.compareTo(Severity.WARN));
- Assertions.assertTrue(0 > Severity.WARN.compareTo(Severity.ERROR));
- Assertions.assertTrue(0 > Severity.ERROR.compareTo(Severity.FATAL));
+ assertTrue(0 > Severity.INFO.compareTo(Severity.WARN));
+ assertTrue(0 > Severity.WARN.compareTo(Severity.ERROR));
+ assertTrue(0 > Severity.ERROR.compareTo(Severity.FATAL));
// make sure they are ordered correctly from worts to least
- Assertions.assertTrue(0 < Severity.FATAL.compareTo(Severity.ERROR));
- Assertions.assertTrue(0 < Severity.ERROR.compareTo(Severity.WARN));
- Assertions.assertTrue(0 < Severity.WARN.compareTo(Severity.INFO));
+ assertTrue(0 < Severity.FATAL.compareTo(Severity.ERROR));
+ assertTrue(0 < Severity.ERROR.compareTo(Severity.WARN));
+ assertTrue(0 < Severity.WARN.compareTo(Severity.INFO));
}
@Test
- public void testSeverityEquality()
+ void severityEquality()
{
// make sure they all respond as equals when they should
- Assertions.assertEquals(0, Severity.INFO.compareTo(Severity.INFO));
- Assertions.assertEquals(0, Severity.WARN.compareTo(Severity.WARN));
- Assertions.assertEquals(0, Severity.ERROR.compareTo(Severity.ERROR));
- Assertions.assertEquals(0, Severity.FATAL.compareTo(Severity.FATAL));
+ assertEquals(0, Severity.INFO.compareTo(Severity.INFO));
+ assertEquals(0, Severity.WARN.compareTo(Severity.WARN));
+ assertEquals(0, Severity.ERROR.compareTo(Severity.ERROR));
+ assertEquals(0, Severity.FATAL.compareTo(Severity.FATAL));
}
@Test
- public void testSeverityValues()
+ void severityValues()
{
// Faces spec requires this list to be sorted by ordinal
for (int i = 0, sz = FacesMessage.VALUES.size(); i < sz; i++)
{
FacesMessage.Severity severity = (Severity) FacesMessage.VALUES.get(i);
- Assertions.assertEquals(i, severity.ordinal());
+ assertEquals(i, severity.ordinal());
}
}
@SuppressWarnings("unchecked")
@Test
- public void testSeverityValuesMap()
+ void severityValuesMap()
{
Map severityMap = (Map) FacesMessage.VALUES_MAP;
for (Map.Entry e : severityMap.entrySet())
{
- Assertions.assertEquals(e.getKey(), e.getValue().toString());
+ assertEquals(e.getKey(), e.getValue().toString());
}
}
@Test
- public void testSerialization() throws Exception
+ void serialization() throws Exception
{
String summary = "summary";
String detail = "detail";
FacesMessage msg = new FacesMessage(summary, detail);
// check if properties are set correctly
- Assertions.assertEquals(msg.getSeverity(), Severity.INFO);
- Assertions.assertEquals(msg.getSummary(), summary);
- Assertions.assertEquals(msg.getDetail(), detail);
- Assertions.assertEquals(msg.isRendered(), false);
+ assertEquals(Severity.INFO, msg.getSeverity());
+ assertEquals(msg.getSummary(), summary);
+ assertEquals(msg.getDetail(), detail);
+ assertEquals(false, msg.isRendered());
// serialize instance
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -227,10 +230,10 @@ public void testSerialization() throws Exception
FacesMessage deserialized = (FacesMessage) in.readObject();
// FacesMessage properties must equal!
- Assertions.assertSame(msg.getSeverity(), deserialized.getSeverity());
- Assertions.assertEquals(msg.getSummary(), deserialized.getSummary());
- Assertions.assertEquals(msg.getDetail(), deserialized.getDetail());
- Assertions.assertEquals(msg.isRendered(), deserialized.isRendered());
+ assertSame(msg.getSeverity(), deserialized.getSeverity());
+ assertEquals(msg.getSummary(), deserialized.getSummary());
+ assertEquals(msg.getDetail(), deserialized.getDetail());
+ assertEquals(msg.isRendered(), deserialized.isRendered());
}
}
diff --git a/impl/src/test/java/jakarta/faces/application/StateManagerTest.java b/impl/src/test/java/jakarta/faces/application/StateManagerTest.java
index 35c2b3af4a..29ba4dd14e 100644
--- a/impl/src/test/java/jakarta/faces/application/StateManagerTest.java
+++ b/impl/src/test/java/jakarta/faces/application/StateManagerTest.java
@@ -19,26 +19,27 @@
package jakarta.faces.application;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.faces.context.ExternalContext;
import jakarta.faces.context.FacesContext;
import org.apache.myfaces.test.mock.MockStateManager;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-public class StateManagerTest
+class StateManagerTest
{
/*
* Test method for 'jakarta.faces.application.StateManager.isSavingStateInClient(FacesContext)'
*/
@Test
- public void testNullThrowsIsSavingStateInClient()
+ void nullThrowsIsSavingStateInClient()
{
MockStateManager subject = new MockStateManager();
try
{
subject.isSavingStateInClient(null);
- Assertions.fail("should have thrown an exception");
+ fail("should have thrown an exception");
}
catch (RuntimeException e)
{
@@ -49,7 +50,7 @@ public void testNullThrowsIsSavingStateInClient()
* Test method for 'jakarta.faces.application.StateManager.isSavingStateInClient(FacesContext)'
*/
@Test
- public void testIsSavingStateInClientTrue()
+ void isSavingStateInClientTrue()
{
FacesContext context = Mockito.spy(FacesContext.class);
ExternalContext external = Mockito.spy(ExternalContext.class);
@@ -59,14 +60,14 @@ public void testIsSavingStateInClientTrue()
.thenReturn("client");
MockStateManager subject = new MockStateManager();
- Assertions.assertEquals(true, subject.isSavingStateInClient(context));
+ assertTrue(subject.isSavingStateInClient(context));
}
/*
* Test method for 'jakarta.faces.application.StateManager.isSavingStateInClient(FacesContext)'
*/
@Test
- public void testIsSavingStateInClientFalse()
+ void isSavingStateInClientFalse()
{
FacesContext context = Mockito.spy(FacesContext.class);
ExternalContext external = Mockito.spy(ExternalContext.class);
@@ -76,14 +77,14 @@ public void testIsSavingStateInClientFalse()
.thenReturn("server");
MockStateManager subject = new MockStateManager();
- Assertions.assertEquals(false, subject.isSavingStateInClient(context));
+ assertFalse(subject.isSavingStateInClient(context));
}
/*
* Test method for 'jakarta.faces.application.StateManager.isSavingStateInClient(FacesContext)'
*/
@Test
- public void testIsSavingStateInClientBogus()
+ void isSavingStateInClientBogus()
{
FacesContext context = Mockito.spy(FacesContext.class);
ExternalContext external = Mockito.spy(ExternalContext.class);
@@ -93,7 +94,7 @@ public void testIsSavingStateInClientBogus()
.thenReturn("blorf");
MockStateManager subject = new MockStateManager();
- Assertions.assertEquals(false, subject.isSavingStateInClient(context));
+ assertFalse(subject.isSavingStateInClient(context));
Mockito.verify(external)
.log("Illegal state saving method 'blorf', default server state saving will be used");
@@ -103,7 +104,7 @@ public void testIsSavingStateInClientBogus()
* Test method for 'jakarta.faces.application.StateManager.isSavingStateInClient(FacesContext)'
*/
@Test
- public void testIsSavingStateInClientNull()
+ void isSavingStateInClientNull()
{
FacesContext context = Mockito.spy(FacesContext.class);
ExternalContext external = Mockito.spy(ExternalContext.class);
@@ -113,7 +114,7 @@ public void testIsSavingStateInClientNull()
.thenReturn(null);
MockStateManager subject = new MockStateManager();
- Assertions.assertEquals(false, subject.isSavingStateInClient(context));
+ assertFalse(subject.isSavingStateInClient(context));
Mockito.verify(external)
.log("No state saving method defined, assuming default server state saving");
diff --git a/impl/src/test/java/jakarta/faces/application/ViewHandlerTest.java b/impl/src/test/java/jakarta/faces/application/ViewHandlerTest.java
index cf4d9a4d62..fe57302dcb 100644
--- a/impl/src/test/java/jakarta/faces/application/ViewHandlerTest.java
+++ b/impl/src/test/java/jakarta/faces/application/ViewHandlerTest.java
@@ -19,6 +19,7 @@
package jakarta.faces.application;
import static org.easymock.EasyMock.*;
+import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -35,11 +36,10 @@
import org.apache.myfaces.test.mock.MockFacesContext;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class ViewHandlerTest
+class ViewHandlerTest
{
private MockFacesContext _facesContext;
private IMocksControl _mocksControl;
@@ -47,7 +47,7 @@ public class ViewHandlerTest
private TestViewHandler _testimpl;
@BeforeEach
- public void setUp() throws Exception
+ void setUp() throws Exception
{
_mocksControl = EasyMock.createControl();
_externalContext = _mocksControl.createMock(ExternalContext.class);
@@ -61,13 +61,13 @@ public void setUp() throws Exception
*/
@SuppressWarnings("unchecked")
@Test
- public void testCalculateCharacterEncodingWithRequestHeaderContentType()
+ void calculateCharacterEncodingWithRequestHeaderContentType()
{
Map map = _mocksControl.createMock(Map.class);
expect(_externalContext.getRequestHeaderMap()).andReturn(map);
expect(map.get(eq("Content-Type"))).andReturn("text/html;charset=UTF-8");
_mocksControl.replay();
- Assertions.assertEquals("UTF-8", _testimpl.calculateCharacterEncoding(_facesContext));
+ assertEquals("UTF-8", _testimpl.calculateCharacterEncoding(_facesContext));
_mocksControl.verify();
}
@@ -76,14 +76,14 @@ public void testCalculateCharacterEncodingWithRequestHeaderContentType()
* {@link jakarta.faces.application.ViewHandler#calculateCharacterEncoding(jakarta.faces.context.FacesContext)}.
*/
@Test
- public void testCalculateCharacterEncodingWithNoRequestContentTypeAndNoSession()
+ void calculateCharacterEncodingWithNoRequestContentTypeAndNoSession()
{
Map emptyMap = Collections.emptyMap();
expect(_externalContext.getRequestHeaderMap()).andReturn(emptyMap);
expect(_externalContext.getSession(eq(false))).andReturn(null);
_mocksControl.replay();
- Assertions.assertNull(_testimpl.calculateCharacterEncoding(_facesContext));
+ assertNull(_testimpl.calculateCharacterEncoding(_facesContext));
_mocksControl.verify();
}
@@ -93,7 +93,7 @@ public void testCalculateCharacterEncodingWithNoRequestContentTypeAndNoSession()
*/
@Test
@SuppressWarnings("unchecked")
- public void testCalculateCharacterEncodingWithNoRequestContentTypeAndWithSessionButNoSessionValue()
+ void calculateCharacterEncodingWithNoRequestContentTypeAndWithSessionButNoSessionValue()
{
Map emptyMap = Collections.emptyMap();
@@ -103,7 +103,7 @@ public void testCalculateCharacterEncodingWithNoRequestContentTypeAndWithSession
expect(_externalContext.getSessionMap()).andReturn(map);
expect(map.get(eq(ViewHandler.CHARACTER_ENCODING_KEY))).andReturn(null);
_mocksControl.replay();
- Assertions.assertNull(_testimpl.calculateCharacterEncoding(_facesContext));
+ assertNull(_testimpl.calculateCharacterEncoding(_facesContext));
_mocksControl.verify();
}
@@ -113,7 +113,7 @@ public void testCalculateCharacterEncodingWithNoRequestContentTypeAndWithSession
*/
@Test
@SuppressWarnings("unchecked")
- public void testCalculateCharacterEncodingWithNoRequestContentTypeAndWithSessionAndNoSessionValue()
+ void calculateCharacterEncodingWithNoRequestContentTypeAndWithSessionAndNoSessionValue()
{
Map emptyMap = Collections.emptyMap();
@@ -123,7 +123,7 @@ public void testCalculateCharacterEncodingWithNoRequestContentTypeAndWithSession
expect(_externalContext.getSessionMap()).andReturn(map);
expect(map.get(eq(ViewHandler.CHARACTER_ENCODING_KEY))).andReturn("UTF-8");
_mocksControl.replay();
- Assertions.assertEquals("UTF-8", _testimpl.calculateCharacterEncoding(_facesContext));
+ assertEquals("UTF-8", _testimpl.calculateCharacterEncoding(_facesContext));
_mocksControl.verify();
}
@@ -133,7 +133,7 @@ public void testCalculateCharacterEncodingWithNoRequestContentTypeAndWithSession
* @throws Exception
*/
@Test
- public void testInitView() throws Exception
+ void initView() throws Exception
{
ViewHandler handler = _mocksControl
.createMock(
@@ -155,7 +155,7 @@ public void testInitView() throws Exception
* @throws Exception
*/
@Test
- public void testInitViewWithUnsupportedEncodingException() throws Exception
+ void initViewWithUnsupportedEncodingException() throws Exception
{
final ViewHandler handler = _mocksControl
.createMock(
@@ -168,7 +168,7 @@ public void testInitViewWithUnsupportedEncodingException() throws Exception
_externalContext.setRequestCharacterEncoding(eq("xxx"));
expectLastCall().andThrow(new UnsupportedEncodingException());
_mocksControl.replay();
- Assertions.assertThrows(FacesException.class,
+ assertThrows(FacesException.class,
() -> handler.initView(_facesContext));
_mocksControl.verify();
}
diff --git a/impl/src/test/java/jakarta/faces/component/AbstractUIComponentPropertyTest.java b/impl/src/test/java/jakarta/faces/component/AbstractUIComponentPropertyTest.java
index 1657ef838b..404f6096f8 100644
--- a/impl/src/test/java/jakarta/faces/component/AbstractUIComponentPropertyTest.java
+++ b/impl/src/test/java/jakarta/faces/component/AbstractUIComponentPropertyTest.java
@@ -23,6 +23,7 @@
import java.beans.PropertyDescriptor;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import jakarta.el.ELContext;
import jakarta.el.ValueExpression;
@@ -31,7 +32,6 @@
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -95,15 +95,15 @@ protected PropertyDescriptor getPropertyDescriptor(Class> clazz, String proper
}
@Test
- public void testDefaultValue() throws Exception
+ public void defaultValue() throws Exception
{
Object val = getPropertyDescriptor(_component.getClass(), _property).getReadMethod()
.invoke(_component);
- Assertions.assertEquals(_defaultValue, val);
+ assertEquals(_defaultValue, val);
}
@Test
- public void testExplicitValue() throws Exception
+ public void explicitValue() throws Exception
{
for (T testValue : _testValues)
{
@@ -112,12 +112,12 @@ public void testExplicitValue() throws Exception
Object val = getPropertyDescriptor(_component.getClass(), _property).getReadMethod()
.invoke(_component);
- Assertions.assertEquals(testValue, val);
+ assertEquals(testValue, val);
}
}
@Test
- public void testExpressionWithLiteralTextValue() throws Exception
+ public void expressionWithLiteralTextValue() throws Exception
{
for (T testValue : _testValues)
{
@@ -128,13 +128,13 @@ public void testExpressionWithLiteralTextValue() throws Exception
Object val = getPropertyDescriptor(_component.getClass(), _property).getReadMethod()
.invoke(_component);
- Assertions.assertEquals(testValue, val);
+ assertEquals(testValue, val);
_mocksControl.reset();
}
}
@Test
- public void testExpressionValue() throws Exception
+ public void expressionValue() throws Exception
{
for (T testValue : _testValues)
{
@@ -147,7 +147,7 @@ public void testExpressionValue() throws Exception
Object val = getPropertyDescriptor(_component.getClass(), _property).getReadMethod()
.invoke(_component);
- Assertions.assertEquals(testValue, val);
+ assertEquals(testValue, val);
_mocksControl.reset();
}
}
diff --git a/impl/src/test/java/jakarta/faces/component/InvokeOnComponentTest.java b/impl/src/test/java/jakarta/faces/component/InvokeOnComponentTest.java
index 93e57934aa..4628f5f098 100644
--- a/impl/src/test/java/jakarta/faces/component/InvokeOnComponentTest.java
+++ b/impl/src/test/java/jakarta/faces/component/InvokeOnComponentTest.java
@@ -18,6 +18,8 @@
*/
package jakarta.faces.component;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -28,12 +30,11 @@
import org.apache.myfaces.dummy.data.Data;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-public class InvokeOnComponentTest extends AbstractComponentTest
+class InvokeOnComponentTest extends AbstractComponentTest
{
ContextCallback cc = null;
@@ -56,7 +57,7 @@ public void tearDown() throws Exception
}
@Test
- public void testInvokeOnFormPrependId() throws Exception
+ void invokeOnFormPrependId() throws Exception
{
UIForm form = new UIForm();
form.setId("form");
@@ -69,11 +70,11 @@ public void testInvokeOnFormPrependId() throws Exception
val.set(true);
});
- Assertions.assertTrue(val.get());
+ assertTrue(val.get());
}
-
+
@Test
- public void testInvokeOnFormPrependIdFalse() throws Exception
+ void invokeOnFormPrependIdFalse() throws Exception
{
UIForm form = new UIForm();
form.setId("form");
@@ -86,11 +87,11 @@ public void testInvokeOnFormPrependIdFalse() throws Exception
val.set(true);
});
- Assertions.assertTrue(val.get());
+ assertTrue(val.get());
}
-
+
@Test
- public void testInvokeOnFormPrependIdChild() throws Exception
+ void invokeOnFormPrependIdChild() throws Exception
{
UIForm form = new UIForm();
form.setId("form");
@@ -108,11 +109,11 @@ public void testInvokeOnFormPrependIdChild() throws Exception
val.set(true);
});
- Assertions.assertTrue(val.get());
+ assertTrue(val.get());
}
-
+
@Test
- public void testInvokeOnFormPrependIdFalseChild() throws Exception
+ void invokeOnFormPrependIdFalseChild() throws Exception
{
UIForm form = new UIForm();
form.setId("form");
@@ -130,11 +131,11 @@ public void testInvokeOnFormPrependIdFalseChild() throws Exception
val.set(true);
});
- Assertions.assertTrue(val.get());
+ assertTrue(val.get());
}
-
+
@Test
- public void atestInvokeOnComp() throws Exception
+ void atestInvokeOnComp() throws Exception
{
UIForm form = new UIForm();
UIInput i1 = new UIInput();
@@ -160,7 +161,7 @@ public void atestInvokeOnComp() throws Exception
}
@Test
- public void btestInvokeOnCompOnUIData() throws Exception
+ void btestInvokeOnCompOnUIData() throws Exception
{
// column1
UIColumn c1 = new UIColumn();
@@ -210,7 +211,7 @@ public void btestInvokeOnCompOnUIData() throws Exception
}
@Test
- public void testInvokeOnCompOnUIDataChildren() throws Exception
+ void invokeOnCompOnUIDataChildren() throws Exception
{
// column1
UIColumn c1 = new UIColumn();
diff --git a/impl/src/test/java/jakarta/faces/component/UIComponentAttributesTest.java b/impl/src/test/java/jakarta/faces/component/UIComponentAttributesTest.java
index 5a81df2724..ff34c8aebd 100644
--- a/impl/src/test/java/jakarta/faces/component/UIComponentAttributesTest.java
+++ b/impl/src/test/java/jakarta/faces/component/UIComponentAttributesTest.java
@@ -25,7 +25,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class UIComponentAttributesTest extends AbstractFacesTestCase
+class UIComponentAttributesTest extends AbstractFacesTestCase
{
private HtmlInputText input;
@@ -47,7 +47,7 @@ public void tearDown() throws Exception
}
@Test
- public void testSetNullAttributeOnValidProperty()
+ void setNullAttributeOnValidProperty()
{
input.getAttributes().put("style", null);
}
diff --git a/impl/src/test/java/jakarta/faces/component/UIComponentBaseFacesListenerTest.java b/impl/src/test/java/jakarta/faces/component/UIComponentBaseFacesListenerTest.java
index 35a6d08804..ba2711e869 100644
--- a/impl/src/test/java/jakarta/faces/component/UIComponentBaseFacesListenerTest.java
+++ b/impl/src/test/java/jakarta/faces/component/UIComponentBaseFacesListenerTest.java
@@ -18,6 +18,8 @@
*/
package jakarta.faces.component;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
@@ -26,7 +28,6 @@
import jakarta.faces.event.FacesListener;
import jakarta.faces.event.ValueChangeListener;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -65,55 +66,53 @@ public void tearDown() throws Exception
}
@Test
- public void testArgNPE() throws Exception
+ void argNPE() throws Exception
{
- Assertions.assertThrows(NullPointerException.class, () -> {
- _testImpl.getFacesListeners(null);
- });
+ assertThrows(NullPointerException.class, () ->
+ _testImpl.getFacesListeners(null));
}
@Test
- public void testEmptyListener() throws Exception
+ void emptyListener() throws Exception
{
FacesListener[] listener = _testImpl.getFacesListeners(ActionListener.class);
- Assertions.assertNotNull(listener);
- Assertions.assertEquals(0, listener.length);
+ assertNotNull(listener);
+ assertEquals(0, listener.length);
}
@Test
- public void testGetFacesListeners()
+ void getFacesListeners()
{
_testImpl.addFacesListener(_actionListener);
FacesListener[] listener = _testImpl.getFacesListeners(ValueChangeListener.class);
- Assertions.assertNotNull(listener);
- Assertions.assertEquals(0, listener.length);
- Assertions.assertTrue(ValueChangeListener.class.equals(listener.getClass().getComponentType()));
+ assertNotNull(listener);
+ assertEquals(0, listener.length);
+ assertEquals(ValueChangeListener.class, listener.getClass().getComponentType());
_testImpl.addFacesListener(_valueChangeListener);
listener = _testImpl.getFacesListeners(FacesListener.class);
- Assertions.assertNotNull(listener);
- Assertions.assertEquals(2, listener.length);
+ assertNotNull(listener);
+ assertEquals(2, listener.length);
Collection col = Arrays.asList(listener);
- Assertions.assertTrue(col.contains(_actionListener));
- Assertions.assertTrue(col.contains(_valueChangeListener));
+ assertTrue(col.contains(_actionListener));
+ assertTrue(col.contains(_valueChangeListener));
}
@Test
- public void testRemoveFacesListenerArgNPE() throws Exception
+ void removeFacesListenerArgNPE() throws Exception
{
- Assertions.assertThrows(NullPointerException.class, () -> {
- _testImpl.removeFacesListener(null);
- });
+ assertThrows(NullPointerException.class, () ->
+ _testImpl.removeFacesListener(null));
}
@Test
- public void testRemoveFacesListener() throws Exception
+ void removeFacesListener() throws Exception
{
_testImpl.addFacesListener(_actionListener);
- Assertions.assertEquals(_actionListener, _testImpl.getFacesListeners(FacesListener.class)[0]);
+ assertEquals(_actionListener, _testImpl.getFacesListeners(FacesListener.class)[0]);
_testImpl.removeFacesListener(_actionListener);
- Assertions.assertEquals(0, _testImpl.getFacesListeners(FacesListener.class).length);
+ assertEquals(0, _testImpl.getFacesListeners(FacesListener.class).length);
}
}
diff --git a/impl/src/test/java/jakarta/faces/component/UIComponentBaseGetChildrenTest.java b/impl/src/test/java/jakarta/faces/component/UIComponentBaseGetChildrenTest.java
index 8534d7b7e5..b21fb86001 100644
--- a/impl/src/test/java/jakarta/faces/component/UIComponentBaseGetChildrenTest.java
+++ b/impl/src/test/java/jakarta/faces/component/UIComponentBaseGetChildrenTest.java
@@ -18,17 +18,18 @@
*/
package jakarta.faces.component;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.ArrayList;
import java.util.List;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class UIComponentBaseGetChildrenTest extends AbstractFacesTestCase
+class UIComponentBaseGetChildrenTest extends AbstractFacesTestCase
{
@Test
- public void testGetChildrenAddAll()
+ void getChildrenAddAll()
{
UIInput input0 = new UIInput();
UIInput input1 = new UIInput();
@@ -56,23 +57,23 @@ public void testGetChildrenAddAll()
// inserted to the first ones
children.addAll(0, list);
- Assertions.assertEquals(4, children.size());
- Assertions.assertEquals(input2.getId(), children.get(0).getId());
- Assertions.assertEquals(input3.getId(), children.get(1).getId());
+ assertEquals(4, children.size());
+ assertEquals(input2.getId(), children.get(0).getId());
+ assertEquals(input3.getId(), children.get(1).getId());
}
-
+
@Test
- public void testSimpleAddRemove()
+ void simpleAddRemove()
{
UIInput input = new UIInput();
input.setId("input0");
UIPanel panel = new UIPanel();
panel.getChildren().add(input);
- Assertions.assertEquals(panel, input.getParent());
+ assertEquals(panel, input.getParent());
panel.getChildren().remove(input);
- Assertions.assertNull(input.getParent());
+ assertNull(input.getParent());
}
-
+
/** Whenever a new child component is added, the parent property
* of the child must be set to this component instance.
* If the parent property of the child was already non-null,
@@ -80,7 +81,7 @@ public void testSimpleAddRemove()
* (where it may have been either a child or a facet).
*/
@Test
- public void testSetChild1()
+ void setChild1()
{
UIInput input = new UIInput();
input.setId("input0");
@@ -90,16 +91,16 @@ public void testSetChild1()
UIPanel panel = new UIPanel();
panel.getChildren().add(input);
- Assertions.assertEquals(panel, input.getParent());
+ assertEquals(panel, input.getParent());
panel.getChildren().set(0, input1);
- Assertions.assertEquals(panel, input1.getParent());
- Assertions.assertNull(input.getParent());
+ assertEquals(panel, input1.getParent());
+ assertNull(input.getParent());
}
-
+
@Test
- public void testSetChild2()
+ void setChild2()
{
UIInput input = new UIInput();
input.setId("input0");
@@ -109,7 +110,7 @@ public void testSetChild2()
UIPanel panel = new UIPanel();
panel.getChildren().add(input);
- Assertions.assertEquals(panel, input.getParent());
+ assertEquals(panel, input.getParent());
UIViewRoot root = new UIViewRoot();
root.getChildren().add(panel);
@@ -117,19 +118,18 @@ public void testSetChild2()
panel.getChildren().set(0, input1);
- Assertions.assertEquals(panel, input1.getParent());
- Assertions.assertNull(input.getParent());
+ assertEquals(panel, input1.getParent());
+ assertNull(input.getParent());
- Assertions.assertTrue(root.getFacets().isEmpty());
+ assertTrue(root.getFacets().isEmpty());
}
-
-
-
+
+
/** Whenever an existing child component is removed, the parent
* property of the child must be set to null.
*/
@Test
- public void testSetFacetClearChild()
+ void setFacetClearChild()
{
UIInput input = new UIInput();
input.setId("input0");
@@ -139,22 +139,22 @@ public void testSetFacetClearChild()
UIPanel panel = new UIPanel();
panel.getChildren().add(input);
- Assertions.assertEquals(panel, input.getParent());
+ assertEquals(panel, input.getParent());
UIViewRoot root = new UIViewRoot();
root.getChildren().add(panel);
root.getFacets().put("customFacet", input1);
root.getFacets().put("customFacet", input);
- Assertions.assertEquals(root, input.getParent());
- Assertions.assertNull(input1.getParent());
+ assertEquals(root, input.getParent());
+ assertNull(input1.getParent());
- Assertions.assertFalse(root.getFacets().isEmpty());
- Assertions.assertTrue(panel.getChildCount() == 0);
+ assertFalse(root.getFacets().isEmpty());
+ assertEquals(0, panel.getChildCount());
}
@Test
- public void testSetFacetClearFacet()
+ void setFacetClearFacet()
{
UIInput input = new UIInput();
input.setId("input0");
@@ -164,17 +164,17 @@ public void testSetFacetClearFacet()
UIPanel panel = new UIPanel();
panel.getFacets().put("header", input);
- Assertions.assertEquals(panel, input.getParent());
+ assertEquals(panel, input.getParent());
UIViewRoot root = new UIViewRoot();
root.getChildren().add(panel);
root.getFacets().put("customFacet", input1);
root.getFacets().put("customFacet", input);
- Assertions.assertEquals(root, input.getParent());
- Assertions.assertNull(input1.getParent());
+ assertEquals(root, input.getParent());
+ assertNull(input1.getParent());
- Assertions.assertFalse(root.getFacets().isEmpty());
- Assertions.assertTrue(panel.getChildCount() == 0);
+ assertFalse(root.getFacets().isEmpty());
+ assertEquals(0, panel.getChildCount());
}
}
diff --git a/impl/src/test/java/jakarta/faces/component/UIComponentBaseGetClientIdTest.java b/impl/src/test/java/jakarta/faces/component/UIComponentBaseGetClientIdTest.java
index be09c33255..a484adfc5a 100644
--- a/impl/src/test/java/jakarta/faces/component/UIComponentBaseGetClientIdTest.java
+++ b/impl/src/test/java/jakarta/faces/component/UIComponentBaseGetClientIdTest.java
@@ -18,10 +18,11 @@
*/
package jakarta.faces.component;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.faces.FacesException;
import jakarta.faces.context.FacesContext;
import jakarta.faces.render.Renderer;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -32,7 +33,7 @@
* Time: 01:42:55
* To change this template use File | Settings | File Templates.
*/
-public class UIComponentBaseGetClientIdTest extends AbstractComponentTest
+class UIComponentBaseGetClientIdTest extends AbstractComponentTest
{
protected UIComponentBase _testImpl;
@@ -45,12 +46,12 @@ public void setUp() throws Exception
}
@Test
- public void testNullFacesContext() throws Exception
+ void nullFacesContext() throws Exception
{
try
{
_testImpl.getClientId(null);
- Assertions.fail();
+ fail();
}
catch(NullPointerException e)
{
@@ -58,22 +59,22 @@ public void testNullFacesContext() throws Exception
}
catch(Exception e)
{
- Assertions.fail();
+ fail();
}
}
@Test
- public void testWithoutParentAndNoRenderer() throws Exception
+ void withoutParentAndNoRenderer() throws Exception
{
String expectedClientId = "testId";
_testImpl.setId(expectedClientId);
- Assertions.assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
- Assertions.assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
+ assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
+ assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
}
@Test
- public void testWithRenderer() throws Exception
+ void withRenderer() throws Exception
{
String id = "testId";
final String expectedClientId = "convertedClientId";
@@ -91,12 +92,12 @@ public String convertClientId(FacesContext context, String clientId)
}
};
_testImpl.setId(id);
- Assertions.assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
- Assertions.assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
+ assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
+ assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
}
@Test
- public void testWithParentNamingContainer() throws Exception
+ void withParentNamingContainer() throws Exception
{
String id = "testId";
String containerClientId = "containerClientId";
@@ -111,12 +112,12 @@ public void testWithParentNamingContainer() throws Exception
parent.getChildren().add(_testImpl);
_testImpl.setId(id);
- Assertions.assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
- Assertions.assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
+ assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
+ assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
}
@Test
- public void testWithParentNamingContainerChanging() throws Exception
+ void withParentNamingContainerChanging() throws Exception
{
String id = "testId";
String containerClientId = "containerClientId";
@@ -142,29 +143,29 @@ public String getContainerClientId(FacesContext ctx)
parent.setId("parent");
parent.getChildren().add(_testImpl);
- Assertions.assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
- Assertions.assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
+ assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
+ assertEquals(expectedClientId, _testImpl.getClientId(facesContext));
parent.getChildren().remove(_testImpl);
}
}
@Test
- public void testWithoutId() throws Exception
+ void withoutId() throws Exception
{
UIViewRoot viewRoot = facesContext.getViewRoot();
- Assertions.assertNotNull(viewRoot.createUniqueId());
- Assertions.assertNotNull(_testImpl.getClientId());
- Assertions.assertNotNull(_testImpl.getId());
+ assertNotNull(viewRoot.createUniqueId());
+ assertNotNull(_testImpl.getClientId());
+ assertNotNull(_testImpl.getId());
}
@Test
- public void testWithoutIdAndNoUIViewRoot() throws Exception
+ void withoutIdAndNoUIViewRoot() throws Exception
{
facesContext.setViewRoot(null);
try
{
_testImpl.getClientId(facesContext);
- Assertions.fail();
+ fail();
}
catch(FacesException e)
{
@@ -172,7 +173,7 @@ public void testWithoutIdAndNoUIViewRoot() throws Exception
}
catch(Exception e)
{
- Assertions.fail();
+ fail();
}
}
}
diff --git a/impl/src/test/java/jakarta/faces/component/UIComponentBaseProcessSaveRestoreStateTest.java b/impl/src/test/java/jakarta/faces/component/UIComponentBaseProcessSaveRestoreStateTest.java
index 305032871f..ebbfbba37c 100644
--- a/impl/src/test/java/jakarta/faces/component/UIComponentBaseProcessSaveRestoreStateTest.java
+++ b/impl/src/test/java/jakarta/faces/component/UIComponentBaseProcessSaveRestoreStateTest.java
@@ -29,8 +29,9 @@
import org.easymock.EasyMock;
import static org.easymock.EasyMock.*;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -41,7 +42,7 @@
* Time: 01:14:31
* To change this template use File | Settings | File Templates.
*/
-public class UIComponentBaseProcessSaveRestoreStateTest extends AbstractUIComponentBaseTest
+class UIComponentBaseProcessSaveRestoreStateTest extends AbstractUIComponentBaseTest
{
private static final String CHILD_STATE = "childState";
private static final String TESTIMPL_STATE = "testimplState";
@@ -82,19 +83,17 @@ protected Collection getMockedMethods() throws Exception
}
@Test
- public void testSaveStateExceptions() throws Exception
+ void saveStateExceptions() throws Exception
{
- Assertions.assertThrows(NullPointerException.class, () -> {
- _testImpl.processSaveState(null);
- });
+ assertThrows(NullPointerException.class, () ->
+ _testImpl.processSaveState(null));
}
@Test
- public void testRestoreStateExceptions() throws Exception
+ void restoreStateExceptions() throws Exception
{
- Assertions.assertThrows(NullPointerException.class, () -> {
- _testImpl.processRestoreState(null, null);
- });
+ assertThrows(NullPointerException.class, () ->
+ _testImpl.processRestoreState(null, null));
}
// FIXME: Need to add some expectation for FacesContext.getAttributes. I'll have to read a bit more about
diff --git a/impl/src/test/java/jakarta/faces/component/UIComponentBaseRestoreCollectionTest.java b/impl/src/test/java/jakarta/faces/component/UIComponentBaseRestoreCollectionTest.java
index a234a220ed..7143b3017a 100644
--- a/impl/src/test/java/jakarta/faces/component/UIComponentBaseRestoreCollectionTest.java
+++ b/impl/src/test/java/jakarta/faces/component/UIComponentBaseRestoreCollectionTest.java
@@ -18,6 +18,8 @@
*/
package jakarta.faces.component;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.NotSerializableException;
@@ -39,7 +41,6 @@
import jakarta.faces.event.PhaseId;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -52,7 +53,7 @@
* Each case is restored without serialization, as with server side state saving, and after serialization, as with
* client side state saving.
*/
-public class UIComponentBaseRestoreCollectionTest extends AbstractFacesTestCase
+class UIComponentBaseRestoreCollectionTest extends AbstractFacesTestCase
{
@Override
@BeforeEach
@@ -63,61 +64,61 @@ public void setUp() throws Exception
}
@Test
- public void testListOf() throws Exception
+ void listOf() throws Exception
{
assertRestoredWithExactType(List.of("b", "a", "b"));
}
@Test
- public void testListCopyOf() throws Exception
+ void listCopyOf() throws Exception
{
assertRestoredWithExactType(List.copyOf(Arrays.asList("b", "a", "b")));
}
@Test
- public void testArraysAsList() throws Exception
+ void arraysAsList() throws Exception
{
assertRestoredWithExactType(Arrays.asList("b", "a", "b"));
}
@Test
- public void testUnmodifiableList() throws Exception
+ void unmodifiableList() throws Exception
{
assertRestoredWithExactType(Collections.unmodifiableList(new LinkedList<>(List.of("b", "a", "b"))));
}
@Test
- public void testSingletonList() throws Exception
+ void singletonList() throws Exception
{
assertRestoredWithExactType(Collections.singletonList("b"));
}
@Test
- public void testEmptyList() throws Exception
+ void emptyList() throws Exception
{
assertRestoredWithExactType(Collections.emptyList());
}
@Test
- public void testSetOf() throws Exception
+ void setOf() throws Exception
{
assertRestoredWithExactType(Set.of("a", "b", "c"));
}
@Test
- public void testUnmodifiableSetKeepsOrder() throws Exception
+ void unmodifiableSetKeepsOrder() throws Exception
{
Set set = Collections.unmodifiableSet(new LinkedHashSet<>(List.of("c", "a", "b")));
assertSavedWhole(set);
for (Object restored : restore(set))
{
- Assertions.assertEquals(set.getClass(), restored.getClass());
- Assertions.assertEquals(List.of("c", "a", "b"), List.copyOf((Set>) restored));
+ assertEquals(set.getClass(), restored.getClass());
+ assertEquals(List.of("c", "a", "b"), List.copyOf((Set>) restored));
}
}
@Test
- public void testQueueWithoutNoArgConstructor() throws Exception
+ void queueWithoutNoArgConstructor() throws Exception
{
Collection queue = Collections.asLifoQueue(new ArrayDeque<>());
queue.add("a");
@@ -125,8 +126,8 @@ public void testQueueWithoutNoArgConstructor() throws Exception
assertSavedWhole(queue);
for (Object restored : restore(queue))
{
- Assertions.assertEquals(queue.getClass(), restored.getClass());
- Assertions.assertEquals(List.copyOf(queue), List.copyOf((Collection>) restored));
+ assertEquals(queue.getClass(), restored.getClass());
+ assertEquals(List.copyOf(queue), List.copyOf((Collection>) restored));
}
}
@@ -135,23 +136,23 @@ public void testQueueWithoutNoArgConstructor() throws Exception
* instance of its class.
*/
@Test
- public void testCollectionWithNoArgConstructorIsRestoredIntoNewInstance() throws Exception
+ void collectionWithNoArgConstructorIsRestoredIntoNewInstance() throws Exception
{
LinkedList linkedList = new LinkedList<>(List.of("b", "a", "b"));
assertSavedItemByItem(linkedList);
for (Object restored : restore(linkedList))
{
- Assertions.assertNotSame(linkedList, restored);
- Assertions.assertEquals(LinkedList.class, restored.getClass());
- Assertions.assertEquals(linkedList, restored);
+ assertNotSame(linkedList, restored);
+ assertEquals(LinkedList.class, restored.getClass());
+ assertEquals(linkedList, restored);
}
TreeSet treeSet = new TreeSet<>(List.of("c", "a", "b"));
assertSavedItemByItem(treeSet);
for (Object restored : restore(treeSet))
{
- Assertions.assertEquals(TreeSet.class, restored.getClass());
- Assertions.assertEquals(treeSet, restored);
+ assertEquals(TreeSet.class, restored.getClass());
+ assertEquals(treeSet, restored);
}
}
@@ -160,7 +161,7 @@ public void testCollectionWithNoArgConstructorIsRestoredIntoNewInstance() throws
* zero-argument constructor, the same as for clazz.newInstance() in restoreAttachedState().
*/
@Test
- public void testPrivateNoArgConstructorIsSavedWhole() throws Exception
+ void privateNoArgConstructorIsSavedWhole() throws Exception
{
PrivateConstructorList list = PrivateConstructorList.of("b", "a");
assertSavedWhole(list);
@@ -172,7 +173,7 @@ public void testPrivateNoArgConstructorIsSavedWhole() throws Exception
* is still saved item by item and restored into a new instance of its class.
*/
@Test
- public void testAccessiblePackagePrivateNoArgConstructorIsSavedItemByItem() throws Exception
+ void accessiblePackagePrivateNoArgConstructorIsSavedItemByItem() throws Exception
{
PackagePrivateConstructorList list = new PackagePrivateConstructorList();
list.add("b");
@@ -180,9 +181,9 @@ public void testAccessiblePackagePrivateNoArgConstructorIsSavedItemByItem() thro
assertSavedItemByItem(list);
for (Object restored : restore(list))
{
- Assertions.assertNotSame(list, restored);
- Assertions.assertEquals(PackagePrivateConstructorList.class, restored.getClass());
- Assertions.assertEquals(list, restored);
+ assertNotSame(list, restored);
+ assertEquals(PackagePrivateConstructorList.class, restored.getClass());
+ assertEquals(list, restored);
}
}
@@ -191,25 +192,25 @@ public void testAccessiblePackagePrivateNoArgConstructorIsSavedItemByItem() thro
* state fails, while restoring it without serialization works.
*/
@Test
- public void testNotSerializableItemFailsOnlyWhenSerialized() throws Exception
+ void notSerializableItemFailsOnlyWhenSerialized() throws Exception
{
Object item = new Object();
List
*/
-public class StateUtilsBlowfish_ECBTest extends AbstractStateUtilsTest
+class StateUtilsBlowfish_ECBTest extends AbstractStateUtilsTest
{
@Override
@BeforeEach
diff --git a/impl/src/test/java/org/apache/myfaces/application/viewstate/StateUtilsDefaultTest.java b/impl/src/test/java/org/apache/myfaces/application/viewstate/StateUtilsDefaultTest.java
index 5c4a0fe0ff..cbb03f72e7 100644
--- a/impl/src/test/java/org/apache/myfaces/application/viewstate/StateUtilsDefaultTest.java
+++ b/impl/src/test/java/org/apache/myfaces/application/viewstate/StateUtilsDefaultTest.java
@@ -22,7 +22,7 @@
* StateUtils.
*/
-public class StateUtilsDefaultTest extends AbstractStateUtilsTest
+class StateUtilsDefaultTest extends AbstractStateUtilsTest
{
@Override
@BeforeEach
diff --git a/impl/src/test/java/org/apache/myfaces/application/viewstate/StateUtilsTripleDES_ECBTest.java b/impl/src/test/java/org/apache/myfaces/application/viewstate/StateUtilsTripleDES_ECBTest.java
index 89860a1fac..c42c61ad0b 100644
--- a/impl/src/test/java/org/apache/myfaces/application/viewstate/StateUtilsTripleDES_ECBTest.java
+++ b/impl/src/test/java/org/apache/myfaces/application/viewstate/StateUtilsTripleDES_ECBTest.java
@@ -28,7 +28,7 @@
*
*/
-public class StateUtilsTripleDES_ECBTest extends AbstractStateUtilsTest
+class StateUtilsTripleDES_ECBTest extends AbstractStateUtilsTest
{
@Override
@BeforeEach
diff --git a/impl/src/test/java/org/apache/myfaces/cdi/bean/CDIGenericConverterValidatorTest.java b/impl/src/test/java/org/apache/myfaces/cdi/bean/CDIGenericConverterValidatorTest.java
index b2ddb30d08..1417632713 100644
--- a/impl/src/test/java/org/apache/myfaces/cdi/bean/CDIGenericConverterValidatorTest.java
+++ b/impl/src/test/java/org/apache/myfaces/cdi/bean/CDIGenericConverterValidatorTest.java
@@ -19,6 +19,9 @@
package org.apache.myfaces.cdi.bean;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.component.UIInput;
import jakarta.faces.component.UIOutput;
@@ -26,16 +29,15 @@
import jakarta.faces.validator.ValidatorException;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* Unit tests to ensure that Generics work with CDI Converters and Validators
*/
-public class CDIGenericConverterValidatorTest extends AbstractMyFacesCDIRequestTestCase {
+class CDIGenericConverterValidatorTest extends AbstractMyFacesCDIRequestTestCase {
@Test
- public void testConverter() throws Exception {
+ void converter() throws Exception {
String expectedValue = "zero";
String result = "";
@@ -50,13 +52,12 @@ public void testConverter() throws Exception {
result = converter.getAsString(facesContext, out, bean);
- Assertions.assertTrue(result.equals(expectedValue),
- "The value output should have matched: " + expectedValue + " but was : " + result);
+ assertEquals(result, expectedValue, "The value output should have matched: " + expectedValue + " but was : " + result);
}
@Test
- public void testValidator() throws Exception {
+ void validator() throws Exception {
startViewRequest("/CDIGenericValidatorTest.xhtml");
application.addValidator("customValidator", "org.apache.myfaces.cdi.bean.CustomValidator");
@@ -68,7 +69,7 @@ public void testValidator() throws Exception {
//Expects a ValidatorException
try {
out.getValidators()[0].validate(facesContext, out, r);
- Assertions.fail("ValidatorException was not thrown. Custom Generic validator failed.");
+ fail("ValidatorException was not thrown. Custom Generic validator failed.");
} catch (ValidatorException e) {
//Ignored
}
diff --git a/impl/src/test/java/org/apache/myfaces/cdi/bean/DynamicManagedPropertyProducerTest.java b/impl/src/test/java/org/apache/myfaces/cdi/bean/DynamicManagedPropertyProducerTest.java
index 17fbee7051..ee60de3012 100644
--- a/impl/src/test/java/org/apache/myfaces/cdi/bean/DynamicManagedPropertyProducerTest.java
+++ b/impl/src/test/java/org/apache/myfaces/cdi/bean/DynamicManagedPropertyProducerTest.java
@@ -19,20 +19,21 @@
package org.apache.myfaces.cdi.bean;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.component.UIOutput;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* A unit test to test the CDI @ManagedProperty
*/
-public class DynamicManagedPropertyProducerTest extends AbstractMyFacesCDIRequestTestCase
+class DynamicManagedPropertyProducerTest extends AbstractMyFacesCDIRequestTestCase
{
@Test
- public void testCDIManagedProperty() throws Exception {
+ void cdiManagedProperty() throws Exception {
String expectedValue = "numberManagedProperty=0textManagedProperty=zerolistManagedProperty" +
"=zerostringArrayManagedProperty=zerobean=org.apache.myfaces.cdi.bean.TestBean";
String result;
@@ -46,8 +47,7 @@ public void testCDIManagedProperty() throws Exception {
result = result.substring(0, result.indexOf('@'));
result = result.replaceAll("\\s","");
- Assertions.assertTrue(result.equals(expectedValue),
- "The value output should have matched: " + expectedValue + " but was : " + result);
+ assertEquals(result, expectedValue, "The value output should have matched: " + expectedValue + " but was : " + result);
}
@Override
diff --git a/impl/src/test/java/org/apache/myfaces/cdi/view/ViewScopeCDIMapTest.java b/impl/src/test/java/org/apache/myfaces/cdi/view/ViewScopeCDIMapTest.java
index 7fc2487c7b..721697ca2f 100644
--- a/impl/src/test/java/org/apache/myfaces/cdi/view/ViewScopeCDIMapTest.java
+++ b/impl/src/test/java/org/apache/myfaces/cdi/view/ViewScopeCDIMapTest.java
@@ -18,26 +18,27 @@
*/
package org.apache.myfaces.cdi.view;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.Map;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.view.ViewScopeProxyMap;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class ViewScopeCDIMapTest extends AbstractMyFacesCDIRequestTestCase
+class ViewScopeCDIMapTest extends AbstractMyFacesCDIRequestTestCase
{
@Test
- public void testPutReturnsPreviousValue() throws Exception
+ void putReturnsPreviousValue() throws Exception
{
startViewRequest("/viewScopeCDIMap.xhtml");
processLifecycleExecuteAndRender();
Map viewMap = facesContext.getViewRoot().getViewMap();
- Assertions.assertInstanceOf(ViewScopeCDIMap.class, ((ViewScopeProxyMap) viewMap).getDelegate());
+ assertInstanceOf(ViewScopeCDIMap.class, ((ViewScopeProxyMap) viewMap).getDelegate());
- Assertions.assertNull(viewMap.put("key", "first"));
- Assertions.assertEquals("first", viewMap.put("key", "second"));
- Assertions.assertEquals("second", viewMap.get("key"));
+ assertNull(viewMap.put("key", "first"));
+ assertEquals("first", viewMap.put("key", "second"));
+ assertEquals("second", viewMap.get("key"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/component/search/SearchExpressionImplTest.java b/impl/src/test/java/org/apache/myfaces/component/search/SearchExpressionImplTest.java
index ae956a87e1..8120cc604b 100644
--- a/impl/src/test/java/org/apache/myfaces/component/search/SearchExpressionImplTest.java
+++ b/impl/src/test/java/org/apache/myfaces/component/search/SearchExpressionImplTest.java
@@ -19,6 +19,8 @@
package org.apache.myfaces.component.search;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -34,13 +36,12 @@
import jakarta.faces.component.search.SearchExpressionHint;
import jakarta.faces.context.FacesContext;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
*
*/
-public class SearchExpressionImplTest extends AbstractMyFacesCDIRequestTestCase
+class SearchExpressionImplTest extends AbstractMyFacesCDIRequestTestCase
{
@Override
protected void setUpWebConfigParams() throws Exception
@@ -51,7 +52,7 @@ protected void setUpWebConfigParams() throws Exception
}
@Test
- public void testSearchExpression1() throws Exception
+ void searchExpression1() throws Exception
{
startViewRequest("/search1.xhtml");
processLifecycleExecute();
@@ -70,60 +71,58 @@ public void testSearchExpression1() throws Exception
//System.out.println(clientId);
found = true;
}
- Assertions.assertTrue(found);
+ assertTrue(found);
String componentId = facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(
searchContext, "@this").get(0);
- Assertions.assertEquals("mainForm:showName", componentId);
+ assertEquals("mainForm:showName", componentId);
componentId = facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(
searchContext, "@this:@parent:showName").get(0);
- Assertions.assertEquals("mainForm:showName", componentId);
+ assertEquals("mainForm:showName", componentId);
componentId = facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(
searchContext, "@form:inputOutsideForm").get(0);
- Assertions.assertEquals("mainForm:inputOutsideForm", componentId);
+ assertEquals("mainForm:inputOutsideForm", componentId);
final SearchExpressionContext currentSearchContext = searchContext;
- Assertions.assertThrows(ComponentNotFoundException.class, () ->
- {
- facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(currentSearchContext, ":inputOutsideForm");
- });
+ assertThrows(ComponentNotFoundException.class, () ->
+ facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(currentSearchContext, ":inputOutsideForm"));
componentId = facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(
searchContext, "mainForm:table:0:baseText").get(0);
- Assertions.assertEquals("mainForm:table:0:baseText", componentId);
+ assertEquals("mainForm:table:0:baseText", componentId);
componentId = facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(
searchContext, "@parent:showName:@parent:showName").get(0);
- Assertions.assertEquals("mainForm:showName", componentId);
+ assertEquals("mainForm:showName", componentId);
componentId = facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(
searchContext, "@form:showName").get(0);
- Assertions.assertEquals("mainForm:showName", componentId);
+ assertEquals("mainForm:showName", componentId);
componentId = facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(
searchContext, " @namingcontainer:showName ").get(0);
- Assertions.assertEquals("mainForm:showName", componentId);
+ assertEquals("mainForm:showName", componentId);
UIOutput name = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:name");
searchContext = SearchExpressionContext.createSearchExpressionContext(facesContext, name);
componentId = facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(
searchContext, "@previous").get(0);
- Assertions.assertEquals("mainForm:labelName", componentId);
+ assertEquals("mainForm:labelName", componentId);
componentId = facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(
searchContext, "@next").get(0);
- Assertions.assertEquals("mainForm:msgName", componentId);
+ assertEquals("mainForm:msgName", componentId);
componentId = facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(
searchContext, "@parent:@id(msgName)").get(0);
- Assertions.assertEquals("mainForm:msgName", componentId);
+ assertEquals("mainForm:msgName", componentId);
componentId = facesContext.getApplication().getSearchExpressionHandler().resolveClientIds(
searchContext, "topLevelOutputText").get(0);
- Assertions.assertEquals("topLevelOutputText", componentId);
+ assertEquals("topLevelOutputText", componentId);
facesContext.getViewRoot().invokeOnComponent(facesContext, "mainForm:table:3:nested:1:nestedButton",
new ContextCallback()
@@ -135,25 +134,25 @@ public void invokeContextCallback(FacesContext context, UIComponent target)
SearchExpressionContext searchContext =
SearchExpressionContext.createSearchExpressionContext(context, target);
String componentId = handler.resolveClientIds(searchContext, "mainForm:showName").get(0);
- Assertions.assertEquals("mainForm:showName", componentId);
+ assertEquals("mainForm:showName", componentId);
componentId = handler.resolveClientIds(searchContext, "nested:nestedText").get(0);
- Assertions.assertEquals("mainForm:table:3:nested:1:nestedText", componentId);
+ assertEquals("mainForm:table:3:nested:1:nestedText", componentId);
componentId = handler.resolveClientIds(searchContext, "table:baseText").get(0);
- Assertions.assertEquals("mainForm:table:3:baseText", componentId);
+ assertEquals("mainForm:table:3:baseText", componentId);
componentId = handler.resolveClientIds(searchContext, "table:0:baseText").get(0);
- Assertions.assertEquals("mainForm:table:0:baseText", componentId);
+ assertEquals("mainForm:table:0:baseText", componentId);
componentId = handler.resolveClientIds(searchContext, "nested:0:nestedText").get(0);
- Assertions.assertEquals("mainForm:table:3:nested:0:nestedText", componentId);
+ assertEquals("mainForm:table:3:nested:0:nestedText", componentId);
componentId = handler.resolveClientIds(searchContext, "table:nested").get(0);
- Assertions.assertEquals("mainForm:table:3:nested", componentId);
+ assertEquals("mainForm:table:3:nested", componentId);
componentId = handler.resolveClientIds(searchContext, "table:1:nested:0:nestedText").get(0);
- Assertions.assertEquals("mainForm:table:1:nested:0:nestedText", componentId);
+ assertEquals("mainForm:table:1:nested:0:nestedText", componentId);
//System.out.println(componentId);
}
@@ -168,7 +167,7 @@ public void invokeContextCallback(FacesContext context, UIComponent target)
SearchExpressionHandler handler = facesContext.getApplication().getSearchExpressionHandler();
SearchExpressionContext searchContext =
SearchExpressionContext.createSearchExpressionContext(context, target);
- Assertions.assertEquals(handler.resolveClientId(searchContext, "@next"), "mainForm:table:3:nestedText");
+ assertEquals("mainForm:table:3:nestedText", handler.resolveClientId(searchContext, "@next"));
}
});
@@ -176,7 +175,7 @@ public void invokeContextCallback(FacesContext context, UIComponent target)
}
@Test
- public void testSearchExpressionIdKeyword() throws Exception
+ void searchExpressionIdKeyword() throws Exception
{
startViewRequest("/search1.xhtml");
processLifecycleExecute();
@@ -188,13 +187,13 @@ public void testSearchExpressionIdKeyword() throws Exception
SearchExpressionHandler handler = facesContext.getApplication().getSearchExpressionHandler();
- Assertions.assertEquals("panelGridId", handler.resolveClientId(searchContext, "mainForm:@parent"));
+ assertEquals("panelGridId", handler.resolveClientId(searchContext, "mainForm:@parent"));
processRemainingPhases();
}
-
+
@Test
- public void testResolveComponent() throws Exception
+ void resolveComponent() throws Exception
{
startViewRequest("/search1.xhtml");
processLifecycleExecute();
@@ -208,13 +207,13 @@ public void testResolveComponent() throws Exception
facesContext.getApplication().getSearchExpressionHandler().resolveComponent(
searchContext, "@id(name)", callback);
- Assertions.assertEquals(1, callback.getComponents().size());
+ assertEquals(1, callback.getComponents().size());
processRemainingPhases();
}
-
+
@Test
- public void testResolveComponents() throws Exception
+ void resolveComponents() throws Exception
{
startViewRequest("/search1.xhtml");
processLifecycleExecute();
@@ -228,7 +227,7 @@ public void testResolveComponents() throws Exception
facesContext.getApplication().getSearchExpressionHandler().resolveComponents(
searchContext, " @id(name) @none ", callback);
- Assertions.assertEquals(2, callback.getComponents().size());
+ assertEquals(2, callback.getComponents().size());
processRemainingPhases();
}
@@ -248,9 +247,9 @@ public ArrayList getComponents()
return components;
}
}
-
+
@Test
- public void testResolveClientId1() throws Exception
+ void resolveClientId1() throws Exception
{
startViewRequest("/search1.xhtml");
processLifecycleExecute();
@@ -267,7 +266,7 @@ public void testResolveClientId1() throws Exception
SearchExpressionContext.createSearchExpressionContext(facesContext, out, expressionHints, null);
String clientId = handler.resolveClientId(searchContextWithIgnoreNoResult, "@none");
- Assertions.assertNull(clientId);
+ assertNull(clientId);
SearchExpressionContext searchContext =
SearchExpressionContext.createSearchExpressionContext(facesContext, out);
@@ -275,16 +274,16 @@ public void testResolveClientId1() throws Exception
try
{
clientId = handler.resolveClientId(searchContext, "@none");
- Assertions.fail();
+ fail();
}
catch (ComponentNotFoundException e)
{
//No op
}
}
-
+
@Test
- public void testResolveClientIds1() throws Exception
+ void resolveClientIds1() throws Exception
{
startViewRequest("/search1.xhtml");
processLifecycleExecute();
@@ -300,7 +299,7 @@ public void testResolveClientIds1() throws Exception
SearchExpressionContext.createSearchExpressionContext(facesContext, out, expressionHints, null);
List clientId = handler.resolveClientIds(searchContextWithIgnoreNoResult, "@none");
- Assertions.assertTrue(clientId.isEmpty());
+ assertTrue(clientId.isEmpty());
SearchExpressionContext searchContext =
SearchExpressionContext.createSearchExpressionContext(facesContext, out);
@@ -308,7 +307,7 @@ public void testResolveClientIds1() throws Exception
try
{
clientId = handler.resolveClientIds(searchContext, "@none");
- Assertions.fail();
+ fail();
}
catch (ComponentNotFoundException e)
{
@@ -317,7 +316,7 @@ public void testResolveClientIds1() throws Exception
}
@Test
- public void testIsValid() throws Exception
+ void isValid() throws Exception
{
startViewRequest("/search1.xhtml");
processLifecycleExecute();
@@ -328,35 +327,35 @@ public void testIsValid() throws Exception
SearchExpressionContext.createSearchExpressionContext(facesContext, null);
SearchExpressionHandler handler = facesContext.getApplication().getSearchExpressionHandler();
- Assertions.assertTrue(handler.isValidExpression(searchContext, "mainForm:showName"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "mainForm:table:3:nested:1:nestedText"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "mainForm:table:3:baseText"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, " mainForm:table:0:baseText"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "mainForm:table:3:nested:0:nestedText"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "mainForm:table:3:nested"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "mainForm:table:1:nested:0:nestedText"));
-
- Assertions.assertTrue(handler.isValidExpression(searchContext, " "));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "@this"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "@this:@parent:showName"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "@parent:showName:@parent:showName "));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "@form:showName"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "@namingcontainer:showName"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "@previous"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "@next"));
- Assertions.assertTrue(handler.isValidExpression(searchContext, "@parent:@id(msgName)"));
-
- Assertions.assertFalse(handler.isValidExpression(searchContext, "@whoNows"));
- Assertions.assertFalse(handler.isValidExpression(searchContext, "@parent:@whoNows"));
- Assertions.assertFalse(handler.isValidExpression(searchContext, "mainForm:@whoNows"));
- Assertions.assertFalse(handler.isValidExpression(searchContext, "!whoNows"));
-
- Assertions.assertFalse(handler.isValidExpression(searchContext, "@none:@parent"));
- Assertions.assertFalse(handler.isValidExpression(searchContext, "@all:@parent"));
+ assertTrue(handler.isValidExpression(searchContext, "mainForm:showName"));
+ assertTrue(handler.isValidExpression(searchContext, "mainForm:table:3:nested:1:nestedText"));
+ assertTrue(handler.isValidExpression(searchContext, "mainForm:table:3:baseText"));
+ assertTrue(handler.isValidExpression(searchContext, " mainForm:table:0:baseText"));
+ assertTrue(handler.isValidExpression(searchContext, "mainForm:table:3:nested:0:nestedText"));
+ assertTrue(handler.isValidExpression(searchContext, "mainForm:table:3:nested"));
+ assertTrue(handler.isValidExpression(searchContext, "mainForm:table:1:nested:0:nestedText"));
+
+ assertTrue(handler.isValidExpression(searchContext, " "));
+ assertTrue(handler.isValidExpression(searchContext, "@this"));
+ assertTrue(handler.isValidExpression(searchContext, "@this:@parent:showName"));
+ assertTrue(handler.isValidExpression(searchContext, "@parent:showName:@parent:showName "));
+ assertTrue(handler.isValidExpression(searchContext, "@form:showName"));
+ assertTrue(handler.isValidExpression(searchContext, "@namingcontainer:showName"));
+ assertTrue(handler.isValidExpression(searchContext, "@previous"));
+ assertTrue(handler.isValidExpression(searchContext, "@next"));
+ assertTrue(handler.isValidExpression(searchContext, "@parent:@id(msgName)"));
+
+ assertFalse(handler.isValidExpression(searchContext, "@whoNows"));
+ assertFalse(handler.isValidExpression(searchContext, "@parent:@whoNows"));
+ assertFalse(handler.isValidExpression(searchContext, "mainForm:@whoNows"));
+ assertFalse(handler.isValidExpression(searchContext, "!whoNows"));
+
+ assertFalse(handler.isValidExpression(searchContext, "@none:@parent"));
+ assertFalse(handler.isValidExpression(searchContext, "@all:@parent"));
}
-
+
@Test
- public void testIsPassthroughExpression() throws Exception
+ void isPassthroughExpression() throws Exception
{
startViewRequest("/search1.xhtml");
processLifecycleExecute();
@@ -367,41 +366,41 @@ public void testIsPassthroughExpression() throws Exception
SearchExpressionContext.createSearchExpressionContext(facesContext, null);
SearchExpressionHandler handler = facesContext.getApplication().getSearchExpressionHandler();
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:showName"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:3:nested:1:nestedText"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:3:baseText"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:0:baseText"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:3:nested:0:nestedText"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:3:nested"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:1:nested:0:nestedText"));
-
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "@this"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "@this:@parent:showName"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "@parent:showName:@parent:showName"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "@form"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "@form:showName"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "@namingcontainer:showName"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "@previous"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "@next"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "@parent:@id(msgName)"));
-
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "@whoNows"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "@parent:@whoNows"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:@whoNows"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContext, "!whoNows"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:showName"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:3:nested:1:nestedText"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:3:baseText"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:0:baseText"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:3:nested:0:nestedText"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:3:nested"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:table:1:nested:0:nestedText"));
+
+ assertFalse(handler.isPassthroughExpression(searchContext, "@this"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "@this:@parent:showName"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "@parent:showName:@parent:showName"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "@form"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "@form:showName"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "@namingcontainer:showName"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "@previous"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "@next"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "@parent:@id(msgName)"));
+
+ assertFalse(handler.isPassthroughExpression(searchContext, "@whoNows"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "@parent:@whoNows"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "mainForm:@whoNows"));
+ assertFalse(handler.isPassthroughExpression(searchContext, "!whoNows"));
Set expressionHints = new HashSet<>();
expressionHints.add(SearchExpressionHint.RESOLVE_CLIENT_SIDE);
SearchExpressionContext searchContextWithAjaxResolve =
SearchExpressionContext.createSearchExpressionContext(facesContext, null, expressionHints, null);
- Assertions.assertTrue(handler.isPassthroughExpression(searchContextWithAjaxResolve, "@form"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContextWithAjaxResolve, "@form:showName"));
- Assertions.assertFalse(handler.isPassthroughExpression(searchContextWithAjaxResolve, "@form:@child(0)"));
+ assertTrue(handler.isPassthroughExpression(searchContextWithAjaxResolve, "@form"));
+ assertFalse(handler.isPassthroughExpression(searchContextWithAjaxResolve, "@form:showName"));
+ assertFalse(handler.isPassthroughExpression(searchContextWithAjaxResolve, "@form:@child(0)"));
}
@Test
- public void testMyFaces4695() throws Exception
+ void myFaces4695() throws Exception
{
startViewRequest("/search2.xhtml");
processLifecycleExecute();
@@ -413,7 +412,7 @@ public void testMyFaces4695() throws Exception
SearchExpressionHandler handler = facesContext.getApplication().getSearchExpressionHandler();
- Assertions.assertEquals("form1:one", handler.resolveClientId(searchContext, "form1:one"));
+ assertEquals("form1:one", handler.resolveClientId(searchContext, "form1:one"));
processRemainingPhases();
}
@@ -422,7 +421,7 @@ public void testMyFaces4695() throws Exception
* Regression test for MYFACES-4764.
*/
@Test
- public void testMyFaces4764() throws Exception
+ void myFaces4764() throws Exception
{
startViewRequest("/search_myfaces4764.xhtml");
processLifecycleExecute();
@@ -432,11 +431,11 @@ public void testMyFaces4764() throws Exception
SearchExpressionHandler handler = facesContext.getApplication().getSearchExpressionHandler();
UIComponent body = facesContext.getViewRoot().findComponent("body");
- Assertions.assertNotNull(body, "body component must exist");
+ assertNotNull(body, "body component must exist");
SearchExpressionContext ctx1 = SearchExpressionContext.createSearchExpressionContext(facesContext, body);
- Assertions.assertEquals("first", handler.resolveClientId(ctx1, "@child(1)"),
+ assertEquals("first", handler.resolveClientId(ctx1, "@child(1)"),
"@child(1) must resolve to 'first'");
processRemainingPhases();
diff --git a/impl/src/test/java/org/apache/myfaces/component/visit/PartialVisitContextTest.java b/impl/src/test/java/org/apache/myfaces/component/visit/PartialVisitContextTest.java
index 573ea2197f..64a63fe552 100644
--- a/impl/src/test/java/org/apache/myfaces/component/visit/PartialVisitContextTest.java
+++ b/impl/src/test/java/org/apache/myfaces/component/visit/PartialVisitContextTest.java
@@ -28,19 +28,22 @@
import jakarta.faces.component.visit.VisitResult;
import jakarta.faces.context.FacesContext;
import org.apache.myfaces.test.base.junit.AbstractFacesConfigurableMockTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
-public class PartialVisitContextTest extends AbstractFacesConfigurableMockTestCase {
+class PartialVisitContextTest extends AbstractFacesConfigurableMockTestCase {
@Test
- public void test() {
+ void test() {
PartialVisitContext visitContext = new PartialVisitContext(facesContext,
Arrays.asList("form", "form:input", "form"),
@@ -81,9 +84,9 @@ public VisitResult visit(VisitContext context, UIComponent target) {
});
// only the the form is visited and only once, it will itself visit the child input
- Assertions.assertEquals(1, visitedComponents.size());
- Assertions.assertTrue(visitedComponents.contains(form));
+ assertEquals(1, visitedComponents.size());
+ assertTrue(visitedComponents.contains(form));
- Assertions.assertTrue(processValidatorsOfInputInvoked.get());
+ assertTrue(processValidatorsOfInputInvoked.get());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/config/ConfigFilesXmlValidationUtilsTestCase.java b/impl/src/test/java/org/apache/myfaces/config/ConfigFilesXmlValidationUtilsTestCase.java
index 6a75193b10..5e6ae957e1 100644
--- a/impl/src/test/java/org/apache/myfaces/config/ConfigFilesXmlValidationUtilsTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/config/ConfigFilesXmlValidationUtilsTestCase.java
@@ -19,9 +19,10 @@
package org.apache.myfaces.config;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.net.URL;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.xml.sax.SAXException;
@@ -29,11 +30,11 @@
*
* @author lu4242
*/
-public class ConfigFilesXmlValidationUtilsTestCase extends AbstractFacesTestCase
+class ConfigFilesXmlValidationUtilsTestCase extends AbstractFacesTestCase
{
@Test
- public void testCurrentStandardJSFFacesConfig() throws Exception
+ void currentStandardJSFFacesConfig() throws Exception
{
URL url = getClass().getResource("/META-INF/standard-faces-config.xml");
ConfigFilesXmlValidationUtils.validateFacesConfigFile(
@@ -41,7 +42,7 @@ public void testCurrentStandardJSFFacesConfig() throws Exception
}
@Test
- public void testJSF11Config1() throws Exception
+ void jsf11Config1() throws Exception
{
URL url = getClass().getResource("a-config.xml");
ConfigFilesXmlValidationUtils.validateFacesConfigFile(
@@ -49,14 +50,14 @@ public void testJSF11Config1() throws Exception
}
@Test
- public void testJSFInvalidConfig1() throws Exception
+ void jsfInvalidConfig1() throws Exception
{
try
{
URL url = getClass().getResource("invalid-config_1.xml");
ConfigFilesXmlValidationUtils.validateFacesConfigFile(
url , externalContext, ConfigFilesXmlValidationUtils.getFacesConfigVersion(url));
- Assertions.fail();
+ fail();
}
catch (SAXException e)
{
@@ -67,32 +68,32 @@ public void testJSFInvalidConfig1() throws Exception
/*
* The four testJSFXXConfig tests below were added under MYFACES-4363
*/
- @Test
- public void testJSF22Config() throws Exception
+ @Test
+ void jsf22Config() throws Exception
{
URL url = getClass().getResource("jsf22-faces-config.xml");
ConfigFilesXmlValidationUtils.validateFacesConfigFile(
url , externalContext, ConfigFilesXmlValidationUtils.getFacesConfigVersion(url));
}
- @Test
- public void testJSF23Config() throws Exception
+ @Test
+ void jsf23Config() throws Exception
{
URL url = getClass().getResource("jsf23-faces-config.xml");
ConfigFilesXmlValidationUtils.validateFacesConfigFile(
url , externalContext, ConfigFilesXmlValidationUtils.getFacesConfigVersion(url));
}
- @Test
- public void testJSF30Config() throws Exception
+ @Test
+ void jsf30Config() throws Exception
{
URL url = getClass().getResource("jsf30-faces-config.xml");
ConfigFilesXmlValidationUtils.validateFacesConfigFile(
url , externalContext, ConfigFilesXmlValidationUtils.getFacesConfigVersion(url));
}
- @Test
- public void testJSF40Config() throws Exception
+ @Test
+ void jsf40Config() throws Exception
{
URL url = getClass().getResource("jsf40-faces-config.xml");
ConfigFilesXmlValidationUtils.validateFacesConfigFile(
diff --git a/impl/src/test/java/org/apache/myfaces/config/FacesConfigValidatorTestCase.java b/impl/src/test/java/org/apache/myfaces/config/FacesConfigValidatorTestCase.java
index 8844140a81..4dd1469e67 100644
--- a/impl/src/test/java/org/apache/myfaces/config/FacesConfigValidatorTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/config/FacesConfigValidatorTestCase.java
@@ -17,6 +17,8 @@
package org.apache.myfaces.config;
+import static org.junit.jupiter.api.Assertions.assertSame;
+
import java.io.ByteArrayInputStream;
import java.util.Collection;
import java.util.List;
@@ -26,11 +28,10 @@
import org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl;
import org.apache.myfaces.config.impl.element.FacesConfigImpl;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class FacesConfigValidatorTestCase extends AbstractFacesTestCase
+class FacesConfigValidatorTestCase extends AbstractFacesTestCase
{
private FacesConfigDispenser dispenser;
private FacesConfigUnmarshaller unmarshaller;
@@ -54,15 +55,15 @@ public void setUp() throws Exception
}
}
-
+
@Test
- public void testVerifyExistence(){
+ void verifyExistence(){
Collection navRules = dispenser.getNavigationRules();
List list = FacesConfigValidator.validate(navRules, externalContext);
- Assertions.assertSame(2, list.size());
+ assertSame(2, list.size());
}
diff --git a/impl/src/test/java/org/apache/myfaces/config/FacesConfiguratorDefaultValidatorsTestCase.java b/impl/src/test/java/org/apache/myfaces/config/FacesConfiguratorDefaultValidatorsTestCase.java
index da87b480f0..85028353a3 100644
--- a/impl/src/test/java/org/apache/myfaces/config/FacesConfiguratorDefaultValidatorsTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/config/FacesConfiguratorDefaultValidatorsTestCase.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.config;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.lang.reflect.Field;
import java.util.HashMap;
@@ -37,7 +40,6 @@
import org.apache.myfaces.util.lang.Lazy;
import org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -132,7 +134,7 @@ private void _setBeanValidationAvailable(boolean available)
* In this case the bean validator should be installed as a default validator.
*/
@Test
- public void testDefaultBeanValidatorDisabledButPresentInFacesConfig()
+ void defaultBeanValidatorDisabledButPresentInFacesConfig()
{
// remove existing RenderKit installations
_cleanRenderKits();
@@ -158,10 +160,10 @@ public void testDefaultBeanValidatorDisabledButPresentInFacesConfig()
// the bean validator has to be installed, because
// of the entry in default-bean-validator.xml
- Assertions.assertTrue(application.getDefaultValidatorInfo()
+ assertTrue(application.getDefaultValidatorInfo()
.containsKey(BeanValidator.VALIDATOR_ID));
}
-
+
/**
* Tests the case when bean validation is available, but adding the BeanValidator
* as a default validator has been disabled via the config parameter and there
@@ -169,7 +171,7 @@ public void testDefaultBeanValidatorDisabledButPresentInFacesConfig()
* In this case the BeanValidator mustn't be installed.
*/
@Test
- public void testDefaultBeanValidatorDisabled()
+ void defaultBeanValidatorDisabled()
{
// remove existing RenderKit installations
_cleanRenderKits();
@@ -192,16 +194,16 @@ public void testDefaultBeanValidatorDisabled()
// the bean validator must not be installed, because it
// has been disabled and there is no entry in the faces-config
// that would install it manually.
- Assertions.assertFalse(application.getDefaultValidatorInfo()
+ assertFalse(application.getDefaultValidatorInfo()
.containsKey(BeanValidator.VALIDATOR_ID));
}
-
+
/**
* Tests the case that bean validation is not available in the classpath.
* In this case the BeanValidator must not be installed.
*/
@Test
- public void testBeanValidationNotAvailable()
+ void beanValidationNotAvailable()
{
// remove existing RenderKit installations
_cleanRenderKits();
@@ -218,10 +220,10 @@ public void testBeanValidationNotAvailable()
// the bean validator mustn't be installed, because
// bean validation is not available in the classpath
- Assertions.assertFalse(application.getDefaultValidatorInfo()
+ assertFalse(application.getDefaultValidatorInfo()
.containsKey(BeanValidator.VALIDATOR_ID));
}
-
+
/**
* Tests the case with two config files. The first one would install the a
* default validator (in this case the RequiredValidator), but the second one
@@ -231,7 +233,7 @@ public void testBeanValidationNotAvailable()
* has to be installed (automatically) since bean validation is available.
*/
@Test
- public void testDefaultValidatorsClearedByLatterConfigFileWithEmptyElement()
+ void defaultValidatorsClearedByLatterConfigFileWithEmptyElement()
{
// remove existing RenderKit installations
_cleanRenderKits();
@@ -257,12 +259,12 @@ public void testDefaultValidatorsClearedByLatterConfigFileWithEmptyElement()
// the required validator must not be installed, because the latter config file
// (empty-default-validators.xml) has an empty default validators element
// and this clears all existing default-validators.
- Assertions.assertFalse(application.getDefaultValidatorInfo().containsKey(RequiredValidator.VALIDATOR_ID));
+ assertFalse(application.getDefaultValidatorInfo().containsKey(RequiredValidator.VALIDATOR_ID));
// and since bean validation is available, the BeanValidator has to be installed
- Assertions.assertTrue(application.getDefaultValidatorInfo().containsKey(BeanValidator.VALIDATOR_ID));
+ assertTrue(application.getDefaultValidatorInfo().containsKey(BeanValidator.VALIDATOR_ID));
}
-
+
/**
* Tests the case with two config files. The first one installs a
* default validator (in this case the RequiredValidator), and the
@@ -272,7 +274,7 @@ public void testDefaultValidatorsClearedByLatterConfigFileWithEmptyElement()
* BeanValidator must also be installed since bean validation is available.
*/
@Test
- public void testDefaultValidatorsNotClearedByLatterConfigFileWithNoElement()
+ void defaultValidatorsNotClearedByLatterConfigFileWithNoElement()
{
// remove existing RenderKit installations
_cleanRenderKits();
@@ -297,12 +299,12 @@ public void testDefaultValidatorsNotClearedByLatterConfigFileWithNoElement()
// the required validator must be installed, because the latter config file
// (no-default-validators.xml) has not got a default validators element.
- Assertions.assertTrue(application.getDefaultValidatorInfo().containsKey(RequiredValidator.VALIDATOR_ID));
+ assertTrue(application.getDefaultValidatorInfo().containsKey(RequiredValidator.VALIDATOR_ID));
// and since bean validation is available, the BeanValidator has to be installed
- Assertions.assertTrue(application.getDefaultValidatorInfo().containsKey(BeanValidator.VALIDATOR_ID));
+ assertTrue(application.getDefaultValidatorInfo().containsKey(BeanValidator.VALIDATOR_ID));
}
-
+
/**
* Tests the case with two config files. The first one would install a
* default validator (in this case the RequiredValidator), but the second one
@@ -313,7 +315,7 @@ public void testDefaultValidatorsNotClearedByLatterConfigFileWithNoElement()
* since bean validation is not available).
*/
@Test
- public void testDefaultValidatorsOverwrittenByLatterConfigFile()
+ void defaultValidatorsOverwrittenByLatterConfigFile()
{
// remove existing RenderKit installations
_cleanRenderKits();
@@ -339,14 +341,14 @@ public void testDefaultValidatorsOverwrittenByLatterConfigFile()
// the required validator must not be installed, because the latter config file
// (default-length-validator.xml) specifies a default validators element
// and this clears all existing default-validators.
- Assertions.assertFalse(application.getDefaultValidatorInfo().containsKey(RequiredValidator.VALIDATOR_ID));
+ assertFalse(application.getDefaultValidatorInfo().containsKey(RequiredValidator.VALIDATOR_ID));
// the length validator has to be installed, because it was installed
// by the latter config file
- Assertions.assertTrue(application.getDefaultValidatorInfo().containsKey(LengthValidator.VALIDATOR_ID));
+ assertTrue(application.getDefaultValidatorInfo().containsKey(LengthValidator.VALIDATOR_ID));
// and since bean validation is not available, the BeanValidator must not be installed
- Assertions.assertFalse(application.getDefaultValidatorInfo().containsKey(BeanValidator.VALIDATOR_ID));
+ assertFalse(application.getDefaultValidatorInfo().containsKey(BeanValidator.VALIDATOR_ID));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/config/LogMetaInfUtilsTestCase.java b/impl/src/test/java/org/apache/myfaces/config/LogMetaInfUtilsTestCase.java
index e61aadeb43..0b30d1906a 100644
--- a/impl/src/test/java/org/apache/myfaces/config/LogMetaInfUtilsTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/config/LogMetaInfUtilsTestCase.java
@@ -22,16 +22,19 @@
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import java.net.URL;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class LogMetaInfUtilsTestCase extends AbstractFacesTestCase
+class LogMetaInfUtilsTestCase extends AbstractFacesTestCase
{
@Test
- public void testVersionNumber() throws Exception
+ void versionNumber() throws Exception
{
// tests single digits
@@ -52,27 +55,27 @@ public void testVersionNumber() throws Exception
LogMetaInfUtils.addJarInfo(libs, new URL("file:/opt/project/tobago/tobago-example/tobago-example-demo/target/tobago-example-demo/WEB-INF/lib/slf4j-log4j12-1.6.1.jar"));
final List mf = libs.get("myfaces-api");
- Assertions.assertEquals(2, mf.size());
- Assertions.assertEquals("1.2.11-SNAPSHOT", mf.get(0).getVersion());
- Assertions.assertEquals("2", mf.get(1).getVersion());
+ assertEquals(2, mf.size());
+ assertEquals("1.2.11-SNAPSHOT", mf.get(0).getVersion());
+ assertEquals("2", mf.get(1).getVersion());
final List tk12 = libs.get("tomahawk12");
- Assertions.assertEquals(1, tk12.size());
- Assertions.assertEquals("1.1.10-SNAPSHOT", tk12.get(0).getVersion());
+ assertEquals(1, tk12.size());
+ assertEquals("1.1.10-SNAPSHOT", tk12.get(0).getVersion());
final List tksb = libs.get("tomahawk-sandbox12");
- Assertions.assertEquals(1, tksb.size());
- Assertions.assertEquals("1.1.10", tksb.get(0).getVersion());
+ assertEquals(1, tksb.size());
+ assertEquals("1.1.10", tksb.get(0).getVersion());
final List tobago = libs.get("tobago-core");
- Assertions.assertEquals(2, tobago.size());
- Assertions.assertEquals("1.5.0-alpha-3-SNAPSHOT", tobago.get(0).getVersion());
- Assertions.assertEquals("1.0.35", tobago.get(1).getVersion());
+ assertEquals(2, tobago.size());
+ assertEquals("1.5.0-alpha-3-SNAPSHOT", tobago.get(0).getVersion());
+ assertEquals("1.0.35", tobago.get(1).getVersion());
final List other = libs.get("other");
- Assertions.assertNull(other);
+ assertNull(other);
final List slf = libs.get("slf4j-log4j12");
- Assertions.assertNull(slf);
+ assertNull(slf);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/config/OrderingFacesConfigTest.java b/impl/src/test/java/org/apache/myfaces/config/OrderingFacesConfigTest.java
index 259ee66f39..c0b5d47ca6 100644
--- a/impl/src/test/java/org/apache/myfaces/config/OrderingFacesConfigTest.java
+++ b/impl/src/test/java/org/apache/myfaces/config/OrderingFacesConfigTest.java
@@ -24,13 +24,17 @@
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import jakarta.faces.FacesException;
+
import java.util.ArrayList;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -66,7 +70,7 @@ public void printFacesConfigList(String label, List appConfigResour
System.out.println("]");
}
-
+
/**
* A before others
* B after C
@@ -79,7 +83,7 @@ public void printFacesConfigList(String label, List appConfigResour
* @throws Exception
*/
@Test
- public void testSimpleOrdering() throws Exception
+ void simpleOrdering() throws Exception
{
FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
"empty-config.xml"), "empty-config.xml");
@@ -105,7 +109,7 @@ public void testSimpleOrdering() throws Exception
applyAlgorithm(appConfigResources);
}
}
-
+
/**
* A before B
* A before E
@@ -123,7 +127,7 @@ public void testSimpleOrdering() throws Exception
* @throws Exception
*/
@Test
- public void testMiddleOrdering() throws Exception
+ void middleOrdering() throws Exception
{
FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
"empty-config.xml"), "empty-config.xml");
@@ -184,7 +188,7 @@ public void testMiddleOrdering() throws Exception
applyAlgorithm(appConfigResources);
}
}
-
+
/**
* A before B
* A before C
@@ -200,7 +204,7 @@ public void testMiddleOrdering() throws Exception
* @throws Exception
*/
@Test
- public void testMaxConditionsOrdering() throws Exception
+ void maxConditionsOrdering() throws Exception
{
org.apache.myfaces.config.impl.element.FacesConfigImpl cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
"empty-config.xml"), "empty-config.xml");
@@ -248,9 +252,9 @@ public void testMaxConditionsOrdering() throws Exception
applyAlgorithm(appConfigResources);
}
}
-
+
@Test
- public void testEx1()
+ void ex1()
{
org.apache.myfaces.config.impl.element.FacesConfigImpl cfgA = new org.apache.myfaces.config.impl.element.FacesConfigImpl();
org.apache.myfaces.config.impl.element.FacesConfigImpl cfgB = new org.apache.myfaces.config.impl.element.FacesConfigImpl();
@@ -300,9 +304,9 @@ public void testEx1()
applyAlgorithm(appConfigResources);
}
}
-
+
@Test
- public void testEx2()
+ void ex2()
{
org.apache.myfaces.config.impl.element.FacesConfigImpl cfg = new org.apache.myfaces.config.impl.element.FacesConfigImpl();
org.apache.myfaces.config.impl.element.FacesConfigImpl cfgB = new org.apache.myfaces.config.impl.element.FacesConfigImpl();
@@ -347,9 +351,9 @@ public void testEx2()
applyAlgorithm(appConfigResources);
}
}
-
+
@Test
- public void testEx3()
+ void ex3()
{
org.apache.myfaces.config.impl.element.FacesConfigImpl cfgA = new org.apache.myfaces.config.impl.element.FacesConfigImpl();
org.apache.myfaces.config.impl.element.FacesConfigImpl cfgB = new org.apache.myfaces.config.impl.element.FacesConfigImpl();
@@ -383,9 +387,9 @@ public void testEx3()
applyAlgorithm(appConfigResources);
}
}
-
+
@Test
- public void testEx4() throws Exception
+ void ex4() throws Exception
{
FacesConfig cfgA = _impl.getFacesConfig(getClass().getResourceAsStream(
"transitive-a-config.xml"), "transitive-a-config.xml");
@@ -425,7 +429,7 @@ public void applyAlgorithm(List appConfigResources) throws FacesExc
}
@Test
- public void testBeforeOthers1() throws Exception
+ void beforeOthers1() throws Exception
{
FacesConfig cfgA = _impl.getFacesConfig(getClass().getResourceAsStream(
"no-name-config.xml"), "no-name-config.xml");
@@ -451,12 +455,12 @@ public void testBeforeOthers1() throws Exception
Collections.shuffle(appConfigResources);
List sortedList = applyFullAlgorithm(appConfigResources);
- Assertions.assertEquals(cfgC, sortedList.get(0));
+ assertEquals(cfgC, sortedList.get(0));
}
}
@Test
- public void testAfterOthers1() throws Exception
+ void afterOthers1() throws Exception
{
FacesConfig cfgA = _impl.getFacesConfig(getClass().getResourceAsStream(
"no-name-config.xml"), "no-name-config.xml");
@@ -482,12 +486,12 @@ public void testAfterOthers1() throws Exception
Collections.shuffle(appConfigResources);
List sortedList = applyFullAlgorithm(appConfigResources);
- Assertions.assertEquals(cfgC, sortedList.get(sortedList.size()-1));
+ assertEquals(cfgC, sortedList.get(sortedList.size()-1));
}
}
-
+
@Test
- public void testBeforeOthers2() throws Exception
+ void beforeOthers2() throws Exception
{
FacesConfig cfg1 = _impl.getFacesConfig(getClass().getResourceAsStream(
"no-name-config.xml"), "no-name-config.xml");
@@ -526,9 +530,9 @@ public void testBeforeOthers2() throws Exception
Collections.shuffle(appConfigResources);
List sortedList = applyFullAlgorithm(appConfigResources);
- Assertions.assertEquals(cfg3, sortedList.get(0));
+ assertEquals(cfg3, sortedList.get(0));
- Assertions.assertEquals(cfg6, sortedList.get(sortedList.size()-1));
+ assertEquals(cfg6, sortedList.get(sortedList.size()-1));
}
}
@@ -863,9 +867,9 @@ public void applyAlgorithm2(List appConfigResources) throws FacesEx
}
System.out.println("]");
}
-
+
@Test
- public void testAbsoluteOrdering1() throws Exception
+ void absoluteOrdering1() throws Exception
{
org.apache.myfaces.config.impl.element.FacesConfigImpl cfgAbs = new org.apache.myfaces.config.impl.element.FacesConfigImpl();
org.apache.myfaces.config.impl.element.FacesConfigImpl cfgMK = new org.apache.myfaces.config.impl.element.FacesConfigImpl();
@@ -891,7 +895,7 @@ public void testAbsoluteOrdering1() throws Exception
//printFacesConfigList("Sorted-List: [", sortedResources);
- Assertions.assertTrue(sortedResources.containsAll(appConfigResources));
+ assertTrue(sortedResources.containsAll(appConfigResources));
appConfigResources = new ArrayList();
appConfigResources.add(cfgOWB);
@@ -903,7 +907,7 @@ public void testAbsoluteOrdering1() throws Exception
//printFacesConfigList("Sorted-List: [", sortedResources);
- Assertions.assertTrue(sortedResources.containsAll(appConfigResources));
+ assertTrue(sortedResources.containsAll(appConfigResources));
}
diff --git a/impl/src/test/java/org/apache/myfaces/config/impl/FacesConfigUnmarshallerImplTest.java b/impl/src/test/java/org/apache/myfaces/config/impl/FacesConfigUnmarshallerImplTest.java
index ae1e8a2b71..033cdb42f3 100644
--- a/impl/src/test/java/org/apache/myfaces/config/impl/FacesConfigUnmarshallerImplTest.java
+++ b/impl/src/test/java/org/apache/myfaces/config/impl/FacesConfigUnmarshallerImplTest.java
@@ -15,6 +15,8 @@
*/
package org.apache.myfaces.config.impl;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.List;
import org.apache.myfaces.config.element.Application;
@@ -24,7 +26,6 @@
import org.apache.myfaces.config.element.LocaleConfig;
import org.apache.myfaces.config.element.OrderSlot;
import org.apache.myfaces.config.impl.element.ConfigOthersSlotImpl;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -32,69 +33,69 @@
* @author Mathias Broekelmann (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class FacesConfigUnmarshallerImplTest
+class FacesConfigUnmarshallerImplTest
{
private FacesConfigUnmarshallerImpl _impl;
@BeforeEach
- public void setUp() throws Exception
+ void setUp() throws Exception
{
_impl = new FacesConfigUnmarshallerImpl(null);
}
@Test
- public void testEmptyConfig() throws Exception
+ void emptyConfig() throws Exception
{
FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
"empty-config.xml"), "empty-config.xml");
- Assertions.assertNotNull(cfg);
- Assertions.assertTrue(cfg.getApplications().isEmpty());
- Assertions.assertTrue(cfg.getComponents().isEmpty());
- Assertions.assertTrue(cfg.getConverters().isEmpty());
- Assertions.assertTrue(cfg.getFactories().isEmpty());
- Assertions.assertTrue(cfg.getLifecyclePhaseListener().isEmpty());
- Assertions.assertTrue(cfg.getNavigationRules().isEmpty());
- Assertions.assertTrue(cfg.getRenderKits().isEmpty());
- Assertions.assertTrue(cfg.getValidators().isEmpty());
+ assertNotNull(cfg);
+ assertTrue(cfg.getApplications().isEmpty());
+ assertTrue(cfg.getComponents().isEmpty());
+ assertTrue(cfg.getConverters().isEmpty());
+ assertTrue(cfg.getFactories().isEmpty());
+ assertTrue(cfg.getLifecyclePhaseListener().isEmpty());
+ assertTrue(cfg.getNavigationRules().isEmpty());
+ assertTrue(cfg.getRenderKits().isEmpty());
+ assertTrue(cfg.getValidators().isEmpty());
}
@Test
- public void testApplicationConfig() throws Exception
+ void applicationConfig() throws Exception
{
FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
"application-config.xml"), "application-config.xml");
- Assertions.assertNotNull(cfg);
- Assertions.assertEquals(1, cfg.getApplications().size());
+ assertNotNull(cfg);
+ assertEquals(1, cfg.getApplications().size());
Application app = cfg.getApplications().get(0);
- Assertions.assertEquals(2, app.getActionListener().size());
- Assertions.assertEquals("action-listener1", app.getActionListener().get(0));
- Assertions.assertEquals("action-listener2", app.getActionListener().get(1));
- Assertions.assertEquals(1, app.getDefaultRenderkitId().size());
- Assertions.assertEquals("default-render-kit-id", app.getDefaultRenderkitId()
+ assertEquals(2, app.getActionListener().size());
+ assertEquals("action-listener1", app.getActionListener().get(0));
+ assertEquals("action-listener2", app.getActionListener().get(1));
+ assertEquals(1, app.getDefaultRenderkitId().size());
+ assertEquals("default-render-kit-id", app.getDefaultRenderkitId()
.get(0));
assertLocaleConfig(app.getLocaleConfig());
- Assertions.assertEquals(1, app.getMessageBundle().size());
- Assertions.assertEquals("message-bundle", app.getMessageBundle().get(0));
- Assertions.assertEquals(1, app.getNavigationHandler().size());
- Assertions.assertEquals("navigation-handler", app.getNavigationHandler().get(0));
- Assertions.assertEquals(1, app.getPropertyResolver().size());
- Assertions.assertEquals("property-resolver", app.getPropertyResolver().get(0));
+ assertEquals(1, app.getMessageBundle().size());
+ assertEquals("message-bundle", app.getMessageBundle().get(0));
+ assertEquals(1, app.getNavigationHandler().size());
+ assertEquals("navigation-handler", app.getNavigationHandler().get(0));
+ assertEquals(1, app.getPropertyResolver().size());
+ assertEquals("property-resolver", app.getPropertyResolver().get(0));
- Assertions.assertEquals(1, app.getStateManager().size());
- Assertions.assertEquals("state-manager", app.getStateManager().get(0));
+ assertEquals(1, app.getStateManager().size());
+ assertEquals("state-manager", app.getStateManager().get(0));
- Assertions.assertEquals(1, app.getVariableResolver().size());
- Assertions.assertEquals("variable-resolver", app.getVariableResolver().get(0));
+ assertEquals(1, app.getVariableResolver().size());
+ assertEquals("variable-resolver", app.getVariableResolver().get(0));
- Assertions.assertEquals(1, app.getViewHandler().size());
- Assertions.assertEquals("view-handler", app.getViewHandler().get(0));
+ assertEquals(1, app.getViewHandler().size());
+ assertEquals("view-handler", app.getViewHandler().get(0));
- Assertions.assertEquals(1, app.getElResolver().size());
- Assertions.assertEquals("el-resolver", app.getElResolver().get(0));
+ assertEquals(1, app.getElResolver().size());
+ assertEquals("el-resolver", app.getElResolver().get(0));
- Assertions.assertEquals(1, app.getResourceBundle().size());
- Assertions.assertEquals("base-name", app.getResourceBundle().get(0).getBaseName());
- Assertions.assertEquals("var", app.getResourceBundle().get(0).getVar());
+ assertEquals(1, app.getResourceBundle().size());
+ assertEquals("base-name", app.getResourceBundle().get(0).getBaseName());
+ assertEquals("var", app.getResourceBundle().get(0).getVar());
}
/**
@@ -102,68 +103,68 @@ public void testApplicationConfig() throws Exception
*/
private void assertLocaleConfig(List localeConfig)
{
- Assertions.assertEquals(1, localeConfig.size());
+ assertEquals(1, localeConfig.size());
LocaleConfig cfg = localeConfig.get(0);
- Assertions.assertEquals("aa", cfg.getDefaultLocale());
- Assertions.assertEquals(2, cfg.getSupportedLocales().size());
- Assertions.assertEquals("aa", cfg.getSupportedLocales().get(0));
- Assertions.assertEquals("bb", cfg.getSupportedLocales().get(1));
+ assertEquals("aa", cfg.getDefaultLocale());
+ assertEquals(2, cfg.getSupportedLocales().size());
+ assertEquals("aa", cfg.getSupportedLocales().get(0));
+ assertEquals("bb", cfg.getSupportedLocales().get(1));
}
-
+
@Test
- public void testAbsoluteOrderingConfig() throws Exception
+ void absoluteOrderingConfig() throws Exception
{
FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
"absolute-ordering-config.xml"), "absolute-ordering-config.xml");
- Assertions.assertNotNull(cfg);
- Assertions.assertEquals("true", cfg.getMetadataComplete());
- Assertions.assertEquals("a",cfg.getName());
+ assertNotNull(cfg);
+ assertEquals("true", cfg.getMetadataComplete());
+ assertEquals("a",cfg.getName());
List orderList = cfg.getAbsoluteOrdering().getOrderList();
- Assertions.assertEquals("b", ((FacesConfigNameSlot) orderList.get(0)).getName());
- Assertions.assertEquals("c", ((FacesConfigNameSlot) orderList.get(1)).getName());
- Assertions.assertEquals(ConfigOthersSlotImpl.class, orderList.get(2).getClass());
- Assertions.assertEquals("d", ((FacesConfigNameSlot) orderList.get(3)).getName());
+ assertEquals("b", ((FacesConfigNameSlot) orderList.get(0)).getName());
+ assertEquals("c", ((FacesConfigNameSlot) orderList.get(1)).getName());
+ assertEquals(ConfigOthersSlotImpl.class, orderList.get(2).getClass());
+ assertEquals("d", ((FacesConfigNameSlot) orderList.get(3)).getName());
- Assertions.assertTrue(cfg.getApplications().isEmpty());
- Assertions.assertTrue(cfg.getComponents().isEmpty());
- Assertions.assertTrue(cfg.getConverters().isEmpty());
- Assertions.assertTrue(cfg.getFactories().isEmpty());
- Assertions.assertTrue(cfg.getLifecyclePhaseListener().isEmpty());
- Assertions.assertTrue(cfg.getNavigationRules().isEmpty());
- Assertions.assertTrue(cfg.getRenderKits().isEmpty());
- Assertions.assertTrue(cfg.getValidators().isEmpty());
+ assertTrue(cfg.getApplications().isEmpty());
+ assertTrue(cfg.getComponents().isEmpty());
+ assertTrue(cfg.getConverters().isEmpty());
+ assertTrue(cfg.getFactories().isEmpty());
+ assertTrue(cfg.getLifecyclePhaseListener().isEmpty());
+ assertTrue(cfg.getNavigationRules().isEmpty());
+ assertTrue(cfg.getRenderKits().isEmpty());
+ assertTrue(cfg.getValidators().isEmpty());
}
-
+
@Test
- public void testOrderingConfig() throws Exception
+ void orderingConfig() throws Exception
{
FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
"ordering-config.xml"), "ordering-config.xml");
- Assertions.assertNotNull(cfg);
- Assertions.assertEquals("a",cfg.getName());
+ assertNotNull(cfg);
+ assertEquals("a",cfg.getName());
List orderList = cfg.getOrdering().getBeforeList();
- Assertions.assertEquals("b", ((FacesConfigNameSlot) orderList.get(0)).getName());
- Assertions.assertEquals("c", ((FacesConfigNameSlot) orderList.get(1)).getName());
- Assertions.assertEquals(org.apache.myfaces.config.impl.element.ConfigOthersSlotImpl.class, orderList.get(2).getClass());
+ assertEquals("b", ((FacesConfigNameSlot) orderList.get(0)).getName());
+ assertEquals("c", ((FacesConfigNameSlot) orderList.get(1)).getName());
+ assertEquals(org.apache.myfaces.config.impl.element.ConfigOthersSlotImpl.class, orderList.get(2).getClass());
orderList = cfg.getOrdering().getAfterList();
- Assertions.assertEquals("d", ((FacesConfigNameSlot) orderList.get(0)).getName());
+ assertEquals("d", ((FacesConfigNameSlot) orderList.get(0)).getName());
- Assertions.assertTrue(cfg.getApplications().isEmpty());
- Assertions.assertTrue(cfg.getComponents().isEmpty());
- Assertions.assertTrue(cfg.getConverters().isEmpty());
- Assertions.assertTrue(cfg.getFactories().isEmpty());
- Assertions.assertTrue(cfg.getLifecyclePhaseListener().isEmpty());
- Assertions.assertTrue(cfg.getNavigationRules().isEmpty());
- Assertions.assertTrue(cfg.getRenderKits().isEmpty());
- Assertions.assertTrue(cfg.getValidators().isEmpty());
+ assertTrue(cfg.getApplications().isEmpty());
+ assertTrue(cfg.getComponents().isEmpty());
+ assertTrue(cfg.getConverters().isEmpty());
+ assertTrue(cfg.getFactories().isEmpty());
+ assertTrue(cfg.getLifecyclePhaseListener().isEmpty());
+ assertTrue(cfg.getNavigationRules().isEmpty());
+ assertTrue(cfg.getRenderKits().isEmpty());
+ assertTrue(cfg.getValidators().isEmpty());
}
-
+
@Test
- public void testFacesFlowConfig() throws Exception
+ void facesFlowConfig() throws Exception
{/*
FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
"faces-flow.xml"), "faces-flow.xml");
@@ -231,54 +232,54 @@ public void testFacesFlowConfig() throws Exception
Assertions.assertEquals("name1", facesFlowParameter.getName());
Assertions.assertEquals("value1", facesFlowParameter.getValue());*/
}
-
+
@Test
- public void testCsrf() throws Exception
+ void csrf() throws Exception
{
FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
"csrf-and-contracts.xml"), "csrf-and-contracts.xml");
- Assertions.assertNotNull(cfg);
- Assertions.assertEquals(2, cfg.getProtectedViewsUrlPatternList().size());
- Assertions.assertEquals("/files/*.xhtml", cfg.getProtectedViewsUrlPatternList().get(0));
- Assertions.assertEquals("/files2/*.xhtml", cfg.getProtectedViewsUrlPatternList().get(1));
+ assertNotNull(cfg);
+ assertEquals(2, cfg.getProtectedViewsUrlPatternList().size());
+ assertEquals("/files/*.xhtml", cfg.getProtectedViewsUrlPatternList().get(0));
+ assertEquals("/files2/*.xhtml", cfg.getProtectedViewsUrlPatternList().get(1));
}
-
+
@Test
- public void testContracts() throws Exception
+ void contracts() throws Exception
{
FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
"csrf-and-contracts.xml"), "csrf-and-contracts.xml");
- Assertions.assertNotNull(cfg);
+ assertNotNull(cfg);
Application app = cfg.getApplications().get(0);
- Assertions.assertNotNull(app);
- Assertions.assertEquals(1, app.getResourceLibraryContractMappings().size());
+ assertNotNull(app);
+ assertEquals(1, app.getResourceLibraryContractMappings().size());
ContractMapping mapping = app.getResourceLibraryContractMappings().get(0);
- Assertions.assertEquals("/files/*.xhtml", mapping.getUrlPatternList().get(0));
- Assertions.assertEquals("contractA contractB", mapping.getContractList().get(0));
+ assertEquals("/files/*.xhtml", mapping.getUrlPatternList().get(0));
+ assertEquals("contractA contractB", mapping.getContractList().get(0));
}
-
+
@Test
- public void testContracts2() throws Exception
+ void contracts2() throws Exception
{
FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
"contracts2.xml"), "contracts2.xml");
- Assertions.assertNotNull(cfg);
+ assertNotNull(cfg);
Application app = cfg.getApplications().get(0);
- Assertions.assertNotNull(app);
- Assertions.assertEquals(1, app.getResourceLibraryContractMappings().size());
+ assertNotNull(app);
+ assertEquals(1, app.getResourceLibraryContractMappings().size());
ContractMapping mapping = app.getResourceLibraryContractMappings().get(0);
- Assertions.assertTrue(mapping.getUrlPatternList().contains("/files/*.xhtml"));
- Assertions.assertTrue(mapping.getUrlPatternList().contains("/files2/*.xhtml"));
- Assertions.assertTrue(mapping.getContractList().contains("contractA"));
- Assertions.assertTrue(mapping.getContractList().contains("contractB"));
+ assertTrue(mapping.getUrlPatternList().contains("/files/*.xhtml"));
+ assertTrue(mapping.getUrlPatternList().contains("/files2/*.xhtml"));
+ assertTrue(mapping.getContractList().contains("contractA"));
+ assertTrue(mapping.getContractList().contains("contractB"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/context/ContextRegexpTest.java b/impl/src/test/java/org/apache/myfaces/context/ContextRegexpTest.java
index 6dd8de4580..5d5f3c5dbe 100644
--- a/impl/src/test/java/org/apache/myfaces/context/ContextRegexpTest.java
+++ b/impl/src/test/java/org/apache/myfaces/context/ContextRegexpTest.java
@@ -15,7 +15,9 @@
*/
package org.apache.myfaces.context;
-import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import org.junit.jupiter.api.Test;
/**
@@ -24,29 +26,26 @@
* @author Werner Punz(latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class ContextRegexpTest {
+class ContextRegexpTest {
static final String RE_SPLITTER = "[\\s\\t\\r\\n]*\\,[\\s\\t\\r\\n]*";
-
-
-
/**
* condition valid string
*/
@Test
- public void testCondition1() {
+ void condition1() {
String[] splitted = " hello ,world \n ,bla ".split(RE_SPLITTER);
splitted[0] = splitted[0].trim();
int len = splitted.length-1;
if(len > 0) {//all others trimmed by the re
splitted[len] = splitted[len].trim();
}
- Assertions.assertTrue(splitted.length == 3);
- Assertions.assertTrue(splitted[0].trim().equals("hello"));
- Assertions.assertTrue(splitted[1].trim().equals("world"));
- Assertions.assertTrue(splitted[2].trim().equals("bla"));
+ assertEquals(3, splitted.length);
+ assertEquals("hello", splitted[0].trim());
+ assertEquals("world", splitted[1].trim());
+ assertEquals("bla", splitted[2].trim());
}
/**
@@ -54,10 +53,10 @@ public void testCondition1() {
* empty string
*/
@Test
- public void testCondition2() {
+ void condition2() {
String[] splitted = " ".split(RE_SPLITTER);
- Assertions.assertTrue(splitted.length == 1);
- Assertions.assertTrue(splitted[0] != null);
+ assertEquals(1, splitted.length);
+ assertTrue(splitted[0] != null);
}
/**
@@ -65,9 +64,9 @@ public void testCondition2() {
* empty string no blanks
*/
@Test
- public void testCondition3() {
+ void condition3() {
String[] splitted = "".split(RE_SPLITTER);
- Assertions.assertTrue(splitted.length == 1);
- Assertions.assertTrue(splitted[0] != null);
+ assertEquals(1, splitted.length);
+ assertTrue(splitted[0] != null);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java b/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java
index d724a92859..5cf2504e8b 100644
--- a/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java
@@ -16,6 +16,9 @@
package org.apache.myfaces.context;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.HashMap;
import java.util.Map;
@@ -25,7 +28,6 @@
import org.apache.myfaces.context.servlet.FacesContextImpl;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -34,7 +36,7 @@
* @author Werner Punz(latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class ExecutePhaseClientIdsTest extends AbstractFacesTestCase {
+class ExecutePhaseClientIdsTest extends AbstractFacesTestCase {
@Override
@BeforeEach
@@ -50,8 +52,8 @@ public void setUp() throws Exception {
* Empty String as request param
* has to result in an empty list
*/
- @Test
- public void testRequestParams1() {
+ @Test
+ void requestParams1() {
String empty = " \n \t ";
Map requestParamMap = new HashMap();
requestParamMap.put(PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME, empty);
@@ -61,14 +63,14 @@ public void testRequestParams1() {
PartialViewContext pprContext = context.getPartialViewContext();
- Assertions.assertTrue(pprContext.getExecuteIds().isEmpty());
+ assertTrue(pprContext.getExecuteIds().isEmpty());
}
/**
* no request param, has to result in an empty list
*/
@Test
- public void testRequestParams2() {
+ void requestParams2() {
Map requestParamMap = new HashMap();
ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);
@@ -76,7 +78,7 @@ public void testRequestParams2() {
PartialViewContext pprContext = context.getPartialViewContext();
- Assertions.assertTrue(pprContext.getExecuteIds().isEmpty());
+ assertTrue(pprContext.getExecuteIds().isEmpty());
}
/**
@@ -100,7 +102,7 @@ public void testRequestParams4() {
* list with one element has to result in a list with one element
*/
@Test
- public void testRequestParams5() {
+ void requestParams5() {
String params = " view1:panel1:_component1 ";
Map requestParamMap = new HashMap();
requestParamMap.put(PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME, params);
@@ -110,8 +112,8 @@ public void testRequestParams5() {
PartialViewContext pprContext = context.getPartialViewContext();
- Assertions.assertTrue(pprContext.getExecuteIds().size() == 1);
- Assertions.assertTrue(pprContext.getExecuteIds().iterator().next().equals("view1:panel1:_component1"));
+ assertEquals(1, pprContext.getExecuteIds().size());
+ assertEquals("view1:panel1:_component1", pprContext.getExecuteIds().iterator().next());
}
/**
@@ -119,7 +121,7 @@ public void testRequestParams5() {
* blank chars
*/
@Test
- public void testRequestParams6() {
+ void requestParams6() {
String params = " view1:panel1:_component1 view1:panel1:_component2 \n component3 component4 ";
Map requestParamMap = new HashMap();
requestParamMap.put(PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME, params);
@@ -128,8 +130,8 @@ public void testRequestParams6() {
FacesContext context = new FacesContextImpl(servletContext, wrapper, response);
PartialViewContext pprContext = context.getPartialViewContext();
-
- Assertions.assertTrue(pprContext.getExecuteIds().size() == 4);
+
+ assertEquals(4, pprContext.getExecuteIds().size());
// FIXME: Latest spec uses a Collection so order is not guaranteed
// Assertions.assertTrue("Value match", pprContext.getExecuteIds().get(0).equals("view1:panel1:_component1"));
@@ -143,7 +145,7 @@ public void testRequestParams6() {
* a single, implausibly long execute id must not be expanded.
*/
@Test
- public void testOverlongClientIdIsRejected() {
+ void overlongClientIdIsRejected() {
StringBuilder colons = new StringBuilder();
for (int i = 0; i < 100000; i++) {
colons.append(':');
@@ -156,7 +158,7 @@ public void testOverlongClientIdIsRejected() {
PartialViewContext pprContext = context.getPartialViewContext();
- Assertions.assertTrue(pprContext.getExecuteIds().isEmpty());
+ assertTrue(pprContext.getExecuteIds().isEmpty());
}
/**
@@ -164,7 +166,7 @@ public void testOverlongClientIdIsRejected() {
* length-bounded too, otherwise it bypasses the execute-id cap.
*/
@Test
- public void testOverlongSourceIsRejected() {
+ void overlongSourceIsRejected() {
StringBuilder colons = new StringBuilder();
for (int i = 0; i < 100000; i++) {
colons.append(':');
@@ -179,7 +181,7 @@ public void testOverlongSourceIsRejected() {
PartialViewContext pprContext = context.getPartialViewContext();
// only the valid execute id survives; the oversized source is dropped
- Assertions.assertEquals(1, pprContext.getExecuteIds().size());
- Assertions.assertTrue(pprContext.getExecuteIds().contains("form:input"));
+ assertEquals(1, pprContext.getExecuteIds().size());
+ assertTrue(pprContext.getExecuteIds().contains("form:input"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java b/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java
index b31f070290..18042cb9be 100644
--- a/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java
+++ b/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java
@@ -15,13 +15,15 @@
*/
package org.apache.myfaces.context;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.faces.FactoryFinder;
import jakarta.faces.context.FacesContext;
import jakarta.faces.context.PartialViewContext;
import org.apache.myfaces.context.servlet.FacesContextImpl;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -32,7 +34,7 @@
* @author Werner Punz(latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class IsRenderedTest extends AbstractFacesTestCase {
+class IsRenderedTest extends AbstractFacesTestCase {
@Override
@BeforeEach
@@ -50,17 +52,17 @@ public void setUp() throws Exception {
* or a renderAll which
*/
@Test
- public void testRenderAll1() {
+ void renderAll1() {
FacesContext context = new FacesContextImpl(servletContext, request, response);
PartialViewContext pprContext = context.getPartialViewContext();
pprContext.setRenderAll(true);
- Assertions.assertTrue(pprContext.isRenderAll(), "override should trigger no matter which condition we have");
+ assertTrue(pprContext.isRenderAll(), "override should trigger no matter which condition we have");
context = new FacesContextImpl(servletContext, request, response);
pprContext.setRenderAll(false);
- Assertions.assertFalse(pprContext.isRenderAll(), "override should trigger no matter which condition we have");
+ assertFalse(pprContext.isRenderAll(), "override should trigger no matter which condition we have");
}
diff --git a/impl/src/test/java/org/apache/myfaces/context/PartialResponseWriterImplTest.java b/impl/src/test/java/org/apache/myfaces/context/PartialResponseWriterImplTest.java
index 8bcff2c75d..932b8f40eb 100644
--- a/impl/src/test/java/org/apache/myfaces/context/PartialResponseWriterImplTest.java
+++ b/impl/src/test/java/org/apache/myfaces/context/PartialResponseWriterImplTest.java
@@ -19,6 +19,8 @@
package org.apache.myfaces.context;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -33,7 +35,6 @@
import org.apache.myfaces.renderkit.html.HtmlResponseWriterImpl;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
@@ -85,7 +86,7 @@ private void checkOutput(File expected, String output) throws Exception
is2.setCharacterStream(new StringReader(output));
Document doc2 = db.parse(is2);
doc2.normalizeDocument();
- Assertions.assertTrue(doc1.isEqualNode(doc2));
+ assertTrue(doc1.isEqualNode(doc2));
}
/**
@@ -124,9 +125,9 @@ protected String getDirectory()
this.getClass().getName().lastIndexOf('.')).replace('.', '/')
+ "/";
}
-
+
@Test
- public void testNestedScriptCDATA() throws Exception {
+ void nestedScriptCDATA() throws Exception {
_writer = createTestProbe();
try {
_writer.startDocument();
@@ -142,12 +143,12 @@ public void testNestedScriptCDATA() throws Exception {
checkOutput(new File(getLocalFile("nestedScriptCDATA.xml").toURI()), _contentCollector.toString());
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
-
+
@Test
- public void testBasicWriteTest() {
+ void basicWriteTest() {
_writer = createTestProbe();
try {
//_writer.startCDATA();
@@ -157,14 +158,14 @@ public void testBasicWriteTest() {
// _writer.endCDATA();
_writer.flush();
_writer.close();
- Assertions.assertTrue(_contentCollector.toString().equals("testing"));
+ assertEquals("testing", _contentCollector.toString());
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void teststandardNestingTest() {
+ void teststandardNestingTest() {
_writer = createTestProbe();
try {
//_writer.startCDATA();
@@ -174,14 +175,14 @@ public void teststandardNestingTest() {
// _writer.endCDATA();
_writer.flush();
_writer.close();
- Assertions.assertTrue(_contentCollector.toString().equals(""));
+ assertEquals("", _contentCollector.toString());
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testIllegalNestingResolvementTest() {
+ void illegalNestingResolvementTest() {
_writer = createTestProbe();
try {
_writer.startCDATA();
@@ -191,14 +192,14 @@ public void testIllegalNestingResolvementTest() {
_writer.endCDATA();
_writer.flush();
_writer.close();
- Assertions.assertTrue(_contentCollector.toString().equals("]]>"));
+ assertEquals("]]>", _contentCollector.toString());
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testIllegalNestingResolvementTest2() {
+ void illegalNestingResolvementTest2() {
_writer = createTestProbe();
try {
_writer.startCDATA();
@@ -206,28 +207,28 @@ public void testIllegalNestingResolvementTest2() {
_writer.write("testing");
_writer.flush();
_writer.close();
- Assertions.assertTrue(_contentCollector.toString().equals(""));
+ assertEquals("", _contentCollector.toString());
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testStandardUpdate() {
+ void standardUpdate() {
_writer = createTestProbe();
try {
_writer.startUpdate("blaId");
_writer.write("testing");
_writer.endUpdate();
- Assertions.assertTrue(_contentCollector.toString().equals(STD_UPDATE_RESULT));
+ assertEquals(STD_UPDATE_RESULT, _contentCollector.toString());
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testStandardUpdateNestedCDATA() {
+ void standardUpdateNestedCDATA() {
_writer = createTestProbe();
try {
_writer.startUpdate("blaId");
@@ -235,14 +236,14 @@ public void testStandardUpdateNestedCDATA() {
_writer.write("testing");
_writer.endCDATA();
_writer.endUpdate();
- Assertions.assertTrue(_contentCollector.toString().equals("]]>"));
+ assertEquals("]]>", _contentCollector.toString());
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testComponentAuthorNestingFailureTest() {
+ void componentAuthorNestingFailureTest() {
_writer = createTestProbe();
try {
_writer.startUpdate("blaId");
@@ -250,40 +251,40 @@ public void testComponentAuthorNestingFailureTest() {
_writer.startCDATA();
_writer.write("testing");
_writer.endUpdate();
- Assertions.assertTrue(_contentCollector.toString().equals(""));
+ assertEquals("", _contentCollector.toString());
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testStandardInsertAfter() {
+ void standardInsertAfter() {
_writer = createTestProbe();
try {
_writer.startInsertAfter("blaId");
_writer.write("testing");
_writer.endInsert();
- Assertions.assertTrue(_contentCollector.toString().equals(""));
+ assertEquals("", _contentCollector.toString());
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testStandardInsertBefore() {
+ void standardInsertBefore() {
_writer = createTestProbe();
try {
_writer.startInsertBefore("blaId");
_writer.write("testing");
_writer.endInsert();
- Assertions.assertTrue(_contentCollector.toString().equals(""));
+ assertEquals("", _contentCollector.toString());
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testBrokenUserInput() {
+ void brokenUserInput() {
_writer = createTestProbe();
try {
_writer.startInsertBefore("blaId");
@@ -292,56 +293,56 @@ public void testBrokenUserInput() {
_writer.writeAttribute("value","]]>", null);
_writer.endElement("input");
_writer.endInsert();
- Assertions.assertTrue(_contentCollector.toString().contains("value=\"]]>\""));
+ assertTrue(_contentCollector.toString().contains("value=\"]]>\""));
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testDelete() {
+ void delete() {
_writer = createTestProbe();
try {
_writer.delete("blaId");
- Assertions.assertTrue(_contentCollector.toString().equals(""));
+ assertEquals("", _contentCollector.toString());
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testWriteIllegalXmlUnicodeCharacters() {
+ void writeIllegalXmlUnicodeCharacters() {
_writer = createTestProbe();
try {
String illegalChars = "\u0001\u0002\u0003\u0004\u0005\u0006\u000B\f\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\uDBFF\uDC00";
String legalChars = "foo";
_writer.write(illegalChars + legalChars);
- Assertions.assertEquals(legalChars, _contentCollector.toString().trim(),
+ assertEquals(legalChars, _contentCollector.toString().trim(),
"All illegal XML unicode characters should have been replaced by spaces");
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testWriteTextIllegalXmlUnicodeCharacters() {
+ void writeTextIllegalXmlUnicodeCharacters() {
_writer = createTestProbe();
try {
String illegalChars = "\u0001\u0002\u0003\u0004\u0005\u0006\u000B\f\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\uDBFF\uDC00";
String legalChars = "foo";
_writer.writeText(illegalChars + legalChars, null);
- Assertions.assertEquals(legalChars, _contentCollector.toString().trim(),
+ assertEquals(legalChars, _contentCollector.toString().trim(),
"All illegal XML unicode characters should have been replaced by spaces");
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
@Test
- public void testWriteAttributeIllegalXmlUnicodeCharacters() {
+ void writeAttributeIllegalXmlUnicodeCharacters() {
_writer = createTestProbe();
try {
String illegalChars = "\u0001\u0002\u0003\u0004\u0005\u0006\u000B\f\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\uDBFF\uDC00";
@@ -349,16 +350,16 @@ public void testWriteAttributeIllegalXmlUnicodeCharacters() {
_writer.startElement(legalChars, null);
_writer.writeAttribute(legalChars, illegalChars + legalChars, null);
_writer.endElement(legalChars);
- Assertions.assertTrue(_contentCollector.toString().matches("<:X: :X:=\"[ ]+:X:\">".replace(":X:", legalChars)),
+ assertTrue(_contentCollector.toString().matches("<:X: :X:=\"[ ]+:X:\">".replace(":X:", legalChars)),
"All illegal XML unicode characters should have been replaced by spaces");
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
-
+
@Test
- public void testWriteSkipEmoji() {
+ void writeSkipEmoji() {
_writer = createTestProbe();
try {
String input = "foo😀";
@@ -366,16 +367,16 @@ public void testWriteSkipEmoji() {
String escaped = _contentCollector.toString();
- Assertions.assertEquals(input, escaped.trim(),
+ assertEquals(input, escaped.trim(),
"All illegal XML unicode characters should have been replaced by spaces");
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
-
+
@Test
- public void testWriteSkipPictographs() {
+ void writeSkipPictographs() {
_writer = createTestProbe();
try {
String input = "foo🏺";
@@ -383,11 +384,11 @@ public void testWriteSkipPictographs() {
String escaped = _contentCollector.toString();
- Assertions.assertEquals(input, escaped.trim(),
+ assertEquals(input, escaped.trim(),
"All illegal XML unicode characters should have been replaced by spaces");
} catch (IOException e) {
- Assertions.fail(e.toString());
+ fail(e.toString());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java b/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java
index 20de58179e..86d97b27dd 100644
--- a/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java
@@ -15,6 +15,9 @@
*/
package org.apache.myfaces.context;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.HashMap;
import java.util.Map;
@@ -24,7 +27,6 @@
import org.apache.myfaces.context.servlet.FacesContextImpl;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -36,7 +38,7 @@
* @author Werner Punz(latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class RenderPhaseClientIdsTest extends AbstractFacesTestCase {
+class RenderPhaseClientIdsTest extends AbstractFacesTestCase {
@Override
@BeforeEach
@@ -47,13 +49,13 @@ public void setUp() throws Exception {
FactoryFinder.setFactory (FactoryFinder.EXCEPTION_HANDLER_FACTORY,
"org.apache.myfaces.context.ExceptionHandlerFactoryImpl");
}
-
+
/**
* Empty String as request param
* has to result in an empty list
*/
@Test
- public void testRequestParams1() {
+ void requestParams1() {
String empty = " \n \t ";
Map requestParamMap = new HashMap();
requestParamMap.put(PartialViewContext.PARTIAL_RENDER_PARAM_NAME, empty);
@@ -63,14 +65,14 @@ public void testRequestParams1() {
PartialViewContext pprContext = context.getPartialViewContext();
- Assertions.assertTrue(pprContext.getRenderIds().isEmpty());
+ assertTrue(pprContext.getRenderIds().isEmpty());
}
/**
* no request param, has to result in an empty list
*/
@Test
- public void testRequestParams2() {
+ void requestParams2() {
Map requestParamMap = new HashMap();
ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);
@@ -78,7 +80,7 @@ public void testRequestParams2() {
PartialViewContext pprContext = context.getPartialViewContext();
- Assertions.assertTrue(pprContext.getRenderIds().isEmpty());
+ assertTrue(pprContext.getRenderIds().isEmpty());
}
/**
@@ -102,7 +104,7 @@ public void testRequestParams4() {
* list with one element has to result in a list with one element
*/
@Test
- public void testRequestParams5() {
+ void requestParams5() {
String params = " view1:panel1:_component1 ";
Map requestParamMap = new HashMap();
requestParamMap.put(PartialViewContext.PARTIAL_RENDER_PARAM_NAME, params);
@@ -112,8 +114,8 @@ public void testRequestParams5() {
PartialViewContext pprContext = context.getPartialViewContext();
- Assertions.assertTrue(pprContext.getRenderIds().size() == 1);
- Assertions.assertTrue(pprContext.getRenderIds().iterator().next().equals("view1:panel1:_component1"));
+ assertEquals(1, pprContext.getRenderIds().size());
+ assertEquals("view1:panel1:_component1", pprContext.getRenderIds().iterator().next());
}
/**
@@ -121,7 +123,7 @@ public void testRequestParams5() {
* blank chars
*/
@Test
- public void testRequestParams6() {
+ void requestParams6() {
String params = " view1:panel1:_component1 view1:panel1:_component2 \n component3 component4 ";
Map requestParamMap = new HashMap();
requestParamMap.put(PartialViewContext.PARTIAL_RENDER_PARAM_NAME, params);
@@ -131,7 +133,7 @@ public void testRequestParams6() {
PartialViewContext pprContext = context.getPartialViewContext();
- Assertions.assertTrue(pprContext.getRenderIds().size() == 4);
+ assertEquals(4, pprContext.getRenderIds().size());
// FIXME: Latest spec uses a Collection so order is not guaranteed
// Assertions.assertTrue("Value match",pprContext.getRenderIds().get(0).equals("view1:panel1:_component1"));
@@ -146,7 +148,7 @@ public void testRequestParams6() {
* cannot be inflated with repeated ids.
*/
@Test
- public void testDuplicateClientIdsAreCollapsed() {
+ void duplicateClientIdsAreCollapsed() {
String params = "form:input form:input form:input";
Map requestParamMap = new HashMap();
requestParamMap.put(PartialViewContext.PARTIAL_RENDER_PARAM_NAME, params);
@@ -156,8 +158,8 @@ public void testDuplicateClientIdsAreCollapsed() {
PartialViewContext pprContext = context.getPartialViewContext();
- Assertions.assertEquals(1, pprContext.getRenderIds().size());
- Assertions.assertTrue(pprContext.getRenderIds().contains("form:input"));
+ assertEquals(1, pprContext.getRenderIds().size());
+ assertTrue(pprContext.getRenderIds().contains("form:input"));
}
/**
@@ -165,7 +167,7 @@ public void testDuplicateClientIdsAreCollapsed() {
* of NamingContainer separators) must not be expanded into a PartialVisitContext.
*/
@Test
- public void testOverlongClientIdIsRejected() {
+ void overlongClientIdIsRejected() {
StringBuilder colons = new StringBuilder();
for (int i = 0; i < 100000; i++) {
colons.append(':');
@@ -178,14 +180,14 @@ public void testOverlongClientIdIsRejected() {
PartialViewContext pprContext = context.getPartialViewContext();
- Assertions.assertTrue(pprContext.getRenderIds().isEmpty());
+ assertTrue(pprContext.getRenderIds().isEmpty());
}
/**
* the number of client ids read from the request is capped.
*/
@Test
- public void testClientIdCountIsCapped() {
+ void clientIdCountIsCapped() {
StringBuilder params = new StringBuilder();
for (int i = 0; i < 5000; i++) {
params.append("id").append(i).append(' ');
@@ -198,6 +200,6 @@ public void testClientIdCountIsCapped() {
PartialViewContext pprContext = context.getPartialViewContext();
- Assertions.assertEquals(256, pprContext.getRenderIds().size());
+ assertEquals(256, pprContext.getRenderIds().size());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java b/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java
index cc31b49262..96311c67ed 100644
--- a/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java
+++ b/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java
@@ -15,6 +15,8 @@
*/
package org.apache.myfaces.context;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -42,7 +44,7 @@
* @author Werner Punz(latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class ResponseWrapperSwitchTest extends AbstractFacesTestCase {
+class ResponseWrapperSwitchTest extends AbstractFacesTestCase {
@Override
@BeforeEach
@@ -155,7 +157,7 @@ public void setWriteListener(WriteListener wl)
* response
*/
@Test
- public void testSwitchOnWriter() {
+ void switchOnWriter() {
ByteArrayOutputStream ostr = new ByteArrayOutputStream();
ByteArrayOutputStream ostrWriter = new ByteArrayOutputStream();
@@ -166,30 +168,23 @@ public void testSwitchOnWriter() {
FacesContext context = new FacesContextImpl(servletContext, request, resp);
- ResponseWriter responseWriter = context.getResponseWriter();
- if (responseWriter == null) {
- try {
- responseWriter = new MockResponseWriter(((ServletResponse) context.getExternalContext().getResponse()).getWriter(), null, null);
- } catch (IOException ex) {
- Assertions.fail(ex.getMessage());
- }
- context.setResponseWriter(responseWriter);
+ if (context.getResponseWriter() == null) {
+ ResponseWriter newResponseWriter = Assertions.assertDoesNotThrow(() ->
+ new MockResponseWriter(((ServletResponse) context.getExternalContext().getResponse()).getWriter(), null, null));
+ context.setResponseWriter(newResponseWriter);
}
+ ResponseWriter responseWriter = context.getResponseWriter();
+ assertTrue(responseWriter != null);
-
- Assertions.assertTrue(responseWriter != null);
-
- try {
+ Assertions.assertDoesNotThrow(() -> {
responseWriter.append("hello world");
responseWriter.flush();
responseWriter.close();
- } catch (IOException ex) {
- Assertions.fail(ex.getMessage());
- }
+ });
- Assertions.assertTrue(ostrWriter.toString().trim().equals("hello world"));
+ assertEquals("hello world", ostrWriter.toString().trim());
}
diff --git a/impl/src/test/java/org/apache/myfaces/context/TestIsAjaxRequest.java b/impl/src/test/java/org/apache/myfaces/context/TestIsAjaxRequest.java
index 10903e9430..0e70a9c23c 100644
--- a/impl/src/test/java/org/apache/myfaces/context/TestIsAjaxRequest.java
+++ b/impl/src/test/java/org/apache/myfaces/context/TestIsAjaxRequest.java
@@ -16,13 +16,15 @@
package org.apache.myfaces.context;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.Map;
import jakarta.faces.FactoryFinder;
import jakarta.faces.context.FacesContext;
import org.apache.myfaces.context.servlet.FacesContextImpl;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -52,15 +54,15 @@ public void setUp() throws Exception {
}
@Test
- public void testNoEntry() {
+ void noEntry() {
- Assertions.assertFalse(context.getPartialViewContext().isAjaxRequest());
+ assertFalse(context.getPartialViewContext().isAjaxRequest());
}
public void testEntry() {
request.addHeader("Faces-Request", "partial/ajax");
request.addParameter("jakarta.faces.partial.ajax","true");
- Assertions.assertTrue(context.getPartialViewContext().isAjaxRequest());
+ assertTrue(context.getPartialViewContext().isAjaxRequest());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/context/flash/FlashImplTest.java b/impl/src/test/java/org/apache/myfaces/context/flash/FlashImplTest.java
index 854d7ccc4b..7d8e6101fd 100644
--- a/impl/src/test/java/org/apache/myfaces/context/flash/FlashImplTest.java
+++ b/impl/src/test/java/org/apache/myfaces/context/flash/FlashImplTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.context.flash;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
@@ -33,7 +35,6 @@
import org.apache.myfaces.test.mock.MockHttpServletRequest;
import org.apache.myfaces.test.mock.MockHttpServletResponse;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -83,7 +84,7 @@ public void tearDown() throws Exception
* @throws Exception
*/
@Test
- public void testSessionMapWrapperSubKeyMap() throws Exception
+ void sessionMapWrapperSubKeyMap() throws Exception
{
// set phase to RESTORE_VIEW to create the flash tokens on doPrePhaseActions()
facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
@@ -103,16 +104,16 @@ public void testSessionMapWrapperSubKeyMap() throws Exception
FlashImpl.SEPARATOR_CHAR + renderToken + FlashImpl.SEPARATOR_CHAR + "testkey1";
// Assertion
- Assertions.assertEquals("testvalue1", session.getAttribute(sessionMapKey));
+ assertEquals("testvalue1", session.getAttribute(sessionMapKey));
}
-
+
/**
* Tests the functionality of keep() in a normal postback scenario.
* @throws Exception
*/
@SuppressWarnings("unchecked")
@Test
- public void testKeepValueNormalPostback() throws Exception
+ void keepValueNormalPostback() throws Exception
{
// simulate Faces lifecycle:
// note that doPrePhaseActions() only performs tasks on RESTORE_VIEW
@@ -172,7 +173,7 @@ public void testKeepValueNormalPostback() throws Exception
// _flash.get() will ask the execute FlashMap for the value
// and this must be the render FlashMap of the previous request,
// thus it must contain the value from the previous request.
- Assertions.assertEquals("flashvalue", _flash.get("flashkey"));
+ assertEquals("flashvalue", _flash.get("flashkey"));
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -180,23 +181,23 @@ public void testKeepValueNormalPostback() throws Exception
// _flash.get() also references to the execute FlashMap, but
// this one has to be cleared by now, thus it must be null.
- Assertions.assertNull(_flash.get("flashkey"));
+ assertNull(_flash.get("flashkey"));
// get the execute Map of the second postback (FlashImpl internals)
Map executeMap = (Map) externalContext
.getRequestMap().get(FlashImpl.FLASH_EXECUTE_MAP);
// must be empty
- Assertions.assertTrue(executeMap.isEmpty(), "The execute Map of the second postback must have been cleared");
+ assertTrue(executeMap.isEmpty(), "The execute Map of the second postback must have been cleared");
}
-
+
/**
* Tests the functionality of keep() in a POST-REDIRECT-GET scenario.
* @throws Exception
*/
@SuppressWarnings("unchecked")
@Test
- public void testKeepValuePostRedirectGet() throws Exception
+ void keepValuePostRedirectGet() throws Exception
{
// simulate Faces lifecycle:
// note that doPrePhaseActions() only performs tasks on RESTORE_VIEW
@@ -237,7 +238,7 @@ public void testKeepValuePostRedirectGet() throws Exception
// set redirect to true, this happens by the NavigationHandler in phase 5
_flash.setRedirect(true);
- Assertions.assertTrue(_flash.isRedirect());
+ assertTrue(_flash.isRedirect());
// note that setRedirect(true) was called, thus the cleanup happens
// in phase 5, because doPostPhaseActions() won't be called on phase 6.
@@ -258,7 +259,7 @@ public void testKeepValuePostRedirectGet() throws Exception
_flash.doPrePhaseActions(facesContext);
// check isRedirect();
- Assertions.assertTrue(_flash.isRedirect(), "setRedirect(true) was called on the previous request, "
+ assertTrue(_flash.isRedirect(), "setRedirect(true) was called on the previous request, "
+ " and we are in the execute portion of the lifecycle, "
+ " thus isRedirect() must be true.");
@@ -266,13 +267,13 @@ public void testKeepValuePostRedirectGet() throws Exception
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
// check isRedirect();
- Assertions.assertFalse(_flash.isRedirect(), "setRedirect(true) was called on the previous request, "
+ assertFalse(_flash.isRedirect(), "setRedirect(true) was called on the previous request, "
+ " but we are already in the render portion of the lifecycle, "
+ " thus isRedirect() must be false.");
// _flash.get() will ask the execute FlashMap and this one
// must contain the key used in keep()
- Assertions.assertEquals("flashvalue", _flash.get("flashkey"));
+ assertEquals("flashvalue", _flash.get("flashkey"));
_flash.doPostPhaseActions(facesContext);
@@ -292,7 +293,7 @@ public void testKeepValuePostRedirectGet() throws Exception
facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
// check isRedirect();
- Assertions.assertFalse(_flash.isRedirect(), "setRedirect(true) was called on the pre-previous request, "
+ assertFalse(_flash.isRedirect(), "setRedirect(true) was called on the pre-previous request, "
+ " thus isRedirect() must be false again.");
// _flash.get() will ask the execute FlashMap for the value
@@ -300,7 +301,7 @@ public void testKeepValuePostRedirectGet() throws Exception
// thus it must not contain the value from the previous request,
// because the value was on the previous request's execute FlashMap
// and not on the previous request's render FlashMap.
- Assertions.assertNull(_flash.get("flashkey"));
+ assertNull(_flash.get("flashkey"));
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -311,15 +312,15 @@ public void testKeepValuePostRedirectGet() throws Exception
.getRequestMap().get(FlashImpl.FLASH_EXECUTE_MAP);
// must be empty
- Assertions.assertTrue(executeMap.isEmpty(), "The execute Map of the second postback must have been cleared");
+ assertTrue(executeMap.isEmpty(), "The execute Map of the second postback must have been cleared");
}
-
+
/**
* Tests the functionality of keepMessages in a normal postback scenario.
* @throws Exception
*/
@Test
- public void testKeepMessagesNormalPostback() throws Exception
+ void keepMessagesNormalPostback() throws Exception
{
// simulate Faces lifecycle:
// note that doPrePhaseActions() only performs tasks on RESTORE_VIEW
@@ -360,12 +361,12 @@ public void testKeepMessagesNormalPostback() throws Exception
facesContext.addMessage(null, messageNoClientId);
// now the FacesContext must contain 2 messages
- Assertions.assertEquals(2, facesContext.getMessageList().size());
+ assertEquals(2, facesContext.getMessageList().size());
// keep messages
_flash.setKeepMessages(true);
- Assertions.assertTrue(_flash.isKeepMessages(), "setKeepMessages(true) was just called, thus isKeepMessages() "
+ assertTrue(_flash.isKeepMessages(), "setKeepMessages(true) was just called, thus isKeepMessages() "
+ "must be true.");
// simulate Faces lifecycle
@@ -381,18 +382,18 @@ public void testKeepMessagesNormalPostback() throws Exception
facesContext.setPostback(true);
// now the FacesContext must contain 0 messages (new request, new FacesContext)
- Assertions.assertEquals(0, facesContext.getMessageList().size());
+ assertEquals(0, facesContext.getMessageList().size());
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
_flash.doPrePhaseActions(facesContext);
// now the messages must be here again
- Assertions.assertEquals(2, facesContext.getMessageList().size());
- Assertions.assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
- Assertions.assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
+ assertEquals(2, facesContext.getMessageList().size());
+ assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
+ assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
- Assertions.assertFalse(_flash.isKeepMessages(), "setKeepMessages(true) was not called on this request, thus "
+ assertFalse(_flash.isKeepMessages(), "setKeepMessages(true) was not called on this request, thus "
+ "isKeepMessages() must be false.");
// simulate Faces lifecycle
@@ -408,7 +409,7 @@ public void testKeepMessagesNormalPostback() throws Exception
facesContext.setPostback(true);
// now the FacesContext must contain 0 messages (new request, new FacesContext)
- Assertions.assertEquals(0, facesContext.getMessageList().size());
+ assertEquals(0, facesContext.getMessageList().size());
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
@@ -416,13 +417,13 @@ public void testKeepMessagesNormalPostback() throws Exception
// the messages must still be gone here, because setKeepMessages(true)
// was not called on the previous request
- Assertions.assertEquals(0, facesContext.getMessageList().size());
+ assertEquals(0, facesContext.getMessageList().size());
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
_flash.doPostPhaseActions(facesContext);
}
-
+
/**
* Tests the functionality of keepMessages in a POST-REDIRECT-GET scenario.
* In this test case the messages are only shipped from the POST to the GET and
@@ -430,7 +431,7 @@ public void testKeepMessagesNormalPostback() throws Exception
* @throws Exception
*/
@Test
- public void testKeepMessagesPostRedirectGet() throws Exception
+ void keepMessagesPostRedirectGet() throws Exception
{
// simulate Faces lifecycle:
// note that doPrePhaseActions() only performs tasks on RESTORE_VIEW
@@ -471,16 +472,16 @@ public void testKeepMessagesPostRedirectGet() throws Exception
facesContext.addMessage(null, messageNoClientId);
// now the FacesContext must contain 2 messages
- Assertions.assertEquals(2, facesContext.getMessageList().size());
+ assertEquals(2, facesContext.getMessageList().size());
// keep messages
_flash.setKeepMessages(true);
- Assertions.assertTrue(_flash.isKeepMessages(), "setKeepMessages(true) was just called, thus isKeepMessages() "
+ assertTrue(_flash.isKeepMessages(), "setKeepMessages(true) was just called, thus isKeepMessages() "
+ "must be true.");
// set redirect to true, this happens by the NavigationHandler in phase 5
_flash.setRedirect(true);
- Assertions.assertTrue(_flash.isRedirect(), "setRedirect(true) was just called, thus isRedirect() must be true");
+ assertTrue(_flash.isRedirect(), "setRedirect(true) was just called, thus isRedirect() must be true");
// The redirect cause responseComplete() method to be called.
facesContext.responseComplete();
// note that setRedirect(true) was called, thus the cleanup happens
@@ -496,7 +497,7 @@ public void testKeepMessagesPostRedirectGet() throws Exception
facesContext.setPostback(false);
// now the FacesContext must contain 0 messages (new request, new FacesContext)
- Assertions.assertEquals(0, facesContext.getMessageList().size());
+ assertEquals(0, facesContext.getMessageList().size());
// simulate Faces lifecycle
// Note that doPrePhaseActions() is called on RESTORE_VIEW even
@@ -508,12 +509,12 @@ public void testKeepMessagesPostRedirectGet() throws Exception
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
// now the messages must be here again
- Assertions.assertEquals(2, facesContext.getMessageList().size());
- Assertions.assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
- Assertions.assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
+ assertEquals(2, facesContext.getMessageList().size());
+ assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
+ assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
// check isKeepMessages()
- Assertions.assertFalse(_flash.isKeepMessages());
+ assertFalse(_flash.isKeepMessages());
_flash.doPostPhaseActions(facesContext);
@@ -526,7 +527,7 @@ public void testKeepMessagesPostRedirectGet() throws Exception
facesContext.setPostback(true);
// now the FacesContext must contain 0 messages (new request, new FacesContext)
- Assertions.assertEquals(0, facesContext.getMessageList().size());
+ assertEquals(0, facesContext.getMessageList().size());
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
@@ -537,13 +538,13 @@ public void testKeepMessagesPostRedirectGet() throws Exception
// now the FacesContext must contain 0 messages, because
// setKeepMessages(true) was not called on the GET-request
- Assertions.assertEquals(0, facesContext.getMessageList().size());
+ assertEquals(0, facesContext.getMessageList().size());
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
_flash.doPostPhaseActions(facesContext);
}
-
+
/**
* Tests the functionality of keepMessages in a POST-REDIRECT-GET scenario.
* In this test case the messages are shipped from the POST to the GET and
@@ -551,7 +552,7 @@ public void testKeepMessagesPostRedirectGet() throws Exception
* @throws Exception
*/
@Test
- public void testKeepMessagesPostRedirectGetTwoTimes() throws Exception
+ void keepMessagesPostRedirectGetTwoTimes() throws Exception
{
// simulate Faces lifecycle:
// note that doPrePhaseActions() only performs tasks on RESTORE_VIEW
@@ -592,15 +593,15 @@ public void testKeepMessagesPostRedirectGetTwoTimes() throws Exception
facesContext.addMessage(null, messageNoClientId);
// now the FacesContext must contain 2 messages
- Assertions.assertEquals(2, facesContext.getMessageList().size());
+ assertEquals(2, facesContext.getMessageList().size());
// keep messages
_flash.setKeepMessages(true);
- Assertions.assertTrue(_flash.isKeepMessages());
+ assertTrue(_flash.isKeepMessages());
// set redirect to true, this happens by the NavigationHandler in phase 5
_flash.setRedirect(true);
- Assertions.assertTrue(_flash.isRedirect());
+ assertTrue(_flash.isRedirect());
// The redirect cause responseComplete() method to be called.
facesContext.responseComplete();
@@ -617,7 +618,7 @@ public void testKeepMessagesPostRedirectGetTwoTimes() throws Exception
facesContext.setPostback(false);
// now the FacesContext must contain 0 messages (new request, new FacesContext)
- Assertions.assertEquals(0, facesContext.getMessageList().size());
+ assertEquals(0, facesContext.getMessageList().size());
// simulate Faces lifecycle
// Note that doPrePhaseActions() is called on RESTORE_VIEW even
@@ -629,17 +630,17 @@ public void testKeepMessagesPostRedirectGetTwoTimes() throws Exception
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
// now the messages must be here again
- Assertions.assertEquals(2, facesContext.getMessageList().size());
- Assertions.assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
- Assertions.assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
+ assertEquals(2, facesContext.getMessageList().size());
+ assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
+ assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
// check isKeepMessages()
- Assertions.assertFalse(_flash.isKeepMessages(), "setKeepMessages(true) was not called on this request, thus "
+ assertFalse(_flash.isKeepMessages(), "setKeepMessages(true) was not called on this request, thus "
+ "isKeepMessages() must be false.");
// keep messages - again
_flash.setKeepMessages(true);
- Assertions.assertTrue(_flash.isKeepMessages(), "setKeepMessages(true) was just called, thus isKeepMessages() "
+ assertTrue(_flash.isKeepMessages(), "setKeepMessages(true) was just called, thus isKeepMessages() "
+ "must be true.");
// The redirect cause responseComplete() method to be called.
facesContext.responseComplete();
@@ -655,7 +656,7 @@ public void testKeepMessagesPostRedirectGetTwoTimes() throws Exception
facesContext.setPostback(true);
// now the FacesContext must contain 0 messages (new request, new FacesContext)
- Assertions.assertEquals(0, facesContext.getMessageList().size());
+ assertEquals(0, facesContext.getMessageList().size());
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
@@ -665,9 +666,9 @@ public void testKeepMessagesPostRedirectGetTwoTimes() throws Exception
facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
// now the messages must be here again
- Assertions.assertEquals(2, facesContext.getMessageList().size());
- Assertions.assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
- Assertions.assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
+ assertEquals(2, facesContext.getMessageList().size());
+ assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
+ assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -682,7 +683,7 @@ public void testKeepMessagesPostRedirectGetTwoTimes() throws Exception
facesContext.setPostback(true);
// now the FacesContext must contain 0 messages (new request, new FacesContext)
- Assertions.assertEquals(0, facesContext.getMessageList().size());
+ assertEquals(0, facesContext.getMessageList().size());
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
@@ -693,69 +694,69 @@ public void testKeepMessagesPostRedirectGetTwoTimes() throws Exception
// now the FacesContext must contain 0 messages, because
// setKeepMessages(true) was not called on the previous postback
- Assertions.assertEquals(0, facesContext.getMessageList().size());
+ assertEquals(0, facesContext.getMessageList().size());
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
_flash.doPostPhaseActions(facesContext);
}
-
+
/**
* Test if setRedirect(true) works via _flash.put("redirect", true)
* and if isRedirect() is equal to _flash.get("redirect").
*/
@Test
- public void testSetRedirect()
+ void setRedirect()
{
- Assertions.assertFalse(_flash.isRedirect());
- Assertions.assertFalse((Boolean) _flash.get("redirect"));
+ assertFalse(_flash.isRedirect());
+ assertFalse((Boolean) _flash.get("redirect"));
_flash.put("redirect", true);
- Assertions.assertTrue(_flash.isRedirect());
- Assertions.assertTrue((Boolean) _flash.get("redirect"));
+ assertTrue(_flash.isRedirect());
+ assertTrue((Boolean) _flash.get("redirect"));
}
-
+
/**
* Test if setKeepMessages(true) works via _flash.put("keepMessages", true)
* and if isKeepMessages() is equal to _flash.get("keepMessages").
*/
@Test
- public void testSetKeepMessages()
+ void setKeepMessages()
{
- Assertions.assertFalse(_flash.isKeepMessages());
- Assertions.assertFalse((Boolean) _flash.get("keepMessages"));
+ assertFalse(_flash.isKeepMessages());
+ assertFalse((Boolean) _flash.get("keepMessages"));
_flash.put("keepMessages", true);
- Assertions.assertTrue(_flash.isKeepMessages());
- Assertions.assertTrue((Boolean) _flash.get("keepMessages"));
+ assertTrue(_flash.isKeepMessages());
+ assertTrue((Boolean) _flash.get("keepMessages"));
}
-
+
/**
* Tests the functionality of putNow().
*/
@SuppressWarnings("unchecked")
@Test
- public void testPutNow()
+ void putNow()
{
Map requestMap = externalContext.getRequestMap();
// requestMap must NOT contain the key
- Assertions.assertNull(requestMap.get("flashkey"));
+ assertNull(requestMap.get("flashkey"));
_flash.putNow("flashkey", "flashvalue");
// requestMap must contain the key
- Assertions.assertEquals("flashvalue", requestMap.get("flashkey"));
+ assertEquals("flashvalue", requestMap.get("flashkey"));
}
-
+
/**
* Tests keep()
* @throws Exception
*/
@Test
- public void testKeep() throws Exception
+ void keep() throws Exception
{
// simulate Faces lifecycle:
// note that doPrePhaseActions() only performs tasks on RESTORE_VIEW
@@ -817,7 +818,7 @@ public void testKeep() throws Exception
facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
// the value must be in the executeMap
- Assertions.assertEquals("flashvalue", _flash.get("flashkey"));
+ assertEquals("flashvalue", _flash.get("flashkey"));
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -825,13 +826,13 @@ public void testKeep() throws Exception
// cleanup flash
_flash.doPostPhaseActions(facesContext);
}
-
+
/**
* Like testKeep(), but without calling keep() to keep the value.
* @throws Exception
*/
@Test
- public void testNotKeep() throws Exception
+ void notKeep() throws Exception
{
// simulate Faces lifecycle:
// note that doPrePhaseActions() only performs tasks on RESTORE_VIEW
@@ -891,7 +892,7 @@ public void testNotKeep() throws Exception
facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
// render FlashMap must be empty
- Assertions.assertNull(_flash.get("flashkey"));
+ assertNull(_flash.get("flashkey"));
// simulate Faces lifecycle
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -899,13 +900,13 @@ public void testNotKeep() throws Exception
// cleanup flash
_flash.doPostPhaseActions(facesContext);
}
-
+
/**
* Tests if the reading functions use _getFlashMapForReading()
* and if the writing functions use _getFlashMapForWriting().
*/
@Test
- public void testMapMethodsUseDifferentMaps() throws Exception
+ void mapMethodsUseDifferentMaps() throws Exception
{
// simulate Faces lifecycle:
// note that doPrePhaseActions() only performs tasks on RESTORE_VIEW
@@ -942,7 +943,7 @@ public void testMapMethodsUseDifferentMaps() throws Exception
// in this configuration put() and get() are executed on different maps
// there must not be a value with the key "flashkey"
- Assertions.assertNull(_flash.get("flashkey"));
+ assertNull(_flash.get("flashkey"));
// put() always references the active FlashMap,
// which is the render FlashMap in this case (phase is render response)
@@ -950,16 +951,16 @@ public void testMapMethodsUseDifferentMaps() throws Exception
// there must still not be a value with the key "flashkey"
// NOTE that get still references the execute FlashMap
- Assertions.assertNull(_flash.get("flashkey"));
+ assertNull(_flash.get("flashkey"));
_flash.doPostPhaseActions(facesContext);
}
-
+
/**
* Tests the implementation of the methods from the java.util.Map interface.
*/
@Test
- public void testMapMethods()
+ void mapMethods()
{
// ensure that _getActiveFlashMap() returns the execute FlashMap
facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
@@ -1006,13 +1007,13 @@ public void testMapMethods()
*/
private void _noElementAssertions()
{
- Assertions.assertTrue(_flash.isEmpty());
- Assertions.assertEquals(0, _flash.size());
- Assertions.assertFalse(_flash.containsKey("flashkey"));
- Assertions.assertFalse(_flash.containsValue("flashvalue"));
- Assertions.assertEquals(Collections.emptySet(), _flash.keySet());
- Assertions.assertNull(_flash.get("flashkey"));
- Assertions.assertTrue(_flash.values().isEmpty());
+ assertTrue(_flash.isEmpty());
+ assertEquals(0, _flash.size());
+ assertFalse(_flash.containsKey("flashkey"));
+ assertFalse(_flash.containsValue("flashvalue"));
+ assertEquals(Collections.emptySet(), _flash.keySet());
+ assertNull(_flash.get("flashkey"));
+ assertTrue(_flash.values().isEmpty());
}
/**
@@ -1020,13 +1021,13 @@ private void _noElementAssertions()
*/
private void _oneElementAssertions()
{
- Assertions.assertFalse(_flash.isEmpty());
- Assertions.assertEquals(1, _flash.size());
- Assertions.assertTrue(_flash.containsKey("flashkey"));
- Assertions.assertTrue(_flash.containsValue("flashvalue"));
- Assertions.assertEquals(new HashSet(Arrays.asList("flashkey")), _flash.keySet());
- Assertions.assertEquals("flashvalue", _flash.get("flashkey"));
- Assertions.assertTrue(_flash.containsValue("flashvalue"));
+ assertFalse(_flash.isEmpty());
+ assertEquals(1, _flash.size());
+ assertTrue(_flash.containsKey("flashkey"));
+ assertTrue(_flash.containsValue("flashvalue"));
+ assertEquals(new HashSet(Arrays.asList("flashkey")), _flash.keySet());
+ assertEquals("flashvalue", _flash.get("flashkey"));
+ assertTrue(_flash.containsValue("flashvalue"));
}
/**
@@ -1042,7 +1043,7 @@ private void _simulateNewRequest() throws Exception
Cookie renderTokenCookie = response.getCookie(FlashImpl.FLASH_RENDER_MAP_TOKEN);
// the Cookie must exist
- Assertions.assertNotNull(renderTokenCookie);
+ assertNotNull(renderTokenCookie);
// check for the redirect-cookie
Cookie redirectCookie = response.getCookie(FlashImpl.FLASH_REDIRECT);
diff --git a/impl/src/test/java/org/apache/myfaces/context/servlet/FacesContextImplBaseTest.java b/impl/src/test/java/org/apache/myfaces/context/servlet/FacesContextImplBaseTest.java
index 6ea3270d32..03e596ae8c 100644
--- a/impl/src/test/java/org/apache/myfaces/context/servlet/FacesContextImplBaseTest.java
+++ b/impl/src/test/java/org/apache/myfaces/context/servlet/FacesContextImplBaseTest.java
@@ -18,11 +18,12 @@
*/
package org.apache.myfaces.context.servlet;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.Map;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import jakarta.faces.component.UIViewRoot;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
@@ -34,14 +35,14 @@
* @author Bill Lucy (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class FacesContextImplBaseTest extends AbstractFaceletTestCase {
+class FacesContextImplBaseTest extends AbstractFaceletTestCase {
/**
* Verify that the Map returned by UIViewRoot.getViewMap() is cleared when a new view root is set,
* as required in 4.1.19.2
*/
@Test
- public void testViewMapCleared() throws Exception
+ void viewMapCleared() throws Exception
{
// don't use MockFacesServletContext here
FacesContextImpl fci = new FacesContextImpl(facesContext.getExternalContext(), null, null);
@@ -53,7 +54,7 @@ public void testViewMapCleared() throws Exception
// set a new view root, which will cause the old view root's ViewMap to be cleared if BUILDING_VIEW_METADATA is not set
fci.setViewRoot(secondRoot);
- Assertions.assertEquals(0, viewMap.size(), "The ViewMap was not cleared as expected");
+ assertEquals(0, viewMap.size(), "The ViewMap was not cleared as expected");
}
/**
@@ -61,7 +62,7 @@ public void testViewMapCleared() throws Exception
* BUILDING_VIEW_METADATA attribute is set. See MYFACES-4282.
*/
@Test
- public void testViewMapNotClearedWhileBuildingViewMetadata() throws Exception
+ void viewMapNotClearedWhileBuildingViewMetadata() throws Exception
{
FacesContextImpl fci = new FacesContextImpl(facesContext.getExternalContext(), null, null);
UIViewRoot firstRoot = new UIViewRoot();
@@ -73,6 +74,6 @@ public void testViewMapNotClearedWhileBuildingViewMetadata() throws Exception
// set a new view root - the old view root's ViewMap should NOT be cleared
fci.setViewRoot(secondRoot);
- Assertions.assertEquals(1, viewMap.size(), "The ViewMap was incorrectly cleared while the BUILDING_VIEW_METADATA attribute was set");
+ assertEquals(1, viewMap.size(), "The ViewMap was incorrectly cleared while the BUILDING_VIEW_METADATA attribute was set");
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/context/servlet/ServletExternalContextImplTest.java b/impl/src/test/java/org/apache/myfaces/context/servlet/ServletExternalContextImplTest.java
index 0d1dd4a67c..ff83a1a4a6 100644
--- a/impl/src/test/java/org/apache/myfaces/context/servlet/ServletExternalContextImplTest.java
+++ b/impl/src/test/java/org/apache/myfaces/context/servlet/ServletExternalContextImplTest.java
@@ -18,13 +18,14 @@
*/
package org.apache.myfaces.context.servlet;
-import java.io.IOException;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.Writer;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.apache.myfaces.test.mock.MockPrintWriter;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -35,7 +36,7 @@
* @author Jakob Korherr (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class ServletExternalContextImplTest extends AbstractFacesTestCase
+class ServletExternalContextImplTest extends AbstractFacesTestCase
{
private ServletExternalContextImpl _testExternalContext;
@@ -57,7 +58,7 @@ public void tearDown() throws Exception
super.tearDown();
}
-
+
/**
* Tests if encodeRedirectURL() and encodeBookmarkableURL() correctly
* evaluate ValueExpressions as parameters values.
@@ -95,7 +96,7 @@ public void testEncodeURLHandlesValueExpressionParameters()
}*/
@Test
- public void testEncodeRedirectUrlWithEmptyParamInBaseUrl()
+ void encodeRedirectUrlWithEmptyParamInBaseUrl()
{
// query parameter p1 has an empty value
String baseUrl = "/test?p1=&p2=test";
@@ -104,13 +105,13 @@ public void testEncodeRedirectUrlWithEmptyParamInBaseUrl()
final String redirectUrl = _testExternalContext.encodeRedirectURL(baseUrl, null);
// the URL should not change
- Assertions.assertTrue(redirectUrl.contains("p1="));
- Assertions.assertTrue(redirectUrl.contains("p2=test"));
+ assertTrue(redirectUrl.contains("p1="));
+ assertTrue(redirectUrl.contains("p2=test"));
}
@Test
- public void testEncodedSpaceInExistingQueryParameter()
+ void encodedSpaceInExistingQueryParameter()
{
// the base URL with an existing encoded query parameter
String baseUrl = "/test?p1=a+b";
@@ -119,12 +120,12 @@ public void testEncodedSpaceInExistingQueryParameter()
final String redirectUrl = _testExternalContext.encodeRedirectURL(baseUrl, null);
// the URL should not change
- Assertions.assertEquals(baseUrl, redirectUrl);
+ assertEquals(baseUrl, redirectUrl);
}
-
+
@Test
- public void testEncodedAmpersandInExistingQueryParameter()
+ void encodedAmpersandInExistingQueryParameter()
{
// the base URL with an existing encoded query parameter
String baseUrl = "/test?p1=a%26b";
@@ -133,12 +134,12 @@ public void testEncodedAmpersandInExistingQueryParameter()
final String redirectUrl = _testExternalContext.encodeRedirectURL(baseUrl, null);
// the URL should not change
- Assertions.assertEquals(baseUrl, redirectUrl);
+ assertEquals(baseUrl, redirectUrl);
}
@Test
- public void testSameParameterNames()
+ void sameParameterNames()
{
String baseUrl = "/test?par=test1&par=test2";
@@ -146,8 +147,8 @@ public void testSameParameterNames()
final String redirectUrl = _testExternalContext.encodeRedirectURL(baseUrl, null);
// the URL should not change
- Assertions.assertTrue(redirectUrl.contains("par=test1"));
- Assertions.assertTrue(redirectUrl.contains("par=test2"));
+ assertTrue(redirectUrl.contains("par=test1"));
+ assertTrue(redirectUrl.contains("par=test2"));
}
@@ -157,7 +158,7 @@ public void testSameParameterNames()
* discarded, everything written after it must still reach the container writer.
*/
@Test
- public void testResponseResetDiscardsBufferedOutputButKeepsWriterUsable() throws IOException
+ void responseResetDiscardsBufferedOutputButKeepsWriterUsable() throws Exception
{
Writer writer = _testExternalContext.getResponseOutputWriter();
writer.write("aborted response");
@@ -166,6 +167,6 @@ public void testResponseResetDiscardsBufferedOutputButKeepsWriterUsable() throws
writer.write("error page");
writer.flush();
- Assertions.assertEquals("error page", String.valueOf(((MockPrintWriter) response.getWriter()).content()));
+ assertEquals("error page", String.valueOf(((MockPrintWriter) response.getWriter()).content()));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/core/api/shared/ParametrizableFacesMessageTest.java b/impl/src/test/java/org/apache/myfaces/core/api/shared/ParametrizableFacesMessageTest.java
index db8c4ffb78..1ab4fbee1e 100644
--- a/impl/src/test/java/org/apache/myfaces/core/api/shared/ParametrizableFacesMessageTest.java
+++ b/impl/src/test/java/org/apache/myfaces/core/api/shared/ParametrizableFacesMessageTest.java
@@ -18,19 +18,21 @@
*/
package org.apache.myfaces.core.api.shared;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Set;
import jakarta.faces.application.FacesMessage;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class ParametrizableFacesMessageTest
+class ParametrizableFacesMessageTest
{
@Test
- public void testMessagesWithDifferentParametersAreNotEqual()
+ void messagesWithDifferentParametersAreNotEqual()
{
FacesMessage firstMessage = new ParametrizableFacesMessage(
FacesMessage.Severity.ERROR,
@@ -49,12 +51,12 @@ public void testMessagesWithDifferentParametersAreNotEqual()
messages.add(firstMessage);
messages.add(secondMessage);
- Assertions.assertNotEquals(firstMessage, secondMessage);
- Assertions.assertEquals(2, messages.size());
+ assertNotEquals(firstMessage, secondMessage);
+ assertEquals(2, messages.size());
}
@Test
- public void testMessagesWithSameParametersAreEqual()
+ void messagesWithSameParametersAreEqual()
{
FacesMessage firstMessage = new ParametrizableFacesMessage(
FacesMessage.Severity.ERROR,
@@ -69,12 +71,12 @@ public void testMessagesWithSameParametersAreEqual()
new Object[] { "input", "should be uppercase" },
Locale.ENGLISH);
- Assertions.assertEquals(firstMessage, secondMessage);
- Assertions.assertEquals(firstMessage.hashCode(), secondMessage.hashCode());
+ assertEquals(firstMessage, secondMessage);
+ assertEquals(firstMessage.hashCode(), secondMessage.hashCode());
}
@Test
- public void testMessageParametersAreUsedForFormatting()
+ void messageParametersAreUsedForFormatting()
{
FacesMessage message = new ParametrizableFacesMessage(
FacesMessage.Severity.ERROR,
@@ -83,7 +85,7 @@ public void testMessageParametersAreUsedForFormatting()
new Object[] { "input", "should be uppercase" },
Locale.ENGLISH);
- Assertions.assertEquals("input: should be uppercase", message.getSummary());
- Assertions.assertEquals("Detail for input: should be uppercase", message.getDetail());
+ assertEquals("input: should be uppercase", message.getSummary());
+ assertEquals("Detail for input: should be uppercase", message.getDetail());
}
}
\ No newline at end of file
diff --git a/impl/src/test/java/org/apache/myfaces/el/ResolverBuilderBaseTest.java b/impl/src/test/java/org/apache/myfaces/el/ResolverBuilderBaseTest.java
index fb0a278faa..354ef874d7 100644
--- a/impl/src/test/java/org/apache/myfaces/el/ResolverBuilderBaseTest.java
+++ b/impl/src/test/java/org/apache/myfaces/el/ResolverBuilderBaseTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.el;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -27,7 +29,6 @@
import org.apache.myfaces.config.RuntimeConfig;
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
@@ -36,7 +37,7 @@
* @author Mathias Broekelmann (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class ResolverBuilderBaseTest extends AbstractFacesTestCase
+class ResolverBuilderBaseTest extends AbstractFacesTestCase
{
private RuntimeConfig runtimeConfig;
private MyfacesConfig myfacesConfig;
@@ -55,25 +56,25 @@ public void setUp() throws Exception
}
@Test
- public void testGetFacesConfigElResolvers() throws Exception
+ void getFacesConfigElResolvers() throws Exception
{
ELResolver resolver = Mockito.mock(ELResolver.class);
Mockito.when(runtimeConfig.getFacesConfigElResolvers()).thenReturn(Arrays.asList(resolver));
resolverBuilder.addFromRuntimeConfig(resolvers);
- Assertions.assertEquals(Arrays.asList(resolver), resolvers);
+ assertEquals(Arrays.asList(resolver), resolvers);
}
-
+
@Test
- public void testGetApplicationElResolvers() throws Exception
+ void getApplicationElResolvers() throws Exception
{
ELResolver resolver = Mockito.mock(ELResolver.class);
Mockito.when(runtimeConfig.getApplicationElResolvers()).thenReturn(Arrays.asList(resolver));
resolverBuilder.addFromRuntimeConfig(resolvers);
- Assertions.assertEquals(Arrays.asList(resolver), resolvers);
+ assertEquals(Arrays.asList(resolver), resolvers);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/event/GlobalPostAddToViewEventTest.java b/impl/src/test/java/org/apache/myfaces/event/GlobalPostAddToViewEventTest.java
index 589af5472e..62d698d939 100644
--- a/impl/src/test/java/org/apache/myfaces/event/GlobalPostAddToViewEventTest.java
+++ b/impl/src/test/java/org/apache/myfaces/event/GlobalPostAddToViewEventTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.event;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIOutput;
import jakarta.faces.component.html.HtmlHead;
@@ -28,10 +31,9 @@
import org.apache.myfaces.application.ApplicationImplEventManager;
import org.apache.myfaces.test.base.junit.AbstractFacesConfigurableMockTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class GlobalPostAddToViewEventTest extends AbstractFacesConfigurableMockTestCase
+class GlobalPostAddToViewEventTest extends AbstractFacesConfigurableMockTestCase
{
public class HeadResourceListener implements SystemEventListener
{
@@ -49,7 +51,7 @@ public void processEvent(SystemEvent event)
}
@Test
- public void testPostAddToViewSourceNull() throws Exception
+ void postAddToViewSourceNull() throws Exception
{
ApplicationImplEventManager eventManager = new ApplicationImplEventManager();
@@ -57,11 +59,11 @@ public void testPostAddToViewSourceNull() throws Exception
eventManager.publishEvent(facesContext, PostAddToViewEvent.class, HtmlHead.class, new HtmlHead());
- Assertions.assertTrue(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
+ assertTrue(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
}
-
+
@Test
- public void testPostAddToViewSourceSuperClass() throws Exception
+ void postAddToViewSourceSuperClass() throws Exception
{
ApplicationImplEventManager eventManager = new ApplicationImplEventManager();
@@ -69,11 +71,11 @@ public void testPostAddToViewSourceSuperClass() throws Exception
eventManager.publishEvent(facesContext, PostAddToViewEvent.class, HtmlHead.class, new HtmlHead());
- Assertions.assertTrue(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
+ assertTrue(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
}
-
+
@Test
- public void testPostAddToViewSourceDirect() throws Exception
+ void postAddToViewSourceDirect() throws Exception
{
ApplicationImplEventManager eventManager = new ApplicationImplEventManager();
@@ -81,11 +83,11 @@ public void testPostAddToViewSourceDirect() throws Exception
eventManager.publishEvent(facesContext, PostAddToViewEvent.class, HtmlHead.class, new HtmlHead());
- Assertions.assertTrue(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
+ assertTrue(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
}
-
+
@Test
- public void testPostAddToViewSourceUnmatching() throws Exception
+ void postAddToViewSourceUnmatching() throws Exception
{
ApplicationImplEventManager eventManager = new ApplicationImplEventManager();
@@ -93,6 +95,6 @@ public void testPostAddToViewSourceUnmatching() throws Exception
eventManager.publishEvent(facesContext, PostAddToViewEvent.class, HtmlHead.class, new HtmlHead());
- Assertions.assertFalse(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
+ assertFalse(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/event/PostAddToViewEventTest.java b/impl/src/test/java/org/apache/myfaces/event/PostAddToViewEventTest.java
index db8122e850..b7fd2e09e8 100644
--- a/impl/src/test/java/org/apache/myfaces/event/PostAddToViewEventTest.java
+++ b/impl/src/test/java/org/apache/myfaces/event/PostAddToViewEventTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.event;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.faces.application.StateManager;
import jakarta.faces.component.UICommand;
import jakarta.faces.component.UIForm;
@@ -32,10 +34,9 @@
import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage;
import org.easymock.EasyMock;
import org.easymock.IAnswer;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class PostAddToViewEventTest extends AbstractMyFacesCDIRequestTestCase
+class PostAddToViewEventTest extends AbstractMyFacesCDIRequestTestCase
{
@@ -54,7 +55,7 @@ protected void setUpWebConfigParams() throws Exception
* @throws Exception
*/
@Test
- public void testPostAddToViewOnViewRoot() throws Exception
+ void postAddToViewOnViewRoot() throws Exception
{
startViewRequest("/postAddToViewEvent_1.xhtml");
@@ -62,8 +63,8 @@ public void testPostAddToViewOnViewRoot() throws Exception
bean.invokePostAddToViewEvent(EasyMock.isA(ComponentSystemEvent.class));
EasyMock.expectLastCall().andAnswer(() -> {
ComponentSystemEvent e = (ComponentSystemEvent) EasyMock.getCurrentArguments()[0];
- Assertions.assertTrue(e.getComponent() instanceof UIViewRoot);
- Assertions.assertEquals(PhaseId.RENDER_RESPONSE, facesContext.getCurrentPhaseId());
+ assertInstanceOf(UIViewRoot.class, e.getComponent());
+ assertEquals(PhaseId.RENDER_RESPONSE, facesContext.getCurrentPhaseId());
return null;
}).once();
EasyMock.replay(bean);
@@ -81,10 +82,10 @@ public void testPostAddToViewOnViewRoot() throws Exception
// but when building initial state.
EasyMock.expectLastCall().andAnswer(() -> {
ComponentSystemEvent e = (ComponentSystemEvent) EasyMock.getCurrentArguments()[0];
- Assertions.assertTrue(e.getComponent() instanceof UIViewRoot);
- Assertions.assertEquals(PhaseId.RESTORE_VIEW, facesContext.getCurrentPhaseId());
- Assertions.assertTrue(facesContext.getAttributes().containsKey("jakarta.faces.IS_BUILDING_INITIAL_STATE"));
- Assertions.assertFalse(FaceletViewDeclarationLanguage.isRefreshingTransientBuild(facesContext));
+ assertInstanceOf(UIViewRoot.class, e.getComponent());
+ assertEquals(PhaseId.RESTORE_VIEW, facesContext.getCurrentPhaseId());
+ assertTrue(facesContext.getAttributes().containsKey("jakarta.faces.IS_BUILDING_INITIAL_STATE"));
+ assertFalse(FaceletViewDeclarationLanguage.isRefreshingTransientBuild(facesContext));
return null;
}).once();
@@ -99,14 +100,14 @@ public static interface PostAddToViewEventBean
{
public void invokePostAddToViewEvent(ComponentSystemEvent e);
}
-
+
/**
* Test a component receive PostAddToViewEvent
*
* @throws Exception
*/
@Test
- public void testPostAddToViewOnComponent() throws Exception
+ void postAddToViewOnComponent() throws Exception
{
startViewRequest("/postAddToViewEvent_2.xhtml");
@@ -118,8 +119,8 @@ public Object answer()
{
ComponentSystemEvent e = (ComponentSystemEvent) EasyMock
.getCurrentArguments()[0];
- Assertions.assertTrue(e.getComponent() instanceof UIForm);
- Assertions.assertEquals(PhaseId.RENDER_RESPONSE, facesContext.getCurrentPhaseId());
+ assertInstanceOf(UIForm.class, e.getComponent());
+ assertEquals(PhaseId.RENDER_RESPONSE, facesContext.getCurrentPhaseId());
return null;
}
}).once();
@@ -142,10 +143,10 @@ public Object answer()
{
ComponentSystemEvent e = (ComponentSystemEvent) EasyMock
.getCurrentArguments()[0];
- Assertions.assertTrue(e.getComponent() instanceof UIForm);
- Assertions.assertEquals(PhaseId.RESTORE_VIEW, facesContext.getCurrentPhaseId());
- Assertions.assertTrue(facesContext.getAttributes().containsKey("jakarta.faces.IS_BUILDING_INITIAL_STATE"));
- Assertions.assertFalse(FaceletViewDeclarationLanguage.isRefreshingTransientBuild(facesContext));
+ assertInstanceOf(UIForm.class, e.getComponent());
+ assertEquals(PhaseId.RESTORE_VIEW, facesContext.getCurrentPhaseId());
+ assertTrue(facesContext.getAttributes().containsKey("jakarta.faces.IS_BUILDING_INITIAL_STATE"));
+ assertFalse(FaceletViewDeclarationLanguage.isRefreshingTransientBuild(facesContext));
return null;
}
}).once();
@@ -163,14 +164,14 @@ public Object answer()
* @throws Exception
*/
@Test
- public void testPostAddToViewOnComponentCif() throws Exception
+ void postAddToViewOnComponentCif() throws Exception
{
startViewRequest("/postAddToViewEvent_3.xhtml");
PostAddToViewEventBean bean = EasyMock.createMock(PostAddToViewEventBean.class);
bean.invokePostAddToViewEvent(EasyMock.isA(ComponentSystemEvent.class));
EasyMock.expectLastCall().andAnswer(() -> {
- Assertions.fail();
+ fail();
return null;
}).anyTimes();
EasyMock.replay(bean);
@@ -187,7 +188,7 @@ public void testPostAddToViewOnComponentCif() throws Exception
bean = EasyMock.createMock(PostAddToViewEventBean.class);
bean.invokePostAddToViewEvent(EasyMock.isA(ComponentSystemEvent.class));
EasyMock.expectLastCall().andAnswer(() -> {
- Assertions.fail();
+ fail();
return null;
}).anyTimes();
@@ -201,8 +202,8 @@ public void testPostAddToViewOnComponentCif() throws Exception
bean.invokePostAddToViewEvent(EasyMock.isA(ComponentSystemEvent.class));
EasyMock.expectLastCall().andAnswer(() -> {
ComponentSystemEvent e = (ComponentSystemEvent) EasyMock.getCurrentArguments()[0];
- Assertions.assertTrue(e.getComponent() instanceof UIPanel);
- Assertions.assertEquals(PhaseId.RENDER_RESPONSE, facesContext.getCurrentPhaseId());
+ assertInstanceOf(UIPanel.class, e.getComponent());
+ assertEquals(PhaseId.RENDER_RESPONSE, facesContext.getCurrentPhaseId());
return null;
}).once();
EasyMock.replay(bean);
@@ -212,10 +213,10 @@ public void testPostAddToViewOnComponentCif() throws Exception
renderResponse();
EasyMock.verify(bean);
}
-
-
+
+
@Test
- public void testPostAddToViewOnComponentHead() throws Exception
+ void postAddToViewOnComponentHead() throws Exception
{
startViewRequest("/postAddToViewEvent_4.xhtml");
@@ -223,8 +224,8 @@ public void testPostAddToViewOnComponentHead() throws Exception
bean.invokePostAddToViewEvent(EasyMock.isA(ComponentSystemEvent.class));
EasyMock.expectLastCall().andAnswer(() -> {
ComponentSystemEvent e = (ComponentSystemEvent) EasyMock.getCurrentArguments()[0];
- Assertions.assertTrue(e.getComponent() instanceof UIOutput);
- Assertions.assertTrue(e.getComponent().getRendererType().equals("jakarta.faces.Head"));
+ assertInstanceOf(UIOutput.class, e.getComponent());
+ assertEquals("jakarta.faces.Head", e.getComponent().getRendererType());
return null;
}).once();
EasyMock.replay(bean);
@@ -242,8 +243,8 @@ public void testPostAddToViewOnComponentHead() throws Exception
// but when building initial state.
EasyMock.expectLastCall().andAnswer(() -> {
ComponentSystemEvent e = (ComponentSystemEvent) EasyMock.getCurrentArguments()[0];
- Assertions.assertTrue(e.getComponent() instanceof UIOutput);
- Assertions.assertTrue(e.getComponent().getRendererType().equals("jakarta.faces.Head"));
+ assertInstanceOf(UIOutput.class, e.getComponent());
+ assertEquals("jakarta.faces.Head", e.getComponent().getRendererType());
return null;
}).once();
diff --git a/impl/src/test/java/org/apache/myfaces/flow/FlowBuilderTest.java b/impl/src/test/java/org/apache/myfaces/flow/FlowBuilderTest.java
index 018bb67b20..90627b62b9 100644
--- a/impl/src/test/java/org/apache/myfaces/flow/FlowBuilderTest.java
+++ b/impl/src/test/java/org/apache/myfaces/flow/FlowBuilderTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.flow;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.faces.context.FacesContext;
import jakarta.faces.flow.Flow;
import jakarta.faces.flow.FlowCallNode;
@@ -31,50 +33,49 @@
import jakarta.faces.flow.builder.SwitchCaseBuilder;
import org.apache.myfaces.flow.builder.FlowBuilderImpl;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
*
* @author lu4242
*/
-public class FlowBuilderTest extends AbstractFacesTestCase
+class FlowBuilderTest extends AbstractFacesTestCase
{
-
+
@Test
- public void testFlowBuilderSimple()
+ void flowBuilderSimple()
{
FlowBuilder flowBuilder = new FlowBuilderImpl();
flowBuilder.id("faces-flow1.xhtml", "flow1").
initializer("#{bean.init}").finalizer("#{bean.destroy}");
Flow flow = flowBuilder.getFlow();
- Assertions.assertNotNull(flow);
- Assertions.assertEquals("flow1", flow.getId());
- Assertions.assertEquals("faces-flow1.xhtml", flow.getDefiningDocumentId());
- Assertions.assertEquals("#{bean.init}", flow.getInitializer().getExpressionString());
- Assertions.assertEquals("#{bean.destroy}", flow.getFinalizer().getExpressionString());
+ assertNotNull(flow);
+ assertEquals("flow1", flow.getId());
+ assertEquals("faces-flow1.xhtml", flow.getDefiningDocumentId());
+ assertEquals("#{bean.init}", flow.getInitializer().getExpressionString());
+ assertEquals("#{bean.destroy}", flow.getFinalizer().getExpressionString());
}
-
+
@Test
- public void testFlowBuilderReturn()
+ void flowBuilderReturn()
{
FlowBuilder flowBuilder = new FlowBuilderImpl();
flowBuilder.id("faces-flow1.xhtml", "flow1");
flowBuilder.returnNode("returnNode").markAsStartNode().fromOutcome("mynode");
Flow flow = flowBuilder.getFlow();
- Assertions.assertNotNull(flow);
- Assertions.assertEquals("returnNode", flow.getStartNodeId());
+ assertNotNull(flow);
+ assertEquals("returnNode", flow.getStartNodeId());
ReturnNode returnNode = flow.getReturns().get("returnNode");
- Assertions.assertNotNull(returnNode);
- Assertions.assertEquals("returnNode", returnNode.getId());
- Assertions.assertEquals("mynode", returnNode.getFromOutcome(facesContext));
- }
+ assertNotNull(returnNode);
+ assertEquals("returnNode", returnNode.getId());
+ assertEquals("mynode", returnNode.getFromOutcome(facesContext));
+ }
@Test
- public void testFlowBuilderSwitch()
+ void flowBuilderSwitch()
{
externalContext.getRequestMap().put("bean", new SimpleBean());
FlowBuilder flowBuilder = new FlowBuilderImpl();
@@ -91,24 +92,24 @@ public void testFlowBuilderSwitch()
.fromOutcome("caseC");
Flow flow = flowBuilder.getFlow();
- Assertions.assertNotNull(flow);
- Assertions.assertEquals("switch1", flow.getStartNodeId());
+ assertNotNull(flow);
+ assertEquals("switch1", flow.getStartNodeId());
SwitchNode switchNode = flow.getSwitches().get("switch1");
- Assertions.assertNotNull(switchNode);
- Assertions.assertEquals("exit", switchNode.getDefaultOutcome(facesContext));
+ assertNotNull(switchNode);
+ assertEquals("exit", switchNode.getDefaultOutcome(facesContext));
SwitchCase scn = switchNode.getCases().get(0);
- Assertions.assertTrue(scn.getCondition(facesContext));
- Assertions.assertEquals("case1", scn.getFromOutcome());
+ assertTrue(scn.getCondition(facesContext));
+ assertEquals("case1", scn.getFromOutcome());
scn = switchNode.getCases().get(1);
- Assertions.assertTrue(scn.getCondition(facesContext));
- Assertions.assertEquals("caseB", scn.getFromOutcome());
+ assertTrue(scn.getCondition(facesContext));
+ assertEquals("caseB", scn.getFromOutcome());
scn = switchNode.getCases().get(2);
- Assertions.assertTrue(scn.getCondition(facesContext));
- Assertions.assertEquals("caseC", scn.getFromOutcome());
+ assertTrue(scn.getCondition(facesContext));
+ assertEquals("caseC", scn.getFromOutcome());
}
public static class SimpleBean {
@@ -131,9 +132,9 @@ public void checkTo(FacesContext context)
{
}
}
-
+
@Test
- public void testFlowBuilderView()
+ void flowBuilderView()
{
FlowBuilder flowBuilder = new FlowBuilderImpl();
flowBuilder.id("faces-flow1.xhtml", "flow1");
@@ -141,20 +142,20 @@ public void testFlowBuilderView()
flowBuilder.viewNode("y", "y.xhtml").markAsStartNode();
Flow flow = flowBuilder.getFlow();
- Assertions.assertNotNull(flow);
- Assertions.assertEquals("y", flow.getStartNodeId());
+ assertNotNull(flow);
+ assertEquals("y", flow.getStartNodeId());
ViewNode viewNode = flow.getViews().get(0);
- Assertions.assertEquals("x", viewNode.getId());
- Assertions.assertEquals("x.xhtml", viewNode.getVdlDocumentId());
+ assertEquals("x", viewNode.getId());
+ assertEquals("x.xhtml", viewNode.getVdlDocumentId());
viewNode = flow.getViews().get(1);
- Assertions.assertEquals("y", viewNode.getId());
- Assertions.assertEquals("y.xhtml", viewNode.getVdlDocumentId());
+ assertEquals("y", viewNode.getId());
+ assertEquals("y.xhtml", viewNode.getVdlDocumentId());
}
-
+
@Test
- public void testFlowBuilderInboundParameter()
+ void flowBuilderInboundParameter()
{
externalContext.getRequestMap().put("bean", new SimpleBean());
FlowBuilder flowBuilder = new FlowBuilderImpl();
@@ -165,23 +166,23 @@ public void testFlowBuilderInboundParameter()
application.getExpressionFactory().createValueExpression("value3", String.class));
Flow flow = flowBuilder.getFlow();
- Assertions.assertNotNull(flow);
+ assertNotNull(flow);
Parameter param = flow.getInboundParameters().get("name1");
- Assertions.assertEquals("name1", param.getName());
- Assertions.assertEquals("value1", param.getValue().getValue(facesContext.getELContext()));
+ assertEquals("name1", param.getName());
+ assertEquals("value1", param.getValue().getValue(facesContext.getELContext()));
param = flow.getInboundParameters().get("name2");
- Assertions.assertEquals("name2", param.getName());
- Assertions.assertEquals("asdf", param.getValue().getValue(facesContext.getELContext()));
+ assertEquals("name2", param.getName());
+ assertEquals("asdf", param.getValue().getValue(facesContext.getELContext()));
param = flow.getInboundParameters().get("name3");
- Assertions.assertEquals("name3", param.getName());
- Assertions.assertEquals("value3", param.getValue().getValue(facesContext.getELContext()));
+ assertEquals("name3", param.getName());
+ assertEquals("value3", param.getValue().getValue(facesContext.getELContext()));
}
@Test
- public void testFlowBuilderMethodCall()
+ void flowBuilderMethodCall()
{
FlowBuilder flowBuilder = new FlowBuilderImpl();
flowBuilder.id("faces-flow1.xhtml", "flow1");
@@ -190,22 +191,22 @@ public void testFlowBuilderMethodCall()
new Class[]{FacesContext.class}).defaultOutcome("case2");
Flow flow = flowBuilder.getFlow();
- Assertions.assertNotNull(flow);
- Assertions.assertEquals("method1", flow.getStartNodeId());
+ assertNotNull(flow);
+ assertEquals("method1", flow.getStartNodeId());
MethodCallNode mcn = flow.getMethodCalls().get(0);
- Assertions.assertEquals("method1", mcn.getId());
- Assertions.assertEquals("case1", mcn.getOutcome().getValue(facesContext.getELContext()));
- Assertions.assertEquals("#{bean.check}", mcn.getMethodExpression().getExpressionString());
+ assertEquals("method1", mcn.getId());
+ assertEquals("case1", mcn.getOutcome().getValue(facesContext.getELContext()));
+ assertEquals("#{bean.check}", mcn.getMethodExpression().getExpressionString());
mcn = flow.getMethodCalls().get(1);
- Assertions.assertEquals("method2", mcn.getId());
- Assertions.assertEquals("case2", mcn.getOutcome().getValue(facesContext.getELContext()));
- Assertions.assertEquals("#{bean.checkTo}", mcn.getMethodExpression().getExpressionString());
+ assertEquals("method2", mcn.getId());
+ assertEquals("case2", mcn.getOutcome().getValue(facesContext.getELContext()));
+ assertEquals("#{bean.checkTo}", mcn.getMethodExpression().getExpressionString());
}
-
+
@Test
- public void testFlowBuilderFlowCall()
+ void flowBuilderFlowCall()
{
FlowBuilder flowBuilder = new FlowBuilderImpl();
flowBuilder.id("faces-flow1.xhtml", "flow1");
@@ -214,17 +215,17 @@ public void testFlowBuilderFlowCall()
flowReference("faces-flow2.xhtml", "flow2").markAsStartNode();
Flow flow = flowBuilder.getFlow();
- Assertions.assertNotNull(flow);
- Assertions.assertEquals("goToFlow2", flow.getStartNodeId());
+ assertNotNull(flow);
+ assertEquals("goToFlow2", flow.getStartNodeId());
FlowCallNode flowCallNode = flow.getFlowCalls().get("goToFlow2");
- Assertions.assertNotNull(flowCallNode);
- Assertions.assertEquals("flow2", flowCallNode.getCalledFlowId(facesContext));
- Assertions.assertEquals("faces-flow2.xhtml", flowCallNode.getCalledFlowDocumentId(facesContext));
+ assertNotNull(flowCallNode);
+ assertEquals("flow2", flowCallNode.getCalledFlowId(facesContext));
+ assertEquals("faces-flow2.xhtml", flowCallNode.getCalledFlowDocumentId(facesContext));
Parameter param = flowCallNode.getOutboundParameters().get("name1");
- Assertions.assertEquals("name1", param.getName());
- Assertions.assertEquals("value1", param.getValue().getValue(facesContext.getELContext()));
+ assertEquals("name1", param.getName());
+ assertEquals("value1", param.getValue().getValue(facesContext.getELContext()));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/lifecycle/RedirectTest.java b/impl/src/test/java/org/apache/myfaces/lifecycle/RedirectTest.java
index d74f8ad22a..606ef598ba 100644
--- a/impl/src/test/java/org/apache/myfaces/lifecycle/RedirectTest.java
+++ b/impl/src/test/java/org/apache/myfaces/lifecycle/RedirectTest.java
@@ -20,16 +20,18 @@
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.test.core.AbstractMyFacesRequestTestCase;
-import org.junit.jupiter.api.Assertions;
+
import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* This class test
*/
-public class RedirectTest extends AbstractMyFacesCDIRequestTestCase
+class RedirectTest extends AbstractMyFacesCDIRequestTestCase
{
@Test
- public void testRedirect1() throws Exception
+ void redirect1() throws Exception
{
startViewRequest("/redirect1.xhtml");
processLifecycleExecute();
@@ -39,6 +41,6 @@ public void testRedirect1() throws Exception
client.processRedirect();
processLifecycleExecuteAndRender();
String redirectedContent = getRenderedContent();
- Assertions.assertTrue(redirectedContent.contains("Redirected Page"));
+ assertTrue(redirectedContent.contains("Redirected Page"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/lifecycle/RenderResponseExecutorTest.java b/impl/src/test/java/org/apache/myfaces/lifecycle/RenderResponseExecutorTest.java
index 409543eb06..069dbcecf6 100644
--- a/impl/src/test/java/org/apache/myfaces/lifecycle/RenderResponseExecutorTest.java
+++ b/impl/src/test/java/org/apache/myfaces/lifecycle/RenderResponseExecutorTest.java
@@ -18,18 +18,19 @@
*/
package org.apache.myfaces.lifecycle;
-import jakarta.faces.component.UIViewRoot;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Assertions;
+import jakarta.faces.component.UIViewRoot;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.junit.jupiter.api.Test;
-public class RenderResponseExecutorTest extends AbstractFacesTestCase
+class RenderResponseExecutorTest extends AbstractFacesTestCase
{
@Test
- public void testNavigationCondition() throws Exception
+ void navigationCondition() throws Exception
{
UIViewRoot a = new UIViewRoot();
UIViewRoot b = new UIViewRoot();
@@ -40,22 +41,22 @@ public void testNavigationCondition() throws Exception
c.setViewId("/c.xhtml");
//If the view was not changed continue (return false)
- Assertions.assertFalse(checkCondition(a, a));
+ assertFalse(checkCondition(a, a));
//If the view is different instance but same viewId iterate again (return true)
- Assertions.assertTrue(checkCondition(a, b));
+ assertTrue(checkCondition(a, b));
//If the view is different instance and different id iterate again
- Assertions.assertTrue(checkCondition(a, c));
+ assertTrue(checkCondition(a, c));
//If the view is different instance and id is null iterate again
- Assertions.assertTrue(checkCondition(a, d));
+ assertTrue(checkCondition(a, d));
//If the view is different instance and id is not null iterate again
- Assertions.assertTrue(checkCondition(d, a));
+ assertTrue(checkCondition(d, a));
//If the view was not change continue (return false)
- Assertions.assertFalse(checkCondition(d, d));
+ assertFalse(checkCondition(d, d));
}
protected boolean checkCondition(UIViewRoot previousRoot, UIViewRoot root)
diff --git a/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java b/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java
index 28c13328ea..dc1e948c0c 100644
--- a/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java
+++ b/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.lifecycle;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.Locale;
import jakarta.faces.application.ViewHandler;
@@ -26,7 +28,6 @@
import org.apache.myfaces.application.ViewIdSupport;
import org.apache.myfaces.test.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
@@ -60,7 +61,7 @@ public void setUp() throws Exception
* {@link org.apache.myfaces.lifecycle.RestoreViewExecutor#execute(jakarta.faces.context.FacesContext)}.
*/
@Test
- public void testExecuteWithExistingViewRoot()
+ void executeWithExistingViewRoot()
{
Mockito.when(_facesContext.getApplication()).thenReturn(_application);
Mockito.when(_application.getViewHandler()).thenReturn(_viewHandler);
@@ -83,7 +84,7 @@ public void testExecuteWithExistingViewRoot()
*/
public void testGetPhase()
{
- Assertions.assertEquals(PhaseId.RESTORE_VIEW, _testimpl.getPhase());
+ assertEquals(PhaseId.RESTORE_VIEW, _testimpl.getPhase());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/push/JsonEncodingTest.java b/impl/src/test/java/org/apache/myfaces/push/JsonEncodingTest.java
index 78aab2f408..7ce69953eb 100644
--- a/impl/src/test/java/org/apache/myfaces/push/JsonEncodingTest.java
+++ b/impl/src/test/java/org/apache/myfaces/push/JsonEncodingTest.java
@@ -25,14 +25,14 @@
import org.junit.jupiter.api.Test;
-public class JsonEncodingTest
+class JsonEncodingTest
{
/*
* Ensure JSON.encode can encode record objects.
*/
@Test
- public void testRecordEncoding()
+ void recordEncoding()
{
String expected = "{name:\"Chikorita\",type:\"Grass\",itemHeld:false,moves:[\"Tackle\",\"Growl\",\"Razor Leaf\"]}";
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/ContentTypeUtilsTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/ContentTypeUtilsTest.java
index af4183480f..6ff36f63df 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/ContentTypeUtilsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/ContentTypeUtilsTest.java
@@ -19,63 +19,65 @@
package org.apache.myfaces.renderkit;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
+
import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
+
public class ContentTypeUtilsTest extends AbstractFacesTestCase
{
@Test
- public void testContainsContentType() throws Exception
+ void containsContentType() throws Exception
{
- Assertions.assertTrue(ContentTypeUtils.containsContentType(
+ assertTrue(ContentTypeUtils.containsContentType(
ContentTypeUtils.HTML_CONTENT_TYPE, ContentTypeUtils.HTML_ALLOWED_CONTENT_TYPES));
- Assertions.assertTrue(ContentTypeUtils.containsContentType(
+ assertTrue(ContentTypeUtils.containsContentType(
ContentTypeUtils.ANY_CONTENT_TYPE, ContentTypeUtils.HTML_ALLOWED_CONTENT_TYPES));
- Assertions.assertTrue(ContentTypeUtils.containsContentType(
+ assertTrue(ContentTypeUtils.containsContentType(
ContentTypeUtils.TEXT_ANY_CONTENT_TYPE, ContentTypeUtils.HTML_ALLOWED_CONTENT_TYPES));
- Assertions.assertTrue(ContentTypeUtils.containsContentType(
+ assertTrue(ContentTypeUtils.containsContentType(
ContentTypeUtils.XHTML_CONTENT_TYPE, ContentTypeUtils.XHTML_ALLOWED_CONTENT_TYPES));
- Assertions.assertTrue(ContentTypeUtils.containsContentType(
+ assertTrue(ContentTypeUtils.containsContentType(
ContentTypeUtils.APPLICATION_XML_CONTENT_TYPE, ContentTypeUtils.XHTML_ALLOWED_CONTENT_TYPES));
- Assertions.assertTrue(ContentTypeUtils.containsContentType(
+ assertTrue(ContentTypeUtils.containsContentType(
ContentTypeUtils.TEXT_XML_CONTENT_TYPE, ContentTypeUtils.XHTML_ALLOWED_CONTENT_TYPES));
}
-
+
@Test
- public void testSplitContentTypeListString() throws Exception
+ void splitContentTypeListString() throws Exception
{
String [] splittedArray = ContentTypeUtils.splitContentTypeListString("text/*, text/html ");
- Assertions.assertTrue(ContentTypeUtils.containsContentType(
+ assertTrue(ContentTypeUtils.containsContentType(
ContentTypeUtils.HTML_CONTENT_TYPE, splittedArray));
- Assertions.assertTrue(ContentTypeUtils.containsContentType(
+ assertTrue(ContentTypeUtils.containsContentType(
ContentTypeUtils.TEXT_ANY_CONTENT_TYPE, splittedArray));
splittedArray = ContentTypeUtils.splitContentTypeListString(" text/x-dvi; q=.8; mxb=100000; mxt=5.0, text/x-c");
- Assertions.assertTrue(ContentTypeUtils.containsContentType(
+ assertTrue(ContentTypeUtils.containsContentType(
"text/x-dvi", splittedArray));
- Assertions.assertTrue(ContentTypeUtils.containsContentType(
+ assertTrue(ContentTypeUtils.containsContentType(
"text/x-c", splittedArray));
}
public void testChooseWriterContentType() throws Exception
{
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE,
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE,
ContentTypeUtils.chooseWriterContentType(
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
ContentTypeUtils.HTML_ALLOWED_CONTENT_TYPES,
ContentTypeUtils.XHTML_ALLOWED_CONTENT_TYPES));
- Assertions.assertEquals(ContentTypeUtils.XHTML_CONTENT_TYPE,
+ assertEquals(ContentTypeUtils.XHTML_CONTENT_TYPE,
ContentTypeUtils.chooseWriterContentType(
"application/xml, text/xml , */*; q=0.01",
ContentTypeUtils.HTML_ALLOWED_CONTENT_TYPES,
ContentTypeUtils.XHTML_ALLOWED_CONTENT_TYPES));
//In ajax request application/xml and text/xml does not match.
- Assertions.assertNull(ContentTypeUtils.chooseWriterContentType(
+ assertNull(ContentTypeUtils.chooseWriterContentType(
"application/xml, text/xml, */*; q=0.01",
ContentTypeUtils.HTML_ALLOWED_CONTENT_TYPES,
ContentTypeUtils.AJAX_XHTML_ALLOWED_CONTENT_TYPES));
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/ErrorPageWriterTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/ErrorPageWriterTest.java
index 88e035dbf2..878a92a39c 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/ErrorPageWriterTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/ErrorPageWriterTest.java
@@ -18,7 +18,8 @@
*/
package org.apache.myfaces.renderkit;
-import java.io.IOException;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.el.ValueExpression;
@@ -35,7 +36,6 @@
import org.apache.myfaces.test.mock.MockRenderKitFactory;
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -43,7 +43,7 @@
* @author Bruno Aranda (latest modification by $Author: struberg $)
* @version $Revision: 1188235 $ $Date: 2011-10-24 13:09:33 -0400 (Mon, 24 Oct 2011) $
*/
-public class ErrorPageWriterTest extends AbstractFacesTestCase
+class ErrorPageWriterTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
private HtmlOutputText outputText;
@@ -79,7 +79,7 @@ public void tearDown() throws Exception
}
@Test
- public void testValueExpressionGetExpressionStringReturnsNull() throws IOException
+ void valueExpressionGetExpressionStringReturnsNull() throws Exception
{
//See MYFACES-3413 for details
UIViewRoot root = facesContext.getViewRoot();
@@ -106,7 +106,7 @@ public void testValueExpressionGetExpressionStringReturnsNull() throws IOExcepti
}
int indexOfHasRenderedAttribute = output.indexOf("rendered=\"\"");
boolean hasRenderedAttribute = (-1 != indexOfHasRenderedAttribute);
- Assertions.assertTrue(hasRenderedAttribute, "rendered attribute wasn't written correctly: " + surroundingText);
+ assertTrue(hasRenderedAttribute, "rendered attribute wasn't written correctly: " + surroundingText);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/HtmlRenderKitImplTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/HtmlRenderKitImplTest.java
index 804b6d75a4..75878b09c7 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/HtmlRenderKitImplTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/HtmlRenderKitImplTest.java
@@ -18,32 +18,33 @@
*/
package org.apache.myfaces.renderkit;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.io.StringWriter;
-import org.junit.jupiter.api.Assertions;
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.renderkit.html.HtmlRenderKitImpl;
import org.apache.myfaces.renderkit.html.HtmlResponseWriterImpl;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.junit.jupiter.api.Test;
-public class HtmlRenderKitImplTest extends AbstractFacesTestCase
+class HtmlRenderKitImplTest extends AbstractFacesTestCase
{
@Test
- public void testCreateResponseWriterContentType1()
+ void createResponseWriterContentType1()
{
MyfacesConfig config = new MyfacesConfig();
facesContext.getExternalContext().getApplicationMap().put(MyfacesConfig.class.getName(), config);
HtmlRenderKitImpl renderKit = new HtmlRenderKitImpl();
StringWriter writer = new StringWriter();
HtmlResponseWriterImpl responseWriter = (HtmlResponseWriterImpl) renderKit.createResponseWriter(writer, null, null);
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
}
-
+
@Test
- public void testCreateResponseWriterContentType2()
+ void createResponseWriterContentType2()
{
servletContext.setInitParameter(MyfacesConfig.DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE,
ContentTypeUtils.XHTML_CONTENT_TYPE);
@@ -53,12 +54,12 @@ public void testCreateResponseWriterContentType2()
HtmlRenderKitImpl renderKit = new HtmlRenderKitImpl();
StringWriter writer = new StringWriter();
HtmlResponseWriterImpl responseWriter = (HtmlResponseWriterImpl) renderKit.createResponseWriter(writer, null, null);
- Assertions.assertEquals(ContentTypeUtils.XHTML_CONTENT_TYPE, responseWriter.getContentType());
- Assertions.assertEquals(ContentTypeUtils.XHTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
+ assertEquals(ContentTypeUtils.XHTML_CONTENT_TYPE, responseWriter.getContentType());
+ assertEquals(ContentTypeUtils.XHTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
}
-
+
@Test
- public void testCreateResponseWriterContentType3()
+ void createResponseWriterContentType3()
{
MyfacesConfig config = new MyfacesConfig();
facesContext.getExternalContext().getApplicationMap().put(MyfacesConfig.class.getName(), config);
@@ -67,12 +68,12 @@ public void testCreateResponseWriterContentType3()
HtmlRenderKitImpl renderKit = new HtmlRenderKitImpl();
StringWriter writer = new StringWriter();
HtmlResponseWriterImpl responseWriter = (HtmlResponseWriterImpl) renderKit.createResponseWriter(writer, null, null);
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
}
-
+
@Test
- public void testCreateResponseWriterContentType4()
+ void createResponseWriterContentType4()
{
MyfacesConfig config = new MyfacesConfig();
facesContext.getExternalContext().getApplicationMap().put(MyfacesConfig.class.getName(), config);
@@ -81,12 +82,12 @@ public void testCreateResponseWriterContentType4()
HtmlRenderKitImpl renderKit = new HtmlRenderKitImpl();
StringWriter writer = new StringWriter();
HtmlResponseWriterImpl responseWriter = (HtmlResponseWriterImpl) renderKit.createResponseWriter(writer, null, null);
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
}
-
+
@Test
- public void testCreateResponseWriterContentType5()
+ void createResponseWriterContentType5()
{
MyfacesConfig config = new MyfacesConfig();
facesContext.getExternalContext().getApplicationMap().put(MyfacesConfig.class.getName(), config);
@@ -94,12 +95,12 @@ public void testCreateResponseWriterContentType5()
HtmlRenderKitImpl renderKit = new HtmlRenderKitImpl();
StringWriter writer = new StringWriter();
HtmlResponseWriterImpl responseWriter = (HtmlResponseWriterImpl) renderKit.createResponseWriter(writer, null, null);
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
}
-
+
@Test
- public void testCreateResponseWriterContentType6()
+ void createResponseWriterContentType6()
{
MyfacesConfig config = new MyfacesConfig();
facesContext.getExternalContext().getApplicationMap().put(MyfacesConfig.class.getName(), config);
@@ -107,12 +108,12 @@ public void testCreateResponseWriterContentType6()
HtmlRenderKitImpl renderKit = new HtmlRenderKitImpl();
StringWriter writer = new StringWriter();
HtmlResponseWriterImpl responseWriter = (HtmlResponseWriterImpl) renderKit.createResponseWriter(writer, null, null);
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
}
-
+
@Test
- public void testCreateResponseWriterContentType7()
+ void createResponseWriterContentType7()
{
MyfacesConfig config = new MyfacesConfig();
facesContext.getExternalContext().getApplicationMap().put(MyfacesConfig.class.getName(), config);
@@ -121,12 +122,12 @@ public void testCreateResponseWriterContentType7()
HtmlRenderKitImpl renderKit = new HtmlRenderKitImpl();
StringWriter writer = new StringWriter();
HtmlResponseWriterImpl responseWriter = (HtmlResponseWriterImpl) renderKit.createResponseWriter(writer, null, null);
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
}
-
+
@Test
- public void testCreateResponseWriterContentType8()
+ void createResponseWriterContentType8()
{
MyfacesConfig config = new MyfacesConfig();
facesContext.getExternalContext().getApplicationMap().put(MyfacesConfig.class.getName(), config);
@@ -135,12 +136,12 @@ public void testCreateResponseWriterContentType8()
HtmlRenderKitImpl renderKit = new HtmlRenderKitImpl();
StringWriter writer = new StringWriter();
HtmlResponseWriterImpl responseWriter = (HtmlResponseWriterImpl) renderKit.createResponseWriter(writer, null, null);
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
}
@Test
- public void testCreateResponseWriterContentType9()
+ void createResponseWriterContentType9()
{
MyfacesConfig config = new MyfacesConfig();
facesContext.getExternalContext().getApplicationMap().put(MyfacesConfig.class.getName(), config);
@@ -153,7 +154,7 @@ public void testCreateResponseWriterContentType9()
HtmlRenderKitImpl renderKit = new HtmlRenderKitImpl();
StringWriter writer = new StringWriter();
HtmlResponseWriterImpl responseWriter = (HtmlResponseWriterImpl) renderKit.createResponseWriter(writer, null, null);
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
- Assertions.assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getContentType());
+ assertEquals(ContentTypeUtils.HTML_CONTENT_TYPE, responseWriter.getWriterContentTypeMode());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/JavascriptUtilsTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/JavascriptUtilsTest.java
index a3ae128efb..3921af4ec2 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/JavascriptUtilsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/JavascriptUtilsTest.java
@@ -32,12 +32,12 @@
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.*;
-public class JavascriptUtilsTest {
+class JavascriptUtilsTest {
private MockedStatic javascriptUtilsMockedStatic;
@BeforeEach
- public void setUp() {
+ void setUp() {
javascriptUtilsMockedStatic = mockStatic(JavascriptUtils.class);
javascriptUtilsMockedStatic.when(() -> getValidJavascriptName(anyString(), anyBoolean(), anyBoolean()))
@@ -47,13 +47,13 @@ public void setUp() {
}
@AfterEach
- public void tearDown() {
+ void tearDown() {
javascriptUtilsMockedStatic.close();
}
@Test
@DisplayName("Passes namespaces without namespace encoding when allowNamespaces is true")
- public void testGetValidJavascriptNameWithNamespaces() {
+ void getValidJavascriptNameWithNamespaces() {
// WHEN
String result = getValidJavascriptName("testName.testname2", true, true);
@@ -64,7 +64,7 @@ public void testGetValidJavascriptNameWithNamespaces() {
@Test
@DisplayName("Returns input name without modifications when no namespace is provided")
- public void testGetValidJavascriptNameWithoutNamespace() {
+ void getValidJavascriptNameWithoutNamespace() {
// WHEN
String result = getValidJavascriptName("testName", true, true);
@@ -75,7 +75,7 @@ public void testGetValidJavascriptNameWithoutNamespace() {
@Test
@DisplayName("Handles namespaced input correctly without modification when allowNamespaces is false")
- public void testGetValidJavascriptNameWithNamespacedInput() {
+ void getValidJavascriptNameWithNamespacedInput() {
// WHEN
String result = getValidJavascriptName("testName.namespace", false, true);
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/RendererUtilsTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/RendererUtilsTest.java
index f3c83fbf9c..08a503ebba 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/RendererUtilsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/RendererUtilsTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.IOException;
import java.io.StringWriter;
@@ -34,7 +36,6 @@
import jakarta.faces.context.FacesContext;
import org.apache.myfaces.core.api.shared.ComponentUtils;
-import org.junit.jupiter.api.Assertions;
import org.apache.myfaces.renderkit.html.util.HTML;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.apache.myfaces.test.mock.MockResponseWriter;
@@ -43,7 +44,7 @@
import org.apache.myfaces.renderkit.html.util.ComponentAttrs;
import org.junit.jupiter.api.BeforeEach;
-public class RendererUtilsTest extends AbstractFacesTestCase {
+class RendererUtilsTest extends AbstractFacesTestCase {
private MockResponseWriter writer;
@@ -103,7 +104,7 @@ public void setUp() throws Exception {
}
@Test
- public void testGetIconSrc() {
+ void getIconSrc() {
// Training a mock:
resourceHandlerMock.createResource(resourceName, libraryName);
@@ -117,13 +118,13 @@ public void testGetIconSrc() {
String iconSrc = RendererUtils.getIconSrc(facesContext, graphicImage,
HTML.IMG_ELEM);
- Assertions.assertEquals(requestPath, iconSrc,
+ assertEquals(requestPath, iconSrc,
"If name or name/library present, source must be obtained from ResourceHandler");
}
@Test
- public void testGetIconSrcResourceNotFound() throws Exception {
+ void getIconSrcResourceNotFound() throws Exception {
// Training a mock:
EasyMock.reset(resourceHandlerMock);
resourceHandlerMock.createResource(resourceName, libraryName);
@@ -134,48 +135,48 @@ public void testGetIconSrcResourceNotFound() throws Exception {
String iconSrc = RendererUtils.getIconSrc(facesContext, graphicImage,
HTML.IMG_ELEM);
- Assertions.assertEquals("RES_NOT_FOUND", iconSrc);
- Assertions.assertTrue(facesContext.getMessages(graphicImage.getClientId(facesContext)).hasNext());
+ assertEquals("RES_NOT_FOUND", iconSrc);
+ assertTrue(facesContext.getMessages(graphicImage.getClientId(facesContext)).hasNext());
}
@Test
- public void testGetStringValue() {
+ void getStringValue() {
// Test for situation where submittedValue IS NOT String:
UIInput uiInput = new UIInput();
Object submittedValue = new Object();
uiInput.setSubmittedValue(submittedValue);
String stringValue = RendererUtils.getStringValue(facesContext, uiInput);
- Assertions.assertNotNull(stringValue);
- Assertions.assertEquals(submittedValue.toString(), stringValue,
+ assertNotNull(stringValue);
+ assertEquals(submittedValue.toString(), stringValue,
"If submittedvalue is not String, toString() must be used");
}
@Test
- public void testGetConvertedUIOutputValue() {
+ void getConvertedUIOutputValue() {
UIInput uiInput = new UIInput();
StringBuilder submittedValue = new StringBuilder("submittedValue");
uiInput.setSubmittedValue(submittedValue);
Object convertedUIOutputValue = RendererUtils.getConvertedUIOutputValue(facesContext, uiInput, submittedValue);
- Assertions.assertEquals(submittedValue.toString(), convertedUIOutputValue);
+ assertEquals(submittedValue.toString(), convertedUIOutputValue);
}
@Test
- public void testIsRendered() {
+ void isRendered() {
UIComponent uiComponent = new UIOutput();
boolean rendered = ComponentUtils.isRendered(facesContext, uiComponent);
- Assertions.assertTrue(rendered);
+ assertTrue(rendered);
uiComponent.setRendered(false);
rendered = ComponentUtils.isRendered(facesContext, uiComponent);
- Assertions.assertFalse(rendered);
+ assertFalse(rendered);
uiComponent = _setUpComponentStack();
rendered = ComponentUtils.isRendered(facesContext, uiComponent);
- Assertions.assertFalse(rendered);
- Assertions.assertEquals(parent, UIComponent.getCurrentComponent(facesContext));
+ assertFalse(rendered);
+ assertEquals(parent, UIComponent.getCurrentComponent(facesContext));
}
/**
@@ -193,7 +194,7 @@ public MockRenderedValueExpression(String expression, Class> expectedType, UIC
@Override
public Object getValue(ELContext elContext) {
UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext);
- Assertions.assertEquals(currentComponent, toVerify);
+ assertEquals(currentComponent, toVerify);
return false;
}
}
@@ -210,17 +211,17 @@ public boolean isRendered() {
@Override
public void encodeBegin(FacesContext context) throws IOException {
- Assertions.fail();
+ fail();
}
@Override
public void encodeChildren(FacesContext context) throws IOException {
- Assertions.fail();
+ fail();
}
@Override
public void encodeEnd(FacesContext context) throws IOException {
- Assertions.fail();
+ fail();
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/ClientBehaviorRendererUtilsTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/ClientBehaviorRendererUtilsTest.java
index 8e548ff25f..2c54099f32 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/ClientBehaviorRendererUtilsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/ClientBehaviorRendererUtilsTest.java
@@ -22,7 +22,6 @@
import jakarta.faces.component.behavior.ClientBehavior;
import jakarta.faces.component.behavior.ClientBehaviorHint;
import jakarta.faces.component.behavior.ClientBehaviorBase;
-import org.junit.jupiter.api.Assertions;
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.renderkit.ClientBehaviorEvents;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
@@ -32,12 +31,14 @@
import java.util.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import org.apache.myfaces.renderkit.html.util.ClientBehaviorRendererUtils;
import org.apache.myfaces.test.mock.MockFacesContext;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class ClientBehaviorRendererUtilsTest extends AbstractFacesTestCase
+class ClientBehaviorRendererUtilsTest extends AbstractFacesTestCase
{
@Override
@@ -50,7 +51,7 @@ public void setUp() throws Exception
}
@Test
- public void testBuildBehaviorChain()
+ void buildBehaviorChain()
{
Map> behaviors = new HashMap>();
@@ -58,12 +59,12 @@ public void testBuildBehaviorChain()
Collection params = new ArrayList();
UIComponent component = new HtmlInputText();
- Assertions.assertEquals("", ClientBehaviorRendererUtils.buildBehaviorChain(facesContext, component,
+ assertEquals("", ClientBehaviorRendererUtils.buildBehaviorChain(facesContext, component,
component.getClientId(facesContext),
ClientBehaviorEvents.CLICK, params, ClientBehaviorEvents.ACTION, params, behaviors, null,
null));
- Assertions.assertEquals("return faces.util.chain(document.getElementById('j_id__v_0'), event,'huhn', 'suppe');",
+ assertEquals("return faces.util.chain(document.getElementById('j_id__v_0'), event,'huhn', 'suppe');",
ClientBehaviorRendererUtils.buildBehaviorChain(facesContext,
component, component.getClientId(facesContext), ClientBehaviorEvents.CLICK,
params, ClientBehaviorEvents.ACTION, params, behaviors, "huhn",
@@ -86,16 +87,16 @@ public Set getHints()
behaviors.put(ClientBehaviorEvents.CLICK, Arrays.asList(submittingBehavior));
- Assertions.assertEquals("faces.util.chain(document.getElementById('j_id__v_0'), event,'huhn', 'script()', 'suppe'); return false;",
+ assertEquals("faces.util.chain(document.getElementById('j_id__v_0'), event,'huhn', 'script()', 'suppe'); return false;",
ClientBehaviorRendererUtils.buildBehaviorChain(facesContext,
component, component.getClientId(facesContext),
ClientBehaviorEvents.CLICK, params, ClientBehaviorEvents.ACTION, params, behaviors, "huhn",
"suppe"));
}
-
+
@Test
- public void testBuildBehaviorChain2()
+ void buildBehaviorChain2()
{
Map> behaviors = new HashMap>();
@@ -103,11 +104,11 @@ public void testBuildBehaviorChain2()
Collection params = new ArrayList();
UIComponent component = new HtmlInputText();
- Assertions.assertEquals("", ClientBehaviorRendererUtils.buildBehaviorChain(facesContext, component,
+ assertEquals("", ClientBehaviorRendererUtils.buildBehaviorChain(facesContext, component,
ClientBehaviorEvents.CLICK, params, ClientBehaviorEvents.ACTION, params, behaviors, null,
null));
- Assertions.assertEquals("return faces.util.chain(this, event,'huhn', 'suppe');",
+ assertEquals("return faces.util.chain(this, event,'huhn', 'suppe');",
ClientBehaviorRendererUtils.buildBehaviorChain(facesContext,
component, ClientBehaviorEvents.CLICK, params, ClientBehaviorEvents.ACTION, params, behaviors, "huhn",
"suppe"));
@@ -129,26 +130,26 @@ public Set getHints()
behaviors.put(ClientBehaviorEvents.CLICK, Arrays.asList(submittingBehavior));
- Assertions.assertEquals("faces.util.chain(this, event,'huhn', 'script()', 'suppe'); return false;",
+ assertEquals("faces.util.chain(this, event,'huhn', 'script()', 'suppe'); return false;",
ClientBehaviorRendererUtils.buildBehaviorChain(facesContext,
component,
ClientBehaviorEvents.CLICK, params, ClientBehaviorEvents.ACTION, params, behaviors, "huhn",
"suppe"));
- }
-
+ }
+
@Test
- public void testEscapeJavaScriptForChain()
+ void escapeJavaScriptForChain()
{
MockFacesContext facesContext = new MockFacesContext();
- Assertions.assertEquals("var foo = " \\\\" test "; alert(foo);",
+ assertEquals("var foo = " \\\\" test "; alert(foo);",
ClientBehaviorRendererUtils.escapeJavaScriptForChain(facesContext, "var foo = " \\" test "; alert(foo);"));
- Assertions.assertEquals("var foo = \\'bar \\'",
+ assertEquals("var foo = \\'bar \\'",
ClientBehaviorRendererUtils.escapeJavaScriptForChain(facesContext, "var foo = 'bar '"));
- Assertions.assertEquals("var foo = \\'bar \\\\\\' \\'",
+ assertEquals("var foo = \\'bar \\\\\\' \\'",
ClientBehaviorRendererUtils.escapeJavaScriptForChain(facesContext, "var foo = 'bar \\' '"));
}
}
\ No newline at end of file
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlBodyRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlBodyRendererTest.java
index 9d7e38a4e0..832f43099f 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlBodyRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlBodyRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.StringWriter;
import jakarta.faces.component.html.HtmlBody;
@@ -31,14 +33,13 @@
import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
import org.apache.myfaces.test.utils.HtmlRenderedAttr;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* @author Leonardo Uribe
*/
-public class HtmlBodyRendererTest extends AbstractFacesTestCase
+class HtmlBodyRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
@@ -71,9 +72,9 @@ public void tearDown() throws Exception
super.tearDown();
writer = null;
}
-
+
@Test
- public void testHtmlPropertyPassTru2() throws Exception
+ void htmlPropertyPassTru2() throws Exception
{
HtmlRenderedAttr[] attrs = {
new HtmlRenderedAttr("xmlns")
@@ -82,19 +83,19 @@ public void testHtmlPropertyPassTru2() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
body, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicReadOnlyAttrs();
HtmlCheckAttributesUtil.checkRenderedAttributes(
body, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlButtonRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlButtonRendererTest.java
index 82cda028f1..b8d2bbfb3a 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlButtonRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlButtonRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.faces.component.UIParameter;
@@ -40,7 +42,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class HtmlButtonRendererTest extends AbstractFacesTestCase {
+class HtmlButtonRendererTest extends AbstractFacesTestCase {
private MockResponseWriter writer;
private HtmlCommandButton commandButton;
@@ -81,7 +83,7 @@ public void tearDown() throws Exception {
}
@Test
- public void testJSNotAllowedHtmlPropertyPassTru() throws Exception {
+ void jSNotAllowedHtmlPropertyPassTru() throws Exception {
HtmlRenderedAttr[] attrs = {
//_AccesskeyProperty
new HtmlRenderedAttr("accesskey"),
@@ -127,12 +129,12 @@ public void testJSNotAllowedHtmlPropertyPassTru() throws Exception {
HtmlCheckAttributesUtil.checkRenderedAttributes(
commandButton, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testAllowedHtmlPropertyPassTru() throws Exception {
+ void allowedHtmlPropertyPassTru() throws Exception {
HtmlRenderedAttr[] attrs = {
//_AccesskeyProperty
new HtmlRenderedAttr("accesskey"),
@@ -175,32 +177,27 @@ public void testAllowedHtmlPropertyPassTru() throws Exception {
HtmlCheckAttributesUtil.checkRenderedAttributes(
commandButton, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ void clientBehaviorHolderRendersIdAndName()
{
commandButton.addClientBehavior("focus", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
commandButton.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
-
+
/**
* If a h:commandButton has any UIParameter children, he should
* render them with a renderer of family jakarta.faces.Input and
@@ -210,7 +207,7 @@ public void testClientBehaviorHolderRendersIdAndName()
* @throws Exception
*/
@Test
- public void testCommandButtonRendersNotDisabledUIParameters() throws Exception
+ void commandButtonRendersNotDisabledUIParameters() throws Exception
{
UIParameter param1 = new UIParameter();
param1.setName("param1");
@@ -226,10 +223,10 @@ public void testCommandButtonRendersNotDisabledUIParameters() throws Exception
commandButton.encodeAll(facesContext);
String output = writer.getWriter().toString();
- Assertions.assertFalse(output.contains("param1"));
- Assertions.assertFalse(output.contains("value1"));
- Assertions.assertTrue(output.contains("param2"));
- Assertions.assertTrue(output.contains("value2"));
+ assertFalse(output.contains("param1"));
+ assertFalse(output.contains("value1"));
+ assertTrue(output.contains("param2"));
+ assertTrue(output.contains("value2"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlCheckboxRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlCheckboxRendererTest.java
index 678c016692..9e303cfba3 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlCheckboxRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlCheckboxRendererTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.StringWriter;
import jakarta.faces.component.UISelectItem;
@@ -39,7 +42,7 @@
* @author Bruno Aranda (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlCheckboxRendererTest extends AbstractFacesTestCase
+class HtmlCheckboxRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
private HtmlSelectManyCheckbox selectManyCheckbox;
@@ -81,7 +84,7 @@ public void tearDown() throws Exception
}
@Test
- public void testSelectManyHtmlPropertyPassTru() throws Exception
+ void selectManyHtmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = {
//_AccesskeyProperty
@@ -123,12 +126,12 @@ public void testSelectManyHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
selectManyCheckbox, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testSelectBooleanHtmlPropertyPasstru() throws Exception
+ void selectBooleanHtmlPropertyPasstru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicAttrs();
@@ -137,37 +140,32 @@ public void testSelectBooleanHtmlPropertyPasstru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
selectBooleanCheckbox, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
- }
-
+ }
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndNameSelectBooleanCheckbox()
+ void clientBehaviorHolderRendersIdAndNameSelectBooleanCheckbox()
{
selectBooleanCheckbox.addClientBehavior("focus", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
selectBooleanCheckbox.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndNameSelectManyCheckbox()
+ void clientBehaviorHolderRendersIdAndNameSelectManyCheckbox()
{
UISelectItem item1 = new UISelectItem();
item1.setItemLabel("#1");
@@ -178,19 +176,14 @@ public void testClientBehaviorHolderRendersIdAndNameSelectManyCheckbox()
item2.setItemValue("#2");
selectManyCheckbox.addClientBehavior("focus", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
selectManyCheckbox.getChildren().add(item1);
selectManyCheckbox.getChildren().add(item2);
selectManyCheckbox.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlDoctypeRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlDoctypeRendererTest.java
index b015edb3e7..173c068b0e 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlDoctypeRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlDoctypeRendererTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.StringWriter;
import jakarta.faces.component.html.HtmlDoctype;
@@ -31,7 +34,6 @@
import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
import org.apache.myfaces.test.utils.HtmlRenderedAttr;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -70,9 +72,9 @@ public void tearDown() throws Exception
super.tearDown();
writer = null;
}
-
+
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = {
new HtmlRenderedAttr("rootElement","rootElement", "rootElement"),
@@ -83,10 +85,10 @@ public void testHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
doctype, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
- Assertions.assertTrue(
+ assertTrue(
writer.getWriter().toString().contains(""));
}
@@ -97,7 +99,7 @@ public void testHtml5Doctype() throws Exception
doctype.encodeAll(facesContext);
facesContext.renderResponse();
- Assertions.assertTrue(writer.getWriter().toString().contains(""));
+ assertTrue(writer.getWriter().toString().contains(""));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlEscapeRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlEscapeRendererTest.java
index 47a29bb60f..78094b4433 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlEscapeRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlEscapeRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.faces.component.UIComponent;
@@ -35,7 +37,6 @@
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.apache.myfaces.test.mock.MockRenderKitFactory;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -126,7 +127,7 @@ public void tearDown() throws Exception
}
@Test
- public void testOutputTextEscapeValue() throws Exception
+ void outputTextEscapeValue() throws Exception
{
for (String contentType: CONTENT_TYPES)
{
@@ -143,13 +144,13 @@ public void testOutputTextEscapeValue() throws Exception
outputText.encodeEnd(facesContext);
facesContext.renderResponse();
String output = swriter.toString();
- Assertions.assertTrue(output.contains(TEST_STRING_ESCAPED));
+ assertTrue(output.contains(TEST_STRING_ESCAPED));
}
}
}
@Test
- public void testOutputTextNoEscapeValue() throws Exception
+ void outputTextNoEscapeValue() throws Exception
{
for (String contentType: CONTENT_TYPES)
@@ -164,13 +165,13 @@ public void testOutputTextNoEscapeValue() throws Exception
outputText.encodeEnd(facesContext);
facesContext.renderResponse();
String output = swriter.toString();
- Assertions.assertTrue(output.contains(TEST_STRING));
+ assertTrue(output.contains(TEST_STRING));
}
}
}
-
+
@Test
- public void testOutputLabelEscapeValue() throws Exception
+ void outputLabelEscapeValue() throws Exception
{
for (String contentType: CONTENT_TYPES)
{
@@ -187,13 +188,13 @@ public void testOutputLabelEscapeValue() throws Exception
outputLabel.encodeAll(facesContext);
facesContext.renderResponse();
String output = swriter.toString();
- Assertions.assertTrue(output.contains(TEST_STRING_ESCAPED));
+ assertTrue(output.contains(TEST_STRING_ESCAPED));
}
}
}
-
+
@Test
- public void testOutputLabelNoEscapeValue() throws Exception
+ void outputLabelNoEscapeValue() throws Exception
{
for (String contentType: CONTENT_TYPES)
@@ -208,13 +209,13 @@ public void testOutputLabelNoEscapeValue() throws Exception
outputLabel.encodeAll(facesContext);
facesContext.renderResponse();
String output = swriter.toString();
- Assertions.assertTrue(output.contains(TEST_STRING));
+ assertTrue(output.contains(TEST_STRING));
}
}
}
-
+
@Test
- public void testUISelectOneEscapeValue() throws Exception
+ void uISelectOneEscapeValue() throws Exception
{
for (String contentType: CONTENT_TYPES)
{
@@ -242,11 +243,11 @@ public void tryUISelectEscapeValue(UIComponent component, String contentType, St
component.encodeAll(facesContext);
facesContext.renderResponse();
String output = swriter.toString();
- Assertions.assertTrue(output.contains(TEST_STRING_ESCAPED));
+ assertTrue(output.contains(TEST_STRING_ESCAPED));
}
-
+
@Test
- public void testUISelectNoEscapeValue() throws Exception
+ void uISelectNoEscapeValue() throws Exception
{
for (String contentType: CONTENT_TYPES)
{
@@ -274,6 +275,6 @@ public void tryUISelectNoEscapeValue(UIComponent component, String contentType,
component.encodeAll(facesContext);
facesContext.renderResponse();
String output = swriter.toString();
- Assertions.assertTrue(output.contains(TEST_STRING));
+ assertTrue(output.contains(TEST_STRING));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlFormRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlFormRendererTest.java
index b3e6be5b5c..99ed506088 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlFormRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlFormRendererTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.PrintWriter;
import java.io.StringWriter;
@@ -35,7 +38,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class HtmlFormRendererTest extends AbstractFacesTestCase
+class HtmlFormRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
private HtmlForm form;
@@ -71,7 +74,7 @@ public void tearDown() throws Exception
}
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicReadOnlyAttrs();
@@ -81,15 +84,15 @@ public void testHtmlPropertyPassTru() throws Exception
} catch(Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
- Assertions.fail(sw.toString() + "\nHTML.FORM_PASSTHROUGH_ATTRIBUTES: " + printHTMLAttrs(HTML.FORM_PASSTHROUGH_ATTRIBUTES));
+ fail(sw.toString() + "\nHTML.FORM_PASSTHROUGH_ATTRIBUTES: " + printHTMLAttrs(HTML.FORM_PASSTHROUGH_ATTRIBUTES));
}
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testHtmlPropertyPassTruNotRendered() throws Exception
+ void htmlPropertyPassTruNotRendered() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateAttrsNotRenderedForReadOnlyButBehaviorEvents();
@@ -99,10 +102,10 @@ public void testHtmlPropertyPassTruNotRendered() throws Exception
} catch(Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
- Assertions.fail(sw.toString() + "\nHTML.FORM_PASSTHROUGH_ATTRIBUTES: " + printHTMLAttrs(HTML.FORM_PASSTHROUGH_ATTRIBUTES));
+ fail(sw.toString() + "\nHTML.FORM_PASSTHROUGH_ATTRIBUTES: " + printHTMLAttrs(HTML.FORM_PASSTHROUGH_ATTRIBUTES));
}
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
@@ -116,25 +119,20 @@ private String printHTMLAttrs(String[] attrs) {
}
return buffer.toString();
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ void clientBehaviorHolderRendersIdAndName()
{
form.addClientBehavior("focus", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
form.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlFormatRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlFormatRendererTest.java
index 539c0267c8..6a5e1354e3 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlFormatRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlFormatRendererTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.StringWriter;
import jakarta.faces.component.UIParameter;
@@ -28,11 +31,10 @@
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.apache.myfaces.test.mock.MockRenderKitFactory;
import org.apache.myfaces.test.mock.MockResponseWriter;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class HtmlFormatRendererTest extends AbstractFacesTestCase
+class HtmlFormatRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer;
private HtmlOutputFormat outputFormat;
@@ -55,7 +57,7 @@ public void setUp() throws Exception {
}
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = {
//_UniversalProperties
@@ -72,12 +74,12 @@ public void testHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
outputFormat, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testHtmlPropertyPassTruNotRendered() throws Exception
+ void htmlPropertyPassTruNotRendered() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateAttrsNotRenderedForReadOnly();
@@ -85,17 +87,17 @@ public void testHtmlPropertyPassTruNotRendered() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
outputFormat, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
/**
* If the disable attribute of a child UIParameter is true,
* he should be ignored.
* @throws Exception
*/
@Test
- public void testDisabledUIParameterNotRendered() throws Exception
+ void disabledUIParameterNotRendered() throws Exception
{
UIParameter param1 = new UIParameter();
param1.setValue("value1");
@@ -109,6 +111,6 @@ public void testDisabledUIParameterNotRendered() throws Exception
outputFormat.encodeAll(facesContext);
String output = writer.getWriter().toString();
- Assertions.assertEquals("prefixvalue2-{1}suffix", output);
+ assertEquals("prefixvalue2-{1}suffix", output);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlGridRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlGridRendererTest.java
index d00c639d78..b555ad2d8d 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlGridRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlGridRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.faces.component.UIColumn;
@@ -39,7 +41,7 @@
* @author Bruno Aranda (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlGridRendererTest extends AbstractFacesTestCase
+class HtmlGridRendererTest extends AbstractFacesTestCase
{
private static final String LINE_SEPARATOR = System.getProperty(
"line.separator", "\r\n");
@@ -83,7 +85,7 @@ public void tearDown() throws Exception
}
@Test
- public void testRenderTable() throws Exception
+ void renderTable() throws Exception
{
UIColumn col1 = new UIColumn();
HtmlOutputText col1Text = new HtmlOutputText();
@@ -104,54 +106,49 @@ public void testRenderTable() throws Exception
facesContext.renderResponse();
String output = writer.getWriter().toString();
- Assertions.assertEquals(""+
+ assertEquals(""+
"| col1Text |
"+
"| col2Text |
"+
""+"
", output);
}
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicReadOnlyAttrs();
HtmlCheckAttributesUtil.checkRenderedAttributes(
panelGrid, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testHtmlPropertyPassTruNotRendered() throws Exception
+ void htmlPropertyPassTruNotRendered() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateAttrsNotRenderedForReadOnlyButBehaviorEvents();
HtmlCheckAttributesUtil.checkRenderedAttributes(
panelGrid, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ void clientBehaviorHolderRendersIdAndName()
{
panelGrid.addClientBehavior("click", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
panelGrid.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlGroupRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlGroupRendererTest.java
index d27ea90c11..8e5963b31a 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlGroupRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlGroupRendererTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.StringWriter;
import jakarta.faces.component.behavior.AjaxBehavior;
@@ -31,7 +34,6 @@
import org.apache.myfaces.test.mock.MockRenderKitFactory;
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -39,7 +41,7 @@
* @author Bruno Aranda (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlGroupRendererTest extends AbstractFacesTestCase
+class HtmlGroupRendererTest extends AbstractFacesTestCase
{
private static String PANEL_CHILD_TEXT = "PANEL";
@@ -85,9 +87,9 @@ public void tearDown()throws Exception
super.tearDown();
writer = null;
}
-
+
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = {
//_EventProperties
@@ -110,37 +112,37 @@ public void testHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
panelGroup, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testHtmlPropertyPassTruNotRendered() throws Exception
+ void htmlPropertyPassTruNotRendered() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateAttrsNotRenderedForReadOnlyButBehaviorEvents();
HtmlCheckAttributesUtil.checkRenderedAttributes(
panelGroup, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testClientBehaviorHolderRendersIdAndNameOutputLink()
+ void clientBehaviorHolderRendersIdAndNameOutputLink()
{
panelGroup.addClientBehavior("keypress", new AjaxBehavior());
try
{
panelGroup.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.contains("myfaces.ab"));
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.contains("myfaces.ab"));
}
catch (Exception e)
{
e.printStackTrace();
- Assertions.fail(e.getMessage());
+ fail(e.getMessage());
}
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlHeadRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlHeadRendererTest.java
index b9bf56ac45..83e94a7b69 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlHeadRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlHeadRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.StringWriter;
import jakarta.faces.component.html.HtmlHead;
@@ -28,14 +30,13 @@
import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
import org.apache.myfaces.test.utils.HtmlRenderedAttr;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* @author Leonardo Uribe
*/
-public class HtmlHeadRendererTest extends AbstractFacesTestCase
+class HtmlHeadRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
@@ -68,9 +69,9 @@ public void tearDown()throws Exception
super.tearDown();
writer = null;
}
-
+
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = {
new HtmlRenderedAttr("xmlns"),
@@ -81,7 +82,7 @@ public void testHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
head, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlImageRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlImageRendererTest.java
index 8216210f9e..cac97641f3 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlImageRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlImageRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.faces.component.behavior.AjaxBehavior;
@@ -37,7 +39,7 @@
* @author Bruno Aranda (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlImageRendererTest extends AbstractFacesTestCase
+class HtmlImageRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
private HtmlGraphicImage graphicImage;
@@ -71,7 +73,7 @@ public void tearDown() throws Exception
}
@Test
- public void testRenderDefault() throws Exception
+ void renderDefault() throws Exception
{
String imgUrl = "http://www.apache.org/images/feather.gif";
String src = facesContext.getApplication().getViewHandler().getResourceURL(facesContext, imgUrl);
@@ -84,11 +86,11 @@ public void testRenderDefault() throws Exception
facesContext.renderResponse();
String output = writer.getWriter().toString();
- Assertions.assertEquals("
", output);
+ assertEquals("
", output);
}
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicReadOnlyAttrs();
@@ -98,12 +100,12 @@ public void testHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
graphicImage, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testHtmlPropertyPassTruNotRendered() throws Exception
+ void htmlPropertyPassTruNotRendered() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateAttrsNotRenderedForReadOnlyButBehaviorEvents();
@@ -113,28 +115,23 @@ public void testHtmlPropertyPassTruNotRendered() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
graphicImage, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ void clientBehaviorHolderRendersIdAndName()
{
graphicImage.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
graphicImage.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlLabelRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlLabelRendererTest.java
index 8c3c2bedba..6c014347b3 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlLabelRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlLabelRendererTest.java
@@ -18,7 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
-import java.io.IOException;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.faces.FactoryFinder;
@@ -91,7 +92,7 @@ public void tearDown() throws Exception {
}
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = {
//_AccesskeyProperty
@@ -127,7 +128,7 @@ public void testHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
label, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
@@ -139,9 +140,9 @@ protected String getPageContents()
{
return writer.getWriter().toString();
}
-
+
@Test
- public void testEscapeUntouched() throws IOException
+ void escapeUntouched() throws Exception
{
label.setId("labelId");
label.setValue("field label");
@@ -150,11 +151,11 @@ public void testEscapeUntouched() throws IOException
label.encodeAll(facesContext);
String page = getPageContents();
- Assertions.assertEquals("", page);
+ assertEquals("", page);
}
@Test
- public void testEscapeSetToFalse() throws IOException
+ void escapeSetToFalse() throws Exception
{
label.setId("labelId");
label.setValue("field label");
@@ -164,27 +165,22 @@ public void testEscapeSetToFalse() throws IOException
label.encodeAll(facesContext);
String page = getPageContents();
- Assertions.assertEquals("", page);
+ assertEquals("", page);
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ void clientBehaviorHolderRendersIdAndName()
{
label.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
label.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.contains("id=\"j_id__"));
- Assertions.assertTrue(output.contains("name=\"j_id__"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.contains("id=\"j_id__"));
+ assertTrue(output.contains("name=\"j_id__"));
+ });
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlLinkRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlLinkRendererTest.java
index fbee2f438a..b9f9bde533 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlLinkRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlLinkRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.faces.component.UIForm;
@@ -42,7 +44,7 @@
* @author Bruno Aranda (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlLinkRendererTest extends AbstractFacesTestCase
+class HtmlLinkRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer;
@@ -99,9 +101,9 @@ public void tearDown() throws Exception
super.tearDown();
writer = null;
}
-
+
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = {
//_AccesskeyProperty
@@ -135,12 +137,12 @@ public void testHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
commandLink, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testOutputLink() throws Exception
+ void outputLink() throws Exception
{
HtmlRenderedAttr[] attrs = {
//_AccesskeyProperty
@@ -173,74 +175,59 @@ public void testOutputLink() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
outputLink, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndNameOutputLink()
+ void clientBehaviorHolderRendersIdAndNameOutputLink()
{
outputLink.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
outputLink.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndNameCommandLink()
+ void clientBehaviorHolderRendersIdAndNameCommandLink()
{
commandLink.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
commandLink.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
//System.out.println("----OUTPUT----"+output);
- Assertions.assertTrue(output.matches("(?s).+id=\".+\".+"));
- Assertions.assertTrue(output.matches("(?s).+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches("(?s).+id=\".+\".+"));
+ assertTrue(output.matches("(?s).+name=\".+\".+"));
+ });
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndNameOutcomeTargetLink()
+ void clientBehaviorHolderRendersIdAndNameOutcomeTargetLink()
{
outcomeTargetLink.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
outcomeTargetLink.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
-
+
/**
* Tests if h:link correctly includes all parameters of the implicit
* navigation case created from the outcome.
@@ -248,7 +235,7 @@ public void testClientBehaviorHolderRendersIdAndNameOutcomeTargetLink()
* @throws Exception
*/
@Test
- public void testOutcomeTargetRendersNavigationCaseParameters() throws Exception
+ void outcomeTargetRendersNavigationCaseParameters() throws Exception
{
// configure the link
outcomeTargetLink.getAttributes().put("includeViewParams", false);
@@ -260,16 +247,16 @@ public void testOutcomeTargetRendersNavigationCaseParameters() throws Exception
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
// make sure the parameters are rendered
- Assertions.assertTrue(output.contains("param1=value1"));
- Assertions.assertTrue(output.contains("param2=value2"));
+ assertTrue(output.contains("param1=value1"));
+ assertTrue(output.contains("param2=value2"));
}
-
+
/**
* Tests if the fragment attribute is correctly rendered.
* @throws Exception
*/
@Test
- public void testOutcomeTargetLinkFragment() throws Exception
+ void outcomeTargetLinkFragment() throws Exception
{
// configure the link
final String fragment = "end";
@@ -282,31 +269,31 @@ public void testOutcomeTargetLinkFragment() throws Exception
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
// make sure the fragment is rendered
- Assertions.assertTrue(output.contains("param1=value1#" + fragment));
+ assertTrue(output.contains("param1=value1#" + fragment));
}
-
+
/**
* Test for the right use of the fragment attribute.
* The value of the fragment attribute is appended to the end of target URL following a hash (#) mark.
* @throws Exception
*/
@Test
- public void testOutputLinkFragment() throws Exception
+ void outputLinkFragment() throws Exception
{
outputLink.setFragment("fragment");
outputLink.setValue("http://www.irian.at");
outputLink.encodeAll(facesContext);
String output = writer.getWriter().toString();
- Assertions.assertEquals("", output);
+ assertEquals("", output);
}
-
+
/**
* If the disable attribute of a child UIParameter is true,
* he should be ignored.
* @throws Exception
*/
@Test
- public void testDisabledUIParameterNotRenderedCommandLink() throws Exception
+ void disabledUIParameterNotRenderedCommandLink() throws Exception
{
UIParameter param1 = new UIParameter();
param1.setName("param1");
@@ -320,19 +307,19 @@ public void testDisabledUIParameterNotRenderedCommandLink() throws Exception
commandLink.encodeAll(facesContext);
String output = writer.getWriter().toString();
- Assertions.assertFalse(output.contains("param1"));
- Assertions.assertFalse(output.contains("value1"));
- Assertions.assertTrue(output.contains("param2"));
- Assertions.assertTrue(output.contains("value2"));
+ assertFalse(output.contains("param1"));
+ assertFalse(output.contains("value1"));
+ assertTrue(output.contains("param2"));
+ assertTrue(output.contains("value2"));
}
-
+
/**
* If the disable attribute of a child UIParameter is true,
* he should be ignored.
* @throws Exception
*/
@Test
- public void testDisabledUIParameterNotRenderedOutputLink() throws Exception
+ void disabledUIParameterNotRenderedOutputLink() throws Exception
{
UIParameter param1 = new UIParameter();
param1.setName("param1");
@@ -346,60 +333,50 @@ public void testDisabledUIParameterNotRenderedOutputLink() throws Exception
outputLink.encodeAll(facesContext);
String output = writer.getWriter().toString();
- Assertions.assertFalse(output.contains("param1"));
- Assertions.assertFalse(output.contains("value1"));
- Assertions.assertTrue(output.contains("param2"));
- Assertions.assertTrue(output.contains("value2"));
+ assertFalse(output.contains("param1"));
+ assertFalse(output.contains("value1"));
+ assertTrue(output.contains("param2"));
+ assertTrue(output.contains("value2"));
}
-
+
/**
* Tests if the h:link correctly includes an UIParameter
* with a non-null-name when creating the URL.
*/
@Test
- public void testOutcomeTargetLinkIncludesUIParameterInURL()
+ void outcomeTargetLinkIncludesUIParameterInURL()
{
// create the UIParameter and attach it
UIParameter param = new UIParameter();
param.setName("myParameter");
param.setValue("myValue");
outcomeTargetLink.getChildren().add(param);
-
- try
- {
+
+ Assertions.assertDoesNotThrow(() -> {
outcomeTargetLink.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.contains("myParameter=myValue"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.contains("myParameter=myValue"));
+ });
}
-
+
/**
* Tests if the h:link correctly skips an UIParameter
* with a null-name when creating the URL.
*/
@Test
- public void testOutcomeTargetLinkSkipsNullValueOfUIParameterInURL()
+ void outcomeTargetLinkSkipsNullValueOfUIParameterInURL()
{
// create the UIParameter with value = null and attach it
UIParameter param = new UIParameter();
param.setName("myNullParameter");
param.setValue(null);
outcomeTargetLink.getChildren().add(param);
-
- try
- {
+
+ Assertions.assertDoesNotThrow(() -> {
outcomeTargetLink.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertFalse(output.contains("myNullParameter"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertFalse(output.contains("myNullParameter"));
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlListboxRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlListboxRendererTest.java
index 902dd80053..89eb05f272 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlListboxRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlListboxRendererTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
@@ -43,7 +46,7 @@
* @author Bruno Aranda (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlListboxRendererTest extends AbstractFacesTestCase
+class HtmlListboxRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
private HtmlSelectOneListbox selectOneListbox;
@@ -83,7 +86,7 @@ public void tearDown() throws Exception
}
@Test
- public void testSelectOneHtmlPropertyPassTru() throws Exception
+ void selectOneHtmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicAttrs(false);
@@ -98,12 +101,12 @@ public void testSelectOneHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
selectOneListbox, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testSelectManyHtmlPropertyPassTru() throws Exception
+ void selectManyHtmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicAttrs(false);
@@ -118,15 +121,15 @@ public void testSelectManyHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
selectManyListbox, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndNameSelectOneListbox()
+ void clientBehaviorHolderRendersIdAndNameSelectOneListbox()
{
UISelectItem item1 = new UISelectItem();
item1.setItemLabel("#1");
@@ -137,27 +140,22 @@ public void testClientBehaviorHolderRendersIdAndNameSelectOneListbox()
item2.setItemValue("#2");
selectOneListbox.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
selectOneListbox.getChildren().add(item1);
selectOneListbox.getChildren().add(item2);
selectOneListbox.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndNameSelectManyListbox()
+ void clientBehaviorHolderRendersIdAndNameSelectManyListbox()
{
UISelectItem item1 = new UISelectItem();
item1.setItemLabel("#1");
@@ -168,19 +166,14 @@ public void testClientBehaviorHolderRendersIdAndNameSelectManyListbox()
item2.setItemValue("#2");
selectManyListbox.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
selectManyListbox.getChildren().add(item1);
selectManyListbox.getChildren().add(item2);
selectManyListbox.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMenuRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMenuRendererTest.java
index 4a06ae7c56..31ed6eab64 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMenuRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMenuRendererTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
@@ -43,7 +46,7 @@
* @author Bruno Aranda (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlMenuRendererTest extends AbstractFacesTestCase
+class HtmlMenuRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
private HtmlSelectOneMenu selectOneMenu;
@@ -84,7 +87,7 @@ public void tearDown() throws Exception
}
@Test
- public void testSelectOneHtmlPropertyPassTru() throws Exception
+ void selectOneHtmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicAttrs(false);
@@ -99,12 +102,12 @@ public void testSelectOneHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
selectOneMenu, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testSelectManyHtmlPropertyPassTru() throws Exception
+ void selectManyHtmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicAttrs(false);
@@ -119,15 +122,15 @@ public void testSelectManyHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
selectManyMenu, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndNameSelectOneMenu()
+ void clientBehaviorHolderRendersIdAndNameSelectOneMenu()
{
UISelectItem item1 = new UISelectItem();
item1.setItemLabel("#1");
@@ -138,27 +141,22 @@ public void testClientBehaviorHolderRendersIdAndNameSelectOneMenu()
item2.setItemValue("#2");
selectOneMenu.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
selectOneMenu.getChildren().add(item1);
selectOneMenu.getChildren().add(item2);
selectOneMenu.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndNameSelectManyMenu()
+ void clientBehaviorHolderRendersIdAndNameSelectManyMenu()
{
UISelectItem item1 = new UISelectItem();
item1.setItemLabel("#1");
@@ -169,19 +167,14 @@ public void testClientBehaviorHolderRendersIdAndNameSelectManyMenu()
item2.setItemValue("#2");
selectManyMenu.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
selectManyMenu.getChildren().add(item1);
selectManyMenu.getChildren().add(item2);
selectManyMenu.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMessageRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMessageRendererTest.java
index 4c3793e7f9..3ffd9480e8 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMessageRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMessageRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.StringWriter;
import jakarta.faces.FactoryFinder;
@@ -31,7 +33,6 @@
import org.apache.myfaces.test.base.junit.AbstractFacesConfigurableMockTestCase;
import org.apache.myfaces.test.mock.MockRenderKitFactory;
import org.apache.myfaces.test.mock.MockResponseWriter;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -105,7 +106,7 @@ public void setUp() throws Exception
}
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = {
//_UniversalProperties
@@ -142,12 +143,12 @@ public void testHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
message, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testRenderSpanOnlyWhenNecessary() throws Exception
+ void renderSpanOnlyWhenNecessary() throws Exception
{
facesContext.addMessage(inputText.getClientId(), new FacesMessage(FacesMessage.Severity.WARN, "warnSummary", "detailWarnSummary"));
message.setFor("myInputId");
@@ -156,9 +157,9 @@ public void testRenderSpanOnlyWhenNecessary() throws Exception
String output = writer.getWriter().toString();
//System.out.println(output);
}
-
+
@Test
- public void testHtmlPropertyPassTruNotRendered() throws Exception
+ void htmlPropertyPassTruNotRendered() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateAttrsNotRenderedForReadOnly();
@@ -175,7 +176,7 @@ public void testHtmlPropertyPassTruNotRendered() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
message, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMessagesRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMessagesRendererTest.java
index 4d7c5b9513..f620558d67 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMessagesRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlMessagesRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.faces.FactoryFinder;
@@ -30,7 +32,6 @@
import org.apache.myfaces.test.mock.MockRenderKitFactory;
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -95,7 +96,7 @@ public void tearDown() throws Exception
}
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = {
//_EventProperties
@@ -132,51 +133,51 @@ public void testHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
messages, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testRenderSpanOnlyWhenNecessary1() throws Exception
+ void renderSpanOnlyWhenNecessary1() throws Exception
{
facesContext.addMessage("test1", new FacesMessage(FacesMessage.Severity.WARN, "warnSummary", "detailWarnSummary"));
messages.encodeEnd(facesContext);
facesContext.renderResponse();
String output = writer.getWriter().toString();
- Assertions.assertTrue(output.contains("warnSummary"));
- Assertions.assertTrue(!output.contains("span"));
+ assertTrue(output.contains("warnSummary"));
+ assertFalse(output.contains("span"));
}
-
+
@Test
- public void testRenderSpanOnlyWhenNecessary2() throws Exception
+ void renderSpanOnlyWhenNecessary2() throws Exception
{
facesContext.addMessage("test1", new FacesMessage(FacesMessage.Severity.WARN, "warnSummary", "detailWarnSummary"));
messages.setLayout("table");
messages.encodeEnd(facesContext);
facesContext.renderResponse();
String output = writer.getWriter().toString();
- Assertions.assertTrue(output.contains("warnSummary"));
- Assertions.assertTrue(!output.contains("span"));
+ assertTrue(output.contains("warnSummary"));
+ assertFalse(output.contains("span"));
}
-
+
@Test
- public void testRenderSpanOnlyWhenNecessary3() throws Exception
+ void renderSpanOnlyWhenNecessary3() throws Exception
{
facesContext.addMessage("test1", new FacesMessage(FacesMessage.Severity.WARN, "warnSummary", "detailWarnSummary"));
messages.setId("msgPanel");
messages.encodeEnd(facesContext);
facesContext.renderResponse();
String output = writer.getWriter().toString();
- Assertions.assertTrue(output.contains("warnSummary"));
- Assertions.assertTrue(!output.contains("span"));
+ assertTrue(output.contains("warnSummary"));
+ assertFalse(output.contains("span"));
}
-
+
/**
* It should output the class on li
* @throws Exception
*/
@Test
- public void testRenderSpanOnlyWhenNecessary4() throws Exception
+ void renderSpanOnlyWhenNecessary4() throws Exception
{
facesContext.addMessage("test1", new FacesMessage(FacesMessage.Severity.FATAL, "fatalSummary", "detailFatalSummary"));
messages.setId("msgPanel");
@@ -184,17 +185,17 @@ public void testRenderSpanOnlyWhenNecessary4() throws Exception
messages.encodeEnd(facesContext);
facesContext.renderResponse();
String output = writer.getWriter().toString();
- Assertions.assertTrue(output.contains("fatalSummary"));
- Assertions.assertTrue(output.contains("li class=\"fatalClass\""));
- Assertions.assertTrue(!output.contains("span"));
+ assertTrue(output.contains("fatalSummary"));
+ assertTrue(output.contains("li class=\"fatalClass\""));
+ assertFalse(output.contains("span"));
}
-
+
/**
* It should output the class on td
* @throws Exception
*/
@Test
- public void testRenderSpanOnlyWhenNecessary5() throws Exception
+ void renderSpanOnlyWhenNecessary5() throws Exception
{
facesContext.addMessage("test1", new FacesMessage(FacesMessage.Severity.FATAL, "fatalSummary", "detailFatalSummary"));
messages.setId("msgPanel");
@@ -203,13 +204,13 @@ public void testRenderSpanOnlyWhenNecessary5() throws Exception
messages.encodeEnd(facesContext);
facesContext.renderResponse();
String output = writer.getWriter().toString();
- Assertions.assertTrue(output.contains("fatalSummary"));
- Assertions.assertTrue(output.contains("td class=\"fatalClass\""));
- Assertions.assertTrue(!output.contains("span"));
+ assertTrue(output.contains("fatalSummary"));
+ assertTrue(output.contains("td class=\"fatalClass\""));
+ assertFalse(output.contains("span"));
}
-
+
@Test
- public void testHtmlPropertyPassTruNotRendered() throws Exception
+ void htmlPropertyPassTruNotRendered() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateAttrsNotRenderedForReadOnly();
@@ -227,7 +228,7 @@ public void testHtmlPropertyPassTruNotRendered() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
messages, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlOutcomeTargetButtonRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlOutcomeTargetButtonRendererTest.java
index 2403027c8c..a5dc05e760 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlOutcomeTargetButtonRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlOutcomeTargetButtonRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.faces.component.UIParameter;
@@ -30,9 +32,9 @@
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.apache.myfaces.test.mock.MockRenderKitFactory;
import org.apache.myfaces.test.mock.MockResponseWriter;
-import org.junit.jupiter.api.Assertions;
import org.apache.myfaces.renderkit.html.util.ComponentAttrs;
import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -42,7 +44,7 @@
* @author Jakob Korherr (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlOutcomeTargetButtonRendererTest extends AbstractFacesTestCase
+class HtmlOutcomeTargetButtonRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer;
@@ -83,28 +85,23 @@ public void tearDown() throws Exception
form = null;
outcomeTargetButton = null;
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ void clientBehaviorHolderRendersIdAndName()
{
outcomeTargetButton.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
outcomeTargetButton.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
-
+
/**
* Tests if h:button correctly includes all parameters of the implicit
* navigation case created from the outcome.
@@ -112,7 +109,7 @@ public void testClientBehaviorHolderRendersIdAndName()
* @throws Exception
*/
@Test
- public void testOutcomeTargetRendersNavigationCaseParameters() throws Exception
+ void outcomeTargetRendersNavigationCaseParameters() throws Exception
{
// configure the button
outcomeTargetButton.getAttributes().put("includeViewParams", false);
@@ -124,16 +121,16 @@ public void testOutcomeTargetRendersNavigationCaseParameters() throws Exception
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
// make sure the parameters are rendered
- Assertions.assertTrue(output.contains("param1=value1"));
- Assertions.assertTrue(output.contains("param2=value2"));
+ assertTrue(output.contains("param1=value1"));
+ assertTrue(output.contains("param2=value2"));
}
-
+
/**
* Tests if the fragment attribute is correctly rendered.
* @throws Exception
*/
@Test
- public void testFragment() throws Exception
+ void fragment() throws Exception
{
// configure the button
final String fragment = "end";
@@ -146,79 +143,64 @@ public void testFragment() throws Exception
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
// make sure the fragment is rendered
- Assertions.assertTrue(output.contains("param1=value1#" + fragment));
+ assertTrue(output.contains("param1=value1#" + fragment));
}
-
+
/**
* Tests if the h:button correctly includes an UIParameter
* with a non-null-name when creating the URL.
*/
@Test
- public void testIncludesUIParameterInURL()
+ void includesUIParameterInURL()
{
// create the UIParameter and attach it
UIParameter param = new UIParameter();
param.setName("myParameter");
param.setValue("myValue");
outcomeTargetButton.getChildren().add(param);
-
- try
- {
+
+ Assertions.assertDoesNotThrow(() -> {
outcomeTargetButton.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.contains("myParameter=myValue"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.contains("myParameter=myValue"));
+ });
}
-
+
/**
* Tests if the h:button correctly skips an UIParameter
* with a null-name when creating the URL.
*/
@Test
- public void testSkipsNullValueOfUIParameterInURL()
+ void skipsNullValueOfUIParameterInURL()
{
// create the UIParameter with value = null and attach it
UIParameter param = new UIParameter();
param.setName("myNullParameter");
param.setValue(null);
outcomeTargetButton.getChildren().add(param);
-
- try
- {
+
+ Assertions.assertDoesNotThrow(() -> {
outcomeTargetButton.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertFalse(output.contains("myNullParameter"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertFalse(output.contains("myNullParameter"));
+ });
}
-
+
/**
* Tests if the h:button is rendered accordingly if disabled is true.
*/
@Test
- public void testDisabledAttribute()
+ void disabledAttribute()
{
outcomeTargetButton.getAttributes().put(ComponentAttrs.DISABLED_ATTR, Boolean.TRUE);
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
outcomeTargetButton.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
-
+
// Assertions
- Assertions.assertFalse(output.contains(HTML.ONCLICK_ATTR)); // the output must not contain onclick
- Assertions.assertTrue(output.contains(HTML.DISABLED_ATTR)); // the output must contain disabled
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertFalse(output.contains(HTML.ONCLICK_ATTR)); // the output must not contain onclick
+ assertTrue(output.contains(HTML.DISABLED_ATTR)); // the output must contain disabled
+ });
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlRadioRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlRadioRendererTest.java
index 86ab8dd6d9..c26d962f15 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlRadioRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlRadioRendererTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
@@ -42,7 +45,7 @@
* @author Bruno Aranda (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlRadioRendererTest extends AbstractFacesTestCase
+class HtmlRadioRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
private HtmlSelectOneRadio selectOneRadio;
@@ -75,9 +78,9 @@ public void tearDown() throws Exception
selectOneRadio = null;
writer = null;
}
-
+
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = {
//_AccesskeyProperty
@@ -123,15 +126,15 @@ public void testHtmlPropertyPassTru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
selectOneRadio, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ void clientBehaviorHolderRendersIdAndName()
{
UISelectItem item1 = new UISelectItem();
item1.setItemLabel("#1");
@@ -142,19 +145,14 @@ public void testClientBehaviorHolderRendersIdAndName()
item2.setItemValue("#2");
selectOneRadio.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
selectOneRadio.getChildren().add(item1);
selectOneRadio.getChildren().add(item2);
selectOneRadio.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlResponseStateManagerTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlResponseStateManagerTest.java
index 378a1d2117..7397aac01f 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlResponseStateManagerTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlResponseStateManagerTest.java
@@ -18,19 +18,21 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import jakarta.faces.render.ResponseStateManager;
import org.apache.myfaces.test.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-public class HtmlResponseStateManagerTest extends AbstractFacesTestCase
+class HtmlResponseStateManagerTest extends AbstractFacesTestCase
{
@Test
- public void testIsPostback()
+ void isPostback()
{
Mockito.when(_facesContext.getExternalContext()).thenReturn(_externalContext);
Mockito.when(_externalContext.getApplicationMap()).thenReturn(new ConcurrentHashMap<>());
@@ -41,11 +43,11 @@ public void testIsPostback()
map.put(ResponseStateManager.VIEW_STATE_PARAM, "seomthing");
Mockito.when(_externalContext.getRequestParameterMap()).thenReturn(map);
- Assertions.assertEquals(true, hrsm.isPostback(_facesContext));
+ assertTrue(hrsm.isPostback(_facesContext));
}
-
+
@Test
- public void testIsNoPostback()
+ void isNoPostback()
{
Mockito.when(_facesContext.getExternalContext()).thenReturn(_externalContext);
Mockito.when(_externalContext.getApplicationMap()).thenReturn(new ConcurrentHashMap<>());
@@ -53,6 +55,6 @@ public void testIsNoPostback()
HtmlResponseStateManager hrsm = Mockito.spy(HtmlResponseStateManager.class);
- Assertions.assertEquals(false, hrsm.isPostback(_facesContext));
+ assertFalse(hrsm.isPostback(_facesContext));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlResponseWriterImplTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlResponseWriterImplTest.java
index 3133df1de9..0b843b390e 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlResponseWriterImplTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlResponseWriterImplTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.IOException;
import java.io.StringWriter;
import java.lang.reflect.Field;
@@ -26,14 +28,13 @@
import org.apache.myfaces.renderkit.html.util.HTML;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* Test class for HtmlResponseWriterImpl.
*/
-public class HtmlResponseWriterImplTest extends AbstractFacesTestCase
+class HtmlResponseWriterImplTest extends AbstractFacesTestCase
{
private static final String COMMENT_START = " ");
+ assertNotNull(output);
+ assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
+ assertTrue(output.contains(CommentUtils.COMMENT_SIMPLE_START), "script does not have start comment ");
}
-
+
@Test
- public void testScriptOnHtmlIsoEncodingAndNoScriptXhmlComments() throws IOException
+ void scriptOnHtmlIsoEncodingAndNoScriptXhmlComments() throws Exception
{
_writer = new HtmlResponseWriterImpl(_stringWriter, "text/html", "ISO-8859-1", false);
String innerScript = "document.write('HELLO');";
@@ -177,14 +177,14 @@ public void testScriptOnHtmlIsoEncodingAndNoScriptXhmlComments() throws IOExcept
_writer.endDocument();
String output = _stringWriter.toString();
- Assertions.assertNotNull(output);
- Assertions.assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
- Assertions.assertFalse(output.contains(CommentUtils.COMMENT_SIMPLE_START), "script have start comment ");
+ assertNotNull(output);
+ assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
+ assertFalse(output.contains(CommentUtils.COMMENT_SIMPLE_START), "script have start comment ");
}
@Test
- public void testScriptOnHtmlUTF8AndScriptXhmlComments() throws IOException
+ void scriptOnHtmlUTF8AndScriptXhmlComments() throws Exception
{
_writer = new HtmlResponseWriterImpl(_stringWriter, "text/html", "UTF-8", true);
String innerScript = "document.write('HELLO');";
@@ -195,14 +195,14 @@ public void testScriptOnHtmlUTF8AndScriptXhmlComments() throws IOException
_writer.endDocument();
String output = _stringWriter.toString();
- Assertions.assertNotNull(output);
- Assertions.assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
- Assertions.assertTrue(output.contains(CommentUtils.COMMENT_SIMPLE_START), "script does not have start comment ");
+ assertNotNull(output);
+ assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
+ assertTrue(output.contains(CommentUtils.COMMENT_SIMPLE_START), "script does not have start comment ");
}
-
+
@Test
- public void testScriptOnHtmlUTF8AndNoScriptXhmlComments() throws IOException
+ void scriptOnHtmlUTF8AndNoScriptXhmlComments() throws Exception
{
_writer = new HtmlResponseWriterImpl(_stringWriter, "text/html", "UTF-8", false);
String innerScript = "document.write('HELLO');";
@@ -213,14 +213,14 @@ public void testScriptOnHtmlUTF8AndNoScriptXhmlComments() throws IOException
_writer.endDocument();
String output = _stringWriter.toString();
- Assertions.assertNotNull(output);
- Assertions.assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
- Assertions.assertFalse(output.contains(CommentUtils.COMMENT_SIMPLE_START), "script have start comment ");
+ assertNotNull(output);
+ assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
+ assertFalse(output.contains(CommentUtils.COMMENT_SIMPLE_START), "script have start comment ");
}
@Test
- public void testScriptOnXhtmlIsoEncoding() throws IOException
+ void scriptOnXhtmlIsoEncoding() throws Exception
{
_writer = new HtmlResponseWriterImpl(_stringWriter, "application/xhtml+xml", "ISO-8859-1", true);
String innerScript = "document.write('HELLO');";
@@ -231,14 +231,14 @@ public void testScriptOnXhtmlIsoEncoding() throws IOException
_writer.endDocument();
String output = _stringWriter.toString();
- Assertions.assertNotNull(output);
- Assertions.assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
- Assertions.assertTrue(output.contains(CommentUtils.INLINE_SCRIPT_COMMENT+CommentUtils.CDATA_SIMPLE_START), "script does not have start ");
+ assertNotNull(output);
+ assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
+ assertTrue(output.contains(CommentUtils.INLINE_SCRIPT_COMMENT+CommentUtils.CDATA_SIMPLE_START), "script does not have start ");
}
@Test
- public void testScriptOnXhtmlUTF8Encoding() throws IOException
+ void scriptOnXhtmlUTF8Encoding() throws Exception
{
_writer = new HtmlResponseWriterImpl(_stringWriter, "application/xhtml+xml", "UTF-8", false);
String innerScript = "document.write('HELLO');";
@@ -249,14 +249,14 @@ public void testScriptOnXhtmlUTF8Encoding() throws IOException
_writer.endDocument();
String output = _stringWriter.toString();
- Assertions.assertNotNull(output);
- Assertions.assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
- Assertions.assertTrue(output.contains(CommentUtils.INLINE_SCRIPT_COMMENT+CommentUtils.CDATA_SIMPLE_START), "script does not have start ");
+ assertNotNull(output);
+ assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
+ assertTrue(output.contains(CommentUtils.INLINE_SCRIPT_COMMENT+CommentUtils.CDATA_SIMPLE_START), "script does not have start ");
}
-
+
@Test
- public void testStyleOnXhtmlIsoEncoding() throws IOException
+ void styleOnXhtmlIsoEncoding() throws Exception
{
_writer = new HtmlResponseWriterImpl(_stringWriter, "application/xhtml+xml", "ISO-8859-1", true);
String innerScript = "document.write('HELLO');";
@@ -267,14 +267,14 @@ public void testStyleOnXhtmlIsoEncoding() throws IOException
_writer.endDocument();
String output = _stringWriter.toString();
- Assertions.assertNotNull(output);
- Assertions.assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
- Assertions.assertTrue(output.contains(CommentUtils.CDATA_SIMPLE_START), "script does not have start ");
+ assertNotNull(output);
+ assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
+ assertTrue(output.contains(CommentUtils.CDATA_SIMPLE_START), "script does not have start ");
}
@Test
- public void testStyleOnXhtmlUTF8Encoding() throws IOException
+ void styleOnXhtmlUTF8Encoding() throws Exception
{
_writer = new HtmlResponseWriterImpl(_stringWriter, "application/xhtml+xml", "UTF-8", false);
String innerScript = "document.write('HELLO');";
@@ -285,18 +285,18 @@ public void testStyleOnXhtmlUTF8Encoding() throws IOException
_writer.endDocument();
String output = _stringWriter.toString();
- Assertions.assertNotNull(output);
- Assertions.assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
- Assertions.assertTrue(output.contains(CommentUtils.CDATA_SIMPLE_START), "script does not have start ");
+ assertNotNull(output);
+ assertTrue(output.contains(innerScript), "script does not contain body:" + innerScript);
+ assertTrue(output.contains(CommentUtils.CDATA_SIMPLE_START), "script does not have start ");
}
-
+
/**
* writeText(char[]) inside a textarea must NOT map successive spaces to
* or newlines to <br/> — this is the key purpose of the _isTextArea flag.
*/
@Test
- public void testTextareaWriteTextPreservesSpacesAndNewlines() throws IOException
+ void textareaWriteTextPreservesSpacesAndNewlines() throws Exception
{
_writer.startDocument();
_writer.startElement("form", null);
@@ -308,13 +308,13 @@ public void testTextareaWriteTextPreservesSpacesAndNewlines() throws IOException
String output = _stringWriter.toString();
// Spaces must not be turned into inside a textarea
- Assertions.assertFalse(output.contains(" "),
+ assertFalse(output.contains(" "),
"textarea: spaces must not be encoded as ");
// Newlines must not be turned into
inside a textarea
- Assertions.assertFalse(output.contains("
");
// The original characters must appear verbatim
- Assertions.assertTrue(output.contains("hello world"),
+ assertTrue(output.contains("hello world"),
"textarea: original spaces must be present in output");
}
@@ -323,7 +323,7 @@ public void testTextareaWriteTextPreservesSpacesAndNewlines() throws IOException
* to verify case-insensitive textarea detection.
*/
@Test
- public void testTextareaWriteTextUppercase() throws IOException
+ void textareaWriteTextUppercase() throws Exception
{
_writer.startDocument();
_writer.startElement("form", null);
@@ -334,7 +334,7 @@ public void testTextareaWriteTextUppercase() throws IOException
_writer.endDocument();
String output = _stringWriter.toString();
- Assertions.assertFalse(output.contains(" "),
+ assertFalse(output.contains(" "),
"TEXTAREA (uppercase): spaces must not be encoded as ");
}
@@ -343,7 +343,7 @@ public void testTextareaWriteTextUppercase() throws IOException
* writeText(Object) with the equivalent String — exercises the toString() fallback path.
*/
@Test
- public void testWriteTextObjectNonString() throws IOException
+ void writeTextObjectNonString() throws Exception
{
_writer.startDocument();
_writer.startElement("body", null);
@@ -351,7 +351,7 @@ public void testWriteTextObjectNonString() throws IOException
_writer.endElement("body");
_writer.endDocument();
- Assertions.assertTrue(_stringWriter.toString().contains("42"),
+ assertTrue(_stringWriter.toString().contains("42"),
"Non-String value (Integer 42) must be rendered as its toString()");
}
@@ -360,7 +360,7 @@ public void testWriteTextObjectNonString() throws IOException
* (exercises the StreamCharBuffer.writeTo path in writeStyleContent).
*/
@Test
- public void testStyleOnHtmlWritesContentVerbatim() throws IOException
+ void styleOnHtmlWritesContentVerbatim() throws Exception
{
_writer = new HtmlResponseWriterImpl(_stringWriter, "text/html", "UTF-8", false);
String css = "body { color: red; }";
@@ -371,10 +371,10 @@ public void testStyleOnHtmlWritesContentVerbatim() throws IOException
_writer.endDocument();
String output = _stringWriter.toString();
- Assertions.assertTrue(output.contains(css),
+ assertTrue(output.contains(css),
"Plain HTML style content must appear verbatim in output");
// In plain text/html there is no CDATA wrapping
- Assertions.assertFalse(output.contains(CommentUtils.CDATA_SIMPLE_START),
+ assertFalse(output.contains(CommentUtils.CDATA_SIMPLE_START),
"Plain HTML style must not be wrapped in CDATA");
}
@@ -384,7 +384,7 @@ public void testStyleOnHtmlWritesContentVerbatim() throws IOException
* @throws IOException
*/
@Test
- public void testEmptyTagNotRenderEnd() throws IOException
+ void emptyTagNotRenderEnd() throws Exception
{
_writer.startDocument();
_writer.startElement("body", null);
@@ -396,18 +396,18 @@ public void testEmptyTagNotRenderEnd() throws IOException
// the following should render
hello
String output = _stringWriter.toString();
- Assertions.assertNotNull(output);
- Assertions.assertTrue(output.contains("
"));
- Assertions.assertFalse(output.contains(""));
+ assertNotNull(output);
+ assertTrue(output.contains("
"));
+ assertFalse(output.contains(""));
}
-
+
/**
* In xhtml, it is valid to have an html empty tag with content.
*
* @throws IOException
*/
@Test
- public void testEmptyTagNotRenderEndOnXml() throws IOException
+ void emptyTagNotRenderEndOnXml() throws Exception
{
_writer = new HtmlResponseWriterImpl(_stringWriter, "application/xml", "UTF-8", false);
@@ -421,18 +421,18 @@ public void testEmptyTagNotRenderEndOnXml() throws IOException
// the following should render
hello
String output = _stringWriter.toString();
- Assertions.assertNotNull(output);
- Assertions.assertTrue(output.contains("
"));
- Assertions.assertTrue(output.contains(""));
+ assertNotNull(output);
+ assertTrue(output.contains("
"));
+ assertTrue(output.contains(""));
}
-
+
/**
* In html, it is not valid to have an empty tag with content
*
* @throws IOException
*/
@Test
- public void testEmptyTagNotRenderEndUppercase() throws IOException
+ void emptyTagNotRenderEndUppercase() throws Exception
{
_writer.startDocument();
_writer.startElement("body", null);
@@ -444,18 +444,18 @@ public void testEmptyTagNotRenderEndUppercase() throws IOException
// the following should render
hello
String output = _stringWriter.toString();
- Assertions.assertNotNull(output);
- Assertions.assertTrue(output.contains("
"));
- Assertions.assertFalse(output.contains(""));
+ assertNotNull(output);
+ assertTrue(output.contains("
"));
+ assertFalse(output.contains(""));
}
-
+
/**
* In xhtml, it is valid to have an html empty tag with content.
*
* @throws IOException
*/
@Test
- public void testEmptyTagNotRenderEndOnXhtmlUppercase() throws IOException
+ void emptyTagNotRenderEndOnXhtmlUppercase() throws Exception
{
_writer = new HtmlResponseWriterImpl(_stringWriter, "application/xml", "UTF-8", false);
@@ -469,8 +469,8 @@ public void testEmptyTagNotRenderEndOnXhtmlUppercase() throws IOException
// the following should render
hello
String output = _stringWriter.toString();
- Assertions.assertNotNull(output);
- Assertions.assertTrue(output.contains("
"));
- Assertions.assertTrue(output.contains(""));
+ assertNotNull(output);
+ assertTrue(output.contains("
"));
+ assertTrue(output.contains(""));
}
}
\ No newline at end of file
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlRolePassedThroughTestCase.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlRolePassedThroughTestCase.java
index e1d53d7d74..7069914b2e 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlRolePassedThroughTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlRolePassedThroughTestCase.java
@@ -18,18 +18,18 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.el.ExpressionFactory;
import jakarta.faces.component.UIViewRoot;
-import org.junit.jupiter.api.Assertions;
-
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.junit.jupiter.api.Test;
-public class HtmlRolePassedThroughTestCase extends AbstractFaceletTestCase
+class HtmlRolePassedThroughTestCase extends AbstractFaceletTestCase
{
@Override
@@ -45,7 +45,7 @@ protected ExpressionFactory createExpressionFactory()
}
@Test
- public void testRole() throws Exception
+ void role() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "role.xhtml");
@@ -59,28 +59,28 @@ public void testRole() throws Exception
//System.out.println("********************HTMLRolePassedThroughTest*****************");
//System.out.println(sw.toString());
//System.out.println("********************HTMLRolePassedThroughTest*****************");
- Assertions.assertTrue(sw.toString().contains("value=\"user name\" role=\"new presentation\""));
- Assertions.assertTrue(sw.toString().contains("id=\"helloForm:link\" role=\"new presentation\""));
- Assertions.assertTrue(sw.toString().contains(""));
- Assertions.assertTrue(sw.toString().contains("value=\"one\" role=\"new presentation\""));
+ assertTrue(sw.toString().contains("value=\"user name\" role=\"new presentation\""));
+ assertTrue(sw.toString().contains("id=\"helloForm:link\" role=\"new presentation\""));
+ assertTrue(sw.toString().contains(""));
+ assertTrue(sw.toString().contains("value=\"one\" role=\"new presentation\""));
- Assertions.assertTrue(sw.toString().contains("id=\"helloForm:data\" role=\"new presentation\""));
- Assertions.assertTrue(sw.toString().contains("id=\"helloForm:graphic\" role=\"new presentation\""));
- Assertions.assertTrue(sw.toString().contains("type=\"file\" role=\"new presentation\""));
- Assertions.assertTrue(sw.toString().contains("name=\"helloForm:area\" role=\"new presentation\""));
+ assertTrue(sw.toString().contains("id=\"helloForm:data\" role=\"new presentation\""));
+ assertTrue(sw.toString().contains("id=\"helloForm:graphic\" role=\"new presentation\""));
+ assertTrue(sw.toString().contains("type=\"file\" role=\"new presentation\""));
+ assertTrue(sw.toString().contains("name=\"helloForm:area\" role=\"new presentation\""));
- Assertions.assertTrue(sw.toString().contains("id=\"helloForm:outputFormat\" role=\"new presentation\""));
- Assertions.assertTrue(sw.toString().contains("id=\"helloForm:outputLabel\" role=\"new presentation\""));
- Assertions.assertTrue(sw.toString().contains("name=\"helloForm:outputLink\" role=\"new presentation\""));
- Assertions.assertTrue(sw.toString().contains("id=\"helloForm:outputText\" role=\"new presentation\""));
+ assertTrue(sw.toString().contains("id=\"helloForm:outputFormat\" role=\"new presentation\""));
+ assertTrue(sw.toString().contains("id=\"helloForm:outputLabel\" role=\"new presentation\""));
+ assertTrue(sw.toString().contains("name=\"helloForm:outputLink\" role=\"new presentation\""));
+ assertTrue(sw.toString().contains("id=\"helloForm:outputText\" role=\"new presentation\""));
// Assertions.assertTrue(sw.toString().contains("(?s).*", output);
+ assertEquals("", output);
}
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicAttrs();
HtmlCheckAttributesUtil.checkRenderedAttributes(
inputText, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ void clientBehaviorHolderRendersIdAndName()
{
inputText.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
inputText.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches(".+id=\".+\".+"));
- Assertions.assertTrue(output.matches(".+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches(".+id=\".+\".+"));
+ assertTrue(output.matches(".+name=\".+\".+"));
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTableRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTableRendererTest.java
index 13034f332c..1dd9f54e36 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTableRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTableRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
@@ -42,7 +44,7 @@
* @author Bruno Aranda (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlTableRendererTest extends AbstractFacesTestCase
+class HtmlTableRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
private HtmlDataTable dataTable;
@@ -83,57 +85,52 @@ public void tearDown() throws Exception
}
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicReadOnlyAttrs();
HtmlCheckAttributesUtil.checkRenderedAttributes(
dataTable, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testHtmlPropertyPassTruNotRendered() throws Exception
+ void htmlPropertyPassTruNotRendered() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateAttrsNotRenderedForReadOnlyButBehaviorEvents();
HtmlCheckAttributesUtil.checkRenderedAttributes(
dataTable, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ void clientBehaviorHolderRendersIdAndName()
{
dataTable.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
dataTable.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches("(?s).+id=\".+\".+"));
- Assertions.assertTrue(output.matches("(?s).+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches("(?s).+id=\".+\".+"));
+ assertTrue(output.matches("(?s).+name=\".+\".+"));
+ });
}
-
+
/**
* Check table renderer behavior when DataModel returns -1 from getRowCount(). It should
* render the same as if that value is provided. Note t:dataTable newspaper mode requires
* row count to calculate newspaperRows and newspaperColumns.
*/
@Test
- public void testNoRowCountRender()
+ void noRowCountRender()
{
List list = new ArrayList();
list.add(new Person("John" , "Smith"));
@@ -162,42 +159,30 @@ public void testNoRowCountRender()
dataTable.setValue(new UnknownRowCountDemoDataModel(list));
- String output1 = null;
- try
- {
+ String output1 = Assertions.assertDoesNotThrow(() -> {
dataTable.encodeAll(facesContext);
- output1 = ((StringWriter) writer.getWriter()).getBuffer().toString();
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ return ((StringWriter) writer.getWriter()).getBuffer().toString();
+ });
dataTable.setValue(new ListDataModel(list));
((StringWriter) writer.getWriter()).getBuffer().setLength(0);
- String output2 = null;
- try
- {
+ String output2 = Assertions.assertDoesNotThrow(() -> {
dataTable.encodeAll(facesContext);
- output2 = ((StringWriter) writer.getWriter()).getBuffer().toString();
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ return ((StringWriter) writer.getWriter()).getBuffer().toString();
+ });
- Assertions.assertTrue(output2.contains("John"));
- Assertions.assertTrue(output2.contains("Smith"));
- Assertions.assertTrue(output2.contains("class1"));
- Assertions.assertTrue(output2.contains("class2"));
+ assertTrue(output2.contains("John"));
+ assertTrue(output2.contains("Smith"));
+ assertTrue(output2.contains("class1"));
+ assertTrue(output2.contains("class2"));
- Assertions.assertTrue(output1.contains("John"));
- Assertions.assertTrue(output1.contains("Smith"));
- Assertions.assertTrue(output1.contains("class1"));
- Assertions.assertTrue(output1.contains("class2"));
+ assertTrue(output1.contains("John"));
+ assertTrue(output1.contains("Smith"));
+ assertTrue(output1.contains("class1"));
+ assertTrue(output1.contains("class2"));
- Assertions.assertEquals(output2, output1);
+ assertEquals(output2, output1);
}
public class Person
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextRendererTest.java
index 8a283c2e41..5e6523b863 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.IOException;
import java.io.StringWriter;
@@ -48,7 +50,7 @@
* @author Bruno Aranda (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlTextRendererTest extends AbstractFacesTestCase
+class HtmlTextRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
@@ -93,7 +95,7 @@ public void tearDown() throws Exception
}
@Test
- public void testStyleClassAttr() throws IOException
+ void styleClassAttr() throws Exception
{
outputText.setValue("Output");
outputText.setStyleClass("myStyleClass");
@@ -104,24 +106,24 @@ public void testStyleClassAttr() throws IOException
String output = writer.getWriter().toString();
- Assertions.assertEquals("Output", output);
- Assertions.assertNotSame("Output", output);
+ assertEquals("Output", output);
+ assertNotSame("Output", output);
}
@Test
- public void testInputDefaultTypeAttr() throws IOException
+ void inputDefaultTypeAttr() throws Exception
{
inputText.encodeBegin(facesContext);
inputText.encodeEnd(facesContext);
facesContext.renderResponse();
String output = writer.getWriter().toString();
- Assertions.assertEquals("", output);
- Assertions.assertNotSame("Output", output);
+ assertEquals("", output);
+ assertNotSame("Output", output);
}
@Test
- public void testInputTypeAttr() throws IOException
+ void inputTypeAttr() throws Exception
{
inputText.setType("tel");
@@ -130,17 +132,17 @@ public void testInputTypeAttr() throws IOException
facesContext.renderResponse();
String output = writer.getWriter().toString();
- Assertions.assertEquals("", output);
- Assertions.assertNotSame("Output", output);
+ assertEquals("", output);
+ assertNotSame("Output", output);
}
-
+
/**
* Don't add span over escape
* @throws IOException
*/
@Test
- public void testEscapeNoSpan() throws IOException
+ void escapeNoSpan() throws Exception
{
outputText.setValue("Output");
outputText.setEscape(true);
@@ -151,11 +153,11 @@ public void testEscapeNoSpan() throws IOException
String output = writer.getWriter().toString();
- Assertions.assertEquals("Output", output);
+ assertEquals("Output", output);
}
@Test
- public void testHtmlPropertyPassThru() throws Exception
+ void htmlPropertyPassThru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicAttrs();
@@ -163,12 +165,12 @@ public void testHtmlPropertyPassThru() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(
inputText, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
@Test
- public void testWhenSubmittedValueIsNullDefaultShouldDisappearFromRendering() {
+ void whenSubmittedValueIsNullDefaultShouldDisappearFromRendering() {
//See MYFACES-2161 and MYFACES-1549 for details
UIViewRoot root = new UIViewRoot();
UIForm form = new UIForm();
@@ -232,75 +234,60 @@ public String getAsString(FacesContext context,
// 4) renderer calls getValue(); --> getValue() evaluates the
// value-binding, as the local-value is 'null', and I get the
// default-value of the bean shown again
- Assertions.assertNotSame(expression.getValue(facesContext.getELContext()), inputText.getValue());
- Assertions.assertNull(inputText.getValue());
+ assertNotSame(expression.getValue(facesContext.getELContext()), inputText.getValue());
+ assertNull(inputText.getValue());
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ void clientBehaviorHolderRendersIdAndName()
{
inputText.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
inputText.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches("(?s).+id=\".+\".+"));
- Assertions.assertTrue(output.matches("(?s).+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches("(?s).+id=\".+\".+"));
+ assertTrue(output.matches("(?s).+name=\".+\".+"));
+ });
}
-
+
/**
* Tests if a JavaScript user code is correctly escaped.
* e.g. alert('test') has to become alert(\'test\')
*/
@Test
- public void testClientBehaviorUserCodeJavaScriptEscaping()
+ void clientBehaviorUserCodeJavaScriptEscaping()
{
inputText.getAttributes().put("onchange", "alert('test')");
inputText.addClientBehavior("change", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
inputText.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
// onchange="faces.util.chain(document.getElementById('j_id0'), event,
// 'alert(\'test\')');"
- Assertions.assertTrue(output.contains("'alert(\\'test\\')'"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.contains("'alert(\\'test\\')'"));
+ });
}
-
+
/**
* Tests if a JavaScript user code that already contains ' is correctly escaped.
* e.g. test = 'a\'b'; has to become test = \'a\\\'b\';
*/
@Test
- public void testClientBehaviorUserCodeJavaScriptDoubleEscaping()
+ void clientBehaviorUserCodeJavaScriptDoubleEscaping()
{
inputText.getAttributes().put("onchange", "var test = 'a\\'b'; alert(test);");
inputText.addClientBehavior("change", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
inputText.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
// onchange="faces.util.chain(document.getElementById('j_id0'), event,
// 'var test = \'a\\\'b\'; alert(test);');"
- Assertions.assertTrue(output.contains("'var test = \\'a\\\\\\'b\\'; alert(test);'"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.contains("'var test = \\'a\\\\\\'b\\'; alert(test);'"));
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextareaRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextareaRendererTest.java
index 82a99428d2..319772f83f 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextareaRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextareaRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.faces.component.behavior.AjaxBehavior;
@@ -37,7 +39,7 @@
* @author Bruno Aranda (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlTextareaRendererTest extends AbstractFacesTestCase
+class HtmlTextareaRendererTest extends AbstractFacesTestCase
{
private MockResponseWriter writer ;
private HtmlInputTextarea inputTextarea;
@@ -71,18 +73,18 @@ public void tearDown() throws Exception
}
@Test
- public void testRenderDefault() throws Exception
+ void renderDefault() throws Exception
{
inputTextarea.encodeBegin(facesContext);
inputTextarea.encodeEnd(facesContext);
facesContext.renderResponse();
String output = writer.getWriter().toString();
- Assertions.assertEquals("", output);
+ assertEquals("", output);
}
@Test
- public void testRenderColsRows() throws Exception
+ void renderColsRows() throws Exception
{
inputTextarea.setCols(5);
inputTextarea.setRows(10);
@@ -91,39 +93,34 @@ public void testRenderColsRows() throws Exception
facesContext.renderResponse();
String output = writer.getWriter().toString();
- Assertions.assertEquals("", output);
+ assertEquals("", output);
}
-
+
@Test
- public void testHtmlPropertyPassTru() throws Exception
+ void htmlPropertyPassTru() throws Exception
{
HtmlRenderedAttr[] attrs = HtmlCheckAttributesUtil.generateBasicAttrs();
HtmlCheckAttributesUtil.checkRenderedAttributes(
inputTextarea, facesContext, writer, attrs);
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
}
}
-
+
/**
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ void clientBehaviorHolderRendersIdAndName()
{
inputTextarea.addClientBehavior("keypress", new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
inputTextarea.encodeAll(facesContext);
String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
- Assertions.assertTrue(output.matches("(?s).+id=\".+\".+"));
- Assertions.assertTrue(output.matches("(?s).+name=\".+\".+"));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(output.matches("(?s).+id=\".+\".+"));
+ assertTrue(output.matches("(?s).+name=\".+\".+"));
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AbstractClientBehaviorTestCase.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AbstractClientBehaviorTestCase.java
index a7d4e864e1..05e7faba26 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AbstractClientBehaviorTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AbstractClientBehaviorTestCase.java
@@ -18,17 +18,20 @@
*/
package org.apache.myfaces.renderkit.html.behavior;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
import jakarta.faces.FactoryFinder;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.component.behavior.AjaxBehavior;
import jakarta.faces.component.behavior.ClientBehaviorHolder;
import jakarta.faces.context.ResponseWriter;
+import org.junit.jupiter.api.Assertions;
import org.apache.myfaces.renderkit.html.HtmlResponseWriterImpl;
import org.apache.myfaces.util.lang.FastWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -88,7 +91,7 @@ protected void setUpRenderKit() throws Exception
* Components that render client behaviors should always render "id" and "name" attribute
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ public void clientBehaviorHolderRendersIdAndName()
{
HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
@@ -97,23 +100,18 @@ public void testClientBehaviorHolderRendersIdAndName()
UIComponent component = createComponentToTest();
ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
component.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertTrue(output.indexOf(" id=\""+component.getClientId(facesContext)+"\"") > -1);
- Assertions.assertTrue(output.indexOf(" name=\""+component.getClientId(facesContext)+"\"") > -1);
+ assertTrue(output.indexOf(" id=\"" + component.getClientId(facesContext) + "\"") > -1);
+ assertTrue(output.indexOf(" name=\"" + component.getClientId(facesContext) + "\"") > -1);
outputWriter.reset();
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ });
}
}
@Test
- public void testClientBehaviorRendered()
+ public void clientBehaviorRendered()
{
HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
@@ -131,21 +129,17 @@ public void testClientBehaviorRendered()
ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
- try
- {
+ HtmlRenderedClientEventAttr attr = attrs[i];
+ Assertions.assertDoesNotThrow(() -> {
component.encodeAll(facesContext);
String output = outputWriter.toString();
//faces.ajax.request('j_id0',event,{'jakarta.faces.behavior.event':'click'})
//Only check if the property starts with faces.ajax.request( is enough
//Assertions.assertTrue("output does not match expected output faces.ajax.request(.... for property "+attrs[i].getName(),
// output.matches(".+ "+attrs[i].getName()+"=\"faces\\.ajax\\.request\\(.+"));
- int index = checkClientBehaviorRenderedOnClientEventProperty(output, 0, attrs[i]);
+ int index = checkClientBehaviorRenderedOnClientEventProperty(output, 0, attr);
outputWriter.reset();
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ });
}
}
@@ -159,19 +153,19 @@ public int checkClientBehaviorRenderedOnClientEventProperty(String output, int s
int startPropIndex = propIndex + propStart.length();
int endPropIndex = output.indexOf('"' , startPropIndex );
String propertyValue = output.substring(startPropIndex, endPropIndex);
- Assertions.assertTrue(propertyValue.contains("myfaces.ab("));
- Assertions.assertTrue(propertyValue.contains(attr.getClientEvent()));
+ assertTrue(propertyValue.contains("myfaces.ab("));
+ assertTrue(propertyValue.contains(attr.getClientEvent()));
return endPropIndex + 1;
}
else
{
- Assertions.fail("Property " + attr.getName() + " not found");
+ fail("Property " + attr.getName() + " not found");
return -1;
}
}
@Test
- public void testClientBehaviorRenderedWithHtmlAttribute()
+ public void clientBehaviorRenderedWithHtmlAttribute()
{
HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
@@ -181,21 +175,17 @@ public void testClientBehaviorRenderedWithHtmlAttribute()
ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
component.getAttributes().put(attrs[i].getName(), "htmlValue");
- try
- {
+ HtmlRenderedClientEventAttr attr = attrs[i];
+ Assertions.assertDoesNotThrow(() -> {
component.encodeAll(facesContext);
String output = outputWriter.toString();
//faces.ajax.request('j_id0',event,{'jakarta.faces.behavior.event':'click'})
//Only check if the property starts with faces.ajax.request( is enough
//Assertions.assertTrue("output does not match expected output faces.ajax.request(.... for property "+attrs[i].getName(),
// output.matches(".+ "+attrs[i].getName()+"=\"faces\\.ajax\\.request\\(.+"));
- int index = checkClientBehaviorRenderedOnClientEventPropertyAndHtmlValue(output, 0, attrs[i], "htmlValue");
+ int index = checkClientBehaviorRenderedOnClientEventPropertyAndHtmlValue(output, 0, attr, "htmlValue");
outputWriter.reset();
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ });
}
}
@@ -209,15 +199,15 @@ public int checkClientBehaviorRenderedOnClientEventPropertyAndHtmlValue(String o
int startPropIndex = propIndex + propStart.length();
int endPropIndex = output.indexOf('"' , startPropIndex );
String propertyValue = output.substring(startPropIndex, endPropIndex);
- Assertions.assertTrue(propertyValue.startsWith("faces.util.chain("));
- Assertions.assertTrue(propertyValue.contains("myfaces.ab("));
- Assertions.assertTrue(propertyValue.contains(attr.getClientEvent()));
- Assertions.assertTrue(propertyValue.contains(value));
+ assertTrue(propertyValue.startsWith("faces.util.chain("));
+ assertTrue(propertyValue.contains("myfaces.ab("));
+ assertTrue(propertyValue.contains(attr.getClientEvent()));
+ assertTrue(propertyValue.contains(value));
return endPropIndex + 1;
}
else
{
- Assertions.fail("Property " + attr.getName() + " not found Output: "+output);
+ fail("Property " + attr.getName() + " not found Output: "+output);
return -1;
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AdditionalHtmlEventsClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AdditionalHtmlEventsClientBehaviorRendererTest.java
index 26dbc94ff1..330df6339c 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AdditionalHtmlEventsClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AdditionalHtmlEventsClientBehaviorRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html.behavior;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.el.ValueExpression;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.behavior.AjaxBehavior;
@@ -33,7 +35,6 @@
import org.apache.myfaces.test.el.MockValueExpression;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -45,7 +46,7 @@
* The inherited test cases cover exactly that for a set of events which have no property on any standard component,
* this class adds the cases which are specific to this feature.
*/
-public class AdditionalHtmlEventsClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class AdditionalHtmlEventsClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
@@ -92,14 +93,14 @@ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes(
* A plain on* attribute without a matching property must be rendered as a pass through attribute.
*/
@Test
- public void testPlainAttributeWithoutBehaviorIsRendered() throws Exception
+ void plainAttributeWithoutBehaviorIsRendered() throws Exception
{
HtmlInputText input = new HtmlInputText();
input.getAttributes().put("oninput", "alert('input')");
input.encodeAll(facesContext);
- Assertions.assertTrue(outputWriter.toString().contains(" oninput=\"alert('input')\""),
+ assertTrue(outputWriter.toString().contains(" oninput=\"alert('input')\""),
outputWriter.toString());
}
@@ -108,7 +109,7 @@ public void testPlainAttributeWithoutBehaviorIsRendered() throws Exception
* set, so it needs the {@code EVENT_ATTRIBUTES_MARKED} marker to be found at render time.
*/
@Test
- public void testValueExpressionAttributeWithoutBehaviorIsRendered() throws Exception
+ void valueExpressionAttributeWithoutBehaviorIsRendered() throws Exception
{
ValueExpression expression = new MockValueExpression("#{requestScope.oninputScript}", String.class);
expression.setValue(facesContext.getELContext(), "alert(1)");
@@ -118,7 +119,7 @@ public void testValueExpressionAttributeWithoutBehaviorIsRendered() throws Excep
input.encodeAll(facesContext);
- Assertions.assertTrue(outputWriter.toString().contains(" oninput=\"alert(1)\""), outputWriter.toString());
+ assertTrue(outputWriter.toString().contains(" oninput=\"alert(1)\""), outputWriter.toString());
}
/**
@@ -126,21 +127,21 @@ public void testValueExpressionAttributeWithoutBehaviorIsRendered() throws Excep
* standard HTML RenderKit: the substring after "on" has to be contained in getEventNames().
*/
@Test
- public void testUnknownEventAttributeIsNotRendered() throws Exception
+ void unknownEventAttributeIsNotRendered() throws Exception
{
HtmlInputText input = new HtmlInputText();
input.getAttributes().put("onsomethingweird", "alert('nope')");
input.encodeAll(facesContext);
- Assertions.assertFalse(outputWriter.toString().contains("onsomethingweird"), outputWriter.toString());
+ assertFalse(outputWriter.toString().contains("onsomethingweird"), outputWriter.toString());
}
/**
* The very use case of the spec issue: an f:ajax on an event which no component declares as a property.
*/
@Test
- public void testAjaxBehaviorOnAdditionalEventIsRendered() throws Exception
+ void ajaxBehaviorOnAdditionalEventIsRendered() throws Exception
{
HtmlInputText input = new HtmlInputText();
input.addClientBehavior("input", new AjaxBehavior());
@@ -148,15 +149,15 @@ public void testAjaxBehaviorOnAdditionalEventIsRendered() throws Exception
input.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertTrue(output.contains(" oninput=\""), output);
- Assertions.assertTrue(output.contains("myfaces.ab("), output);
+ assertTrue(output.contains(" oninput=\""), output);
+ assertTrue(output.contains("myfaces.ab("), output);
}
/**
* The renderer specific attributes must keep working exactly as before, next to the additional ones.
*/
@Test
- public void testRendererSpecificAndAdditionalEventsAreCombined() throws Exception
+ void rendererSpecificAndAdditionalEventsAreCombined() throws Exception
{
HtmlInputText input = new HtmlInputText();
input.setOnclick("alert('click')");
@@ -165,8 +166,8 @@ public void testRendererSpecificAndAdditionalEventsAreCombined() throws Exceptio
input.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertTrue(output.contains(" onclick=\"alert('click')\""), output);
- Assertions.assertTrue(output.contains(" oninput=\"alert('input')\""), output);
+ assertTrue(output.contains(" onclick=\"alert('click')\""), output);
+ assertTrue(output.contains(" oninput=\"alert('input')\""), output);
}
/**
@@ -174,7 +175,7 @@ public void testRendererSpecificAndAdditionalEventsAreCombined() throws Exceptio
* different renderers and rendering paths.
*/
@Test
- public void testAdditionalEventsOnOtherComponents() throws Exception
+ void additionalEventsOnOtherComponents() throws Exception
{
assertAdditionalEventRendered(new HtmlCommandButton());
assertAdditionalEventRendered(new HtmlOutputLink());
@@ -189,7 +190,7 @@ public void testAdditionalEventsOnOtherComponents() throws Exception
* hand (h:panelGroup only renders the mouse/key/click events itself) must be rendered generically as well.
*/
@Test
- public void testFieldEventOnNonFieldComponent() throws Exception
+ void fieldEventOnNonFieldComponent() throws Exception
{
HtmlPanelGroup group = new HtmlPanelGroup();
group.setLayout("block");
@@ -199,8 +200,8 @@ public void testFieldEventOnNonFieldComponent() throws Exception
group.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertTrue(output.contains(" onfocus=\"doFocus()\""), output);
- Assertions.assertTrue(output.contains(" onblur=\""), output);
+ assertTrue(output.contains(" onfocus=\"doFocus()\""), output);
+ assertTrue(output.contains(" onblur=\""), output);
}
/**
@@ -208,7 +209,7 @@ public void testFieldEventOnNonFieldComponent() throws Exception
* the generic pass.
*/
@Test
- public void testRendererHandledEventIsNotRenderedTwice() throws Exception
+ void rendererHandledEventIsNotRenderedTwice() throws Exception
{
HtmlInputText input = new HtmlInputText();
input.setOnclick("doClick()");
@@ -217,8 +218,8 @@ public void testRendererHandledEventIsNotRenderedTwice() throws Exception
input.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertEquals(output.indexOf(" onclick=\""), output.lastIndexOf(" onclick=\""), output);
- Assertions.assertEquals(output.indexOf(" onfocus=\""), output.lastIndexOf(" onfocus=\""), output);
+ assertEquals(output.indexOf(" onclick=\""), output.lastIndexOf(" onclick=\""), output);
+ assertEquals(output.indexOf(" onfocus=\""), output.lastIndexOf(" onfocus=\""), output);
}
private void assertAdditionalEventRendered(UIComponent component) throws Exception
@@ -230,9 +231,9 @@ private void assertAdditionalEventRendered(UIComponent component) throws Excepti
component.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertTrue(output.contains(" oninput=\"alert('input')\""),
+ assertTrue(output.contains(" oninput=\"alert('input')\""),
component.getClass().getSimpleName() + ": " + output);
- Assertions.assertTrue(output.contains(" onwheel=\""),
+ assertTrue(output.contains(" onwheel=\""),
component.getClass().getSimpleName() + ": " + output);
}
@@ -240,49 +241,49 @@ private void assertAdditionalEventRendered(UIComponent component) throws Excepti
* jsf:element mirrors the standard HTML components and must expose and render every HTML event as well.
*/
@Test
- public void testAdditionalEventsOnJsfElement() throws Exception
+ void additionalEventsOnJsfElement() throws Exception
{
JsfElement element = new JsfElement();
element.getPassThroughAttributes().put(Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY, "div");
element.getAttributes().put("oninput", "doInput()");
element.addClientBehavior("wheel", new AjaxBehavior());
- Assertions.assertTrue(element.getEventNames().contains("input"));
- Assertions.assertTrue(element.getEventNames().contains("scrollend"));
+ assertTrue(element.getEventNames().contains("input"));
+ assertTrue(element.getEventNames().contains("scrollend"));
element.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertTrue(output.contains(" oninput=\"doInput()\""), output);
- Assertions.assertTrue(output.contains(" onwheel=\""), output);
+ assertTrue(output.contains(" oninput=\"doInput()\""), output);
+ assertTrue(output.contains(" onwheel=\""), output);
}
/**
* The event names must reflect the component type, as the spec assigns a different set per component category.
*/
@Test
- public void testEventNamesPerComponentCategory()
+ void eventNamesPerComponentCategory()
{
// EditableValueHolder
- Assertions.assertTrue(new HtmlInputText().getEventNames().contains("valueChange"));
- Assertions.assertFalse(new HtmlInputText().getEventNames().contains("action"));
+ assertTrue(new HtmlInputText().getEventNames().contains("valueChange"));
+ assertFalse(new HtmlInputText().getEventNames().contains("action"));
// ActionSource
- Assertions.assertTrue(new HtmlCommandButton().getEventNames().contains("action"));
- Assertions.assertFalse(new HtmlCommandButton().getEventNames().contains("valueChange"));
+ assertTrue(new HtmlCommandButton().getEventNames().contains("action"));
+ assertFalse(new HtmlCommandButton().getEventNames().contains("valueChange"));
// neither of both
- Assertions.assertFalse(new HtmlPanelGroup().getEventNames().contains("action"));
- Assertions.assertFalse(new HtmlPanelGroup().getEventNames().contains("valueChange"));
+ assertFalse(new HtmlPanelGroup().getEventNames().contains("action"));
+ assertFalse(new HtmlPanelGroup().getEventNames().contains("valueChange"));
// all of them expose the plain HTML events, including the window level ones
for (UIComponent component : new UIComponent[]
{ new HtmlInputText(), new HtmlCommandButton(), new HtmlPanelGroup() })
{
ClientBehaviorHolder holder = (ClientBehaviorHolder) component;
- Assertions.assertTrue(holder.getEventNames().contains("input"));
- Assertions.assertTrue(holder.getEventNames().contains("click"));
- Assertions.assertTrue(holder.getEventNames().contains("scrollend"));
+ assertTrue(holder.getEventNames().contains("input"));
+ assertTrue(holder.getEventNames().contains("click"));
+ assertTrue(holder.getEventNames().contains("scrollend"));
}
}
@@ -290,35 +291,35 @@ public void testEventNamesPerComponentCategory()
* The default event names as mandated by the spec.
*/
@Test
- public void testDefaultEventNames()
+ void defaultEventNames()
{
- Assertions.assertEquals("valueChange", new HtmlInputText().getDefaultEventName());
- Assertions.assertEquals("action", new HtmlCommandButton().getDefaultEventName());
- Assertions.assertEquals("click", new HtmlOutputLink().getDefaultEventName());
- Assertions.assertNull(new HtmlPanelGroup().getDefaultEventName());
+ assertEquals("valueChange", new HtmlInputText().getDefaultEventName());
+ assertEquals("action", new HtmlCommandButton().getDefaultEventName());
+ assertEquals("click", new HtmlOutputLink().getDefaultEventName());
+ assertNull(new HtmlPanelGroup().getDefaultEventName());
}
/**
* Unknown event names can be added via context-param, and are then usable like any built in one.
*/
@Test
- public void testAdditionalEventNamesContextParam() throws Exception
+ void additionalEventNamesContextParam() throws Exception
{
servletContext.addInitParameter(HtmlEvents.ADDITIONAL_HTML_EVENT_NAMES_PARAM_NAME, " foo\t bar\nfoo ");
- Assertions.assertTrue(HtmlEvents.getAdditionalHtmlEventNames(facesContext).contains("foo"));
- Assertions.assertTrue(HtmlEvents.getAdditionalHtmlEventNames(facesContext).contains("bar"));
+ assertTrue(HtmlEvents.getAdditionalHtmlEventNames(facesContext).contains("foo"));
+ assertTrue(HtmlEvents.getAdditionalHtmlEventNames(facesContext).contains("bar"));
HtmlInputText input = new HtmlInputText();
- Assertions.assertTrue(input.getEventNames().contains("foo"));
+ assertTrue(input.getEventNames().contains("foo"));
input.getAttributes().put("onfoo", "alert('foo')");
input.addClientBehavior("bar", new AjaxBehavior());
input.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertTrue(output.contains(" onfoo=\"alert('foo')\""), output);
- Assertions.assertTrue(output.contains(" onbar=\""), output);
+ assertTrue(output.contains(" onfoo=\"alert('foo')\""), output);
+ assertTrue(output.contains(" onbar=\""), output);
}
/**
@@ -326,32 +327,32 @@ public void testAdditionalEventNamesContextParam() throws Exception
* distinct and layered as documented.
*/
@Test
- public void testEventNameCollections()
+ void eventNameCollections()
{
- Assertions.assertTrue(HtmlEvents.getAdditionalHtmlEventNames(facesContext).isEmpty());
+ assertTrue(HtmlEvents.getAdditionalHtmlEventNames(facesContext).isEmpty());
- Assertions.assertTrue(HtmlEvents.getHtmlBodyEventNames(facesContext)
+ assertTrue(HtmlEvents.getHtmlBodyEventNames(facesContext)
.containsAll(HtmlEvents.getHtmlElementEventNames(facesContext)));
- Assertions.assertTrue(HtmlEvents.getHtmlBodyEventNames(facesContext)
+ assertTrue(HtmlEvents.getHtmlBodyEventNames(facesContext)
.containsAll(HtmlEvents.getHtmlWindowEventNames(facesContext)));
- Assertions.assertTrue(HtmlEvents.getFacesActionSourceEventNames(facesContext)
+ assertTrue(HtmlEvents.getFacesActionSourceEventNames(facesContext)
.containsAll(HtmlEvents.getHtmlElementEventNames(facesContext)));
- Assertions.assertTrue(HtmlEvents.getFacesEditableValueHolderEventNames(facesContext)
+ assertTrue(HtmlEvents.getFacesEditableValueHolderEventNames(facesContext)
.containsAll(HtmlEvents.getHtmlElementEventNames(facesContext)));
// the events which are forwarded to the Window object on the body element are still element level events
- Assertions.assertTrue(HtmlEvents.getHtmlElementEventNames(facesContext).contains("load"));
- Assertions.assertFalse(HtmlEvents.getHtmlWindowEventNames(facesContext).contains("load"));
+ assertTrue(HtmlEvents.getHtmlElementEventNames(facesContext).contains("load"));
+ assertFalse(HtmlEvents.getHtmlWindowEventNames(facesContext).contains("load"));
// the window level events are exclusive to the body element event names
- Assertions.assertFalse(HtmlEvents.getHtmlElementEventNames(facesContext).contains("unload"));
- Assertions.assertTrue(HtmlEvents.getHtmlWindowEventNames(facesContext).contains("unload"));
- Assertions.assertTrue(HtmlEvents.getHtmlBodyEventNames(facesContext).contains("unload"));
+ assertFalse(HtmlEvents.getHtmlElementEventNames(facesContext).contains("unload"));
+ assertTrue(HtmlEvents.getHtmlWindowEventNames(facesContext).contains("unload"));
+ assertTrue(HtmlEvents.getHtmlBodyEventNames(facesContext).contains("unload"));
String previous = null;
for (String eventName : HtmlEvents.getFacesEditableValueHolderEventNames(facesContext))
{
- Assertions.assertTrue(previous == null || previous.compareTo(eventName) < 0,
+ assertTrue(previous == null || previous.compareTo(eventName) < 0,
"not sorted and distinct at " + eventName);
previous = eventName;
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AjaxBehaviorRenderTestCase.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AjaxBehaviorRenderTestCase.java
index 33aa87bf07..f217b2412c 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AjaxBehaviorRenderTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AjaxBehaviorRenderTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html.behavior;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.faces.application.ViewHandler;
@@ -25,7 +27,6 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class AjaxBehaviorRenderTestCase extends AbstractFaceletTestCase {
@@ -38,7 +39,7 @@ protected void setUpServletObjects() throws Exception
}
@Test
- public void testAjax1() throws Exception {
+ void ajax1() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "ajax_1.xhtml");
@@ -49,12 +50,12 @@ public void testAjax1() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertFalse(response.contains("faces.util.chain"));
- Assertions.assertFalse(response.contains("myfaces.ab"));
+ assertFalse(response.contains("faces.util.chain"));
+ assertFalse(response.contains("myfaces.ab"));
}
-
+
@Test
- public void testAjax2() throws Exception {
+ void ajax2() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "ajax_2.xhtml");
@@ -65,12 +66,12 @@ public void testAjax2() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("myfaces.ab"));
- Assertions.assertEquals(countMatches(response, "myfaces.ab"), 1);
+ assertTrue(response.contains("myfaces.ab"));
+ assertEquals(1, countMatches(response, "myfaces.ab"));
}
-
+
@Test
- public void testAjax3() throws Exception {
+ void ajax3() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "ajax_3.xhtml");
@@ -81,12 +82,12 @@ public void testAjax3() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("myfaces.ab"));
- Assertions.assertEquals(countMatches(response, "myfaces.ab"), 1);
+ assertTrue(response.contains("myfaces.ab"));
+ assertEquals(1, countMatches(response, "myfaces.ab"));
}
-
+
@Test
- public void testAjax4() throws Exception {
+ void ajax4() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "ajax_4.xhtml");
@@ -97,13 +98,13 @@ public void testAjax4() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("myfaces.ab"));
- Assertions.assertEquals(countMatches(response, "faces.util.chain"), 1);
- Assertions.assertEquals(countMatches(response, "myfaces.ab"), 2);
+ assertTrue(response.contains("myfaces.ab"));
+ assertEquals(1, countMatches(response, "faces.util.chain"));
+ assertEquals(2, countMatches(response, "myfaces.ab"));
}
-
+
@Test
- public void testAjax5() throws Exception {
+ void ajax5() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "ajax_5.xhtml");
@@ -114,12 +115,12 @@ public void testAjax5() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertFalse(response.contains("myfaces.ab"));
- Assertions.assertFalse(response.contains("faces.util.chain"));
+ assertFalse(response.contains("myfaces.ab"));
+ assertFalse(response.contains("faces.util.chain"));
}
-
+
@Test
- public void testAjax6() throws Exception {
+ void ajax6() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "ajax_6.xhtml");
@@ -130,11 +131,11 @@ public void testAjax6() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("myfaces.ab"));
+ assertTrue(response.contains("myfaces.ab"));
}
-
+
@Test
- public void testAjax7() throws Exception {
+ void ajax7() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "ajax_7.xhtml");
@@ -145,10 +146,10 @@ public void testAjax7() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("myfaces.ab"));
- Assertions.assertTrue(response.contains("faces.util.chain"));
- Assertions.assertEquals(countMatches(response, "faces.util.chain"), 1);
- Assertions.assertEquals(countMatches(response, "myfaces.ab"), 2);
+ assertTrue(response.contains("myfaces.ab"));
+ assertTrue(response.contains("faces.util.chain"));
+ assertEquals(1, countMatches(response, "faces.util.chain"));
+ assertEquals(2, countMatches(response, "myfaces.ab"));
}
public int countMatches(String all, String search)
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlBodyClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlBodyClientBehaviorRendererTest.java
index 5848cf23bb..97a2e7c2ce 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlBodyClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlBodyClientBehaviorRendererTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkit.html.behavior;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.behavior.AjaxBehavior;
import jakarta.faces.component.behavior.ClientBehaviorHolder;
@@ -36,7 +38,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlBodyClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlBodyClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
@@ -82,7 +84,7 @@ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes(
* does not have "name", so we just need to check "id"
*/
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ public void clientBehaviorHolderRendersIdAndName()
{
HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
@@ -91,17 +93,12 @@ public void testClientBehaviorHolderRendersIdAndName()
UIComponent component = createComponentToTest();
ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
component.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertTrue(output.contains("id=\"j_id__"));
+ assertTrue(output.contains("id=\"j_id__"));
outputWriter.reset();
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ });
}
}
@@ -111,33 +108,28 @@ public void testClientBehaviorHolderRendersIdAndName()
* <h:body> therefore keeps working, and so do e.g. "unload", "pagehide" and "popstate".
*/
@Test
- public void testWindowEventsAreBehaviorEvents()
+ void windowEventsAreBehaviorEvents()
{
HtmlBody body = new HtmlBody();
- Assertions.assertTrue(body.getEventNames().contains(ClientBehaviorEvents.CLICK));
- Assertions.assertTrue(body.getEventNames().contains(ClientBehaviorEvents.LOAD));
- Assertions.assertTrue(body.getEventNames().contains(ClientBehaviorEvents.UNLOAD));
- Assertions.assertTrue(body.getEventNames().contains(HtmlEvents.HtmlWindowEvent.pagehide.name()));
- Assertions.assertTrue(body.getEventNames().contains(HtmlEvents.HtmlWindowEvent.popstate.name()));
+ assertTrue(body.getEventNames().contains(ClientBehaviorEvents.CLICK));
+ assertTrue(body.getEventNames().contains(ClientBehaviorEvents.LOAD));
+ assertTrue(body.getEventNames().contains(ClientBehaviorEvents.UNLOAD));
+ assertTrue(body.getEventNames().contains(HtmlEvents.HtmlWindowEvent.pagehide.name()));
+ assertTrue(body.getEventNames().contains(HtmlEvents.HtmlWindowEvent.popstate.name()));
// but not on any other component
HtmlPanelGroup group = new HtmlPanelGroup();
- Assertions.assertTrue(group.getEventNames().contains(ClientBehaviorEvents.LOAD));
- Assertions.assertFalse(group.getEventNames().contains(ClientBehaviorEvents.UNLOAD));
- Assertions.assertFalse(group.getEventNames().contains(HtmlEvents.HtmlWindowEvent.pagehide.name()));
+ assertTrue(group.getEventNames().contains(ClientBehaviorEvents.LOAD));
+ assertFalse(group.getEventNames().contains(ClientBehaviorEvents.UNLOAD));
+ assertFalse(group.getEventNames().contains(HtmlEvents.HtmlWindowEvent.pagehide.name()));
// still supported as a plain attribute
body.setOnload("alert('load')");
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
body.encodeAll(facesContext);
- Assertions.assertTrue(outputWriter.toString().contains(HTML.ONLOAD_ATTR + "=\"alert('load')\""));
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(outputWriter.toString().contains(HTML.ONLOAD_ATTR + "=\"alert('load')\""));
+ });
}
/**
@@ -145,43 +137,33 @@ public void testWindowEventsAreBehaviorEvents()
* second time.
*/
@Test
- public void testRendererHandledWindowEventIsRenderedOnce()
+ void rendererHandledWindowEventIsRenderedOnce()
{
HtmlBody body = new HtmlBody();
body.addClientBehavior(ClientBehaviorEvents.LOAD, new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
body.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertTrue(output.contains(HTML.ONLOAD_ATTR + "=\""), output);
- Assertions.assertEquals(output.indexOf(HTML.ONLOAD_ATTR + "=\""),
+ assertTrue(output.contains(HTML.ONLOAD_ATTR + "=\""), output);
+ assertEquals(output.indexOf(HTML.ONLOAD_ATTR + "=\""),
output.lastIndexOf(HTML.ONLOAD_ATTR + "=\""), output);
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ });
}
/**
* The window level events which the renderer does not handle itself are rendered generically.
*/
@Test
- public void testGenericWindowEventIsRendered()
+ void genericWindowEventIsRendered()
{
HtmlBody body = new HtmlBody();
body.addClientBehavior(HtmlEvents.HtmlWindowEvent.pagehide.name(), new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
body.encodeAll(facesContext);
- Assertions.assertTrue(outputWriter.toString().contains(" onpagehide=\""), outputWriter.toString());
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ assertTrue(outputWriter.toString().contains(" onpagehide=\""), outputWriter.toString());
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandButtonClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandButtonClientBehaviorRendererTest.java
index 27d23c727d..aaf967ecbc 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandButtonClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandButtonClientBehaviorRendererTest.java
@@ -32,7 +32,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlCommandButtonClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlCommandButtonClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandLinkClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandLinkClientBehaviorRendererTest.java
index 11ffb6f93b..df2fcf1ba9 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandLinkClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandLinkClientBehaviorRendererTest.java
@@ -33,7 +33,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlCommandLinkClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlCommandLinkClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlDataTableClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlDataTableClientBehaviorRendererTest.java
index 2693cb71cb..78567980cd 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlDataTableClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlDataTableClientBehaviorRendererTest.java
@@ -27,7 +27,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlDataTableClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlDataTableClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlFormClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlFormClientBehaviorRendererTest.java
index e1d7b342c1..27c72c894a 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlFormClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlFormClientBehaviorRendererTest.java
@@ -27,7 +27,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlFormClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlFormClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlGraphicImageClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlGraphicImageClientBehaviorRendererTest.java
index 29f1a988f3..e96604551b 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlGraphicImageClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlGraphicImageClientBehaviorRendererTest.java
@@ -27,7 +27,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlGraphicImageClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlGraphicImageClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetButtonClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetButtonClientBehaviorRendererTest.java
index b175d47c78..0b70ecb197 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetButtonClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetButtonClientBehaviorRendererTest.java
@@ -32,7 +32,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlOutcomeTargetButtonClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlOutcomeTargetButtonClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetLinkClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetLinkClientBehaviorRendererTest.java
index 5527502f47..6704a4a596 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetLinkClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetLinkClientBehaviorRendererTest.java
@@ -32,7 +32,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlOutcomeTargetLinkClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlOutcomeTargetLinkClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLabelClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLabelClientBehaviorRendererTest.java
index d2e0c13b2a..eabb75f5b7 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLabelClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLabelClientBehaviorRendererTest.java
@@ -31,7 +31,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlOutputLabelClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlOutputLabelClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLinkClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLinkClientBehaviorRendererTest.java
index 8021a96ea9..c10539724b 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLinkClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLinkClientBehaviorRendererTest.java
@@ -31,7 +31,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlOutputLinkClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlOutputLinkClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlPanelGridClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlPanelGridClientBehaviorRendererTest.java
index 17f704f096..439e026cb5 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlPanelGridClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlPanelGridClientBehaviorRendererTest.java
@@ -27,7 +27,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlPanelGridClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlPanelGridClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSecretClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSecretClientBehaviorRendererTest.java
index 0bdf28182b..43b702aee7 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSecretClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSecretClientBehaviorRendererTest.java
@@ -27,7 +27,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlSecretClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlSecretClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectBooleanCheckboxClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectBooleanCheckboxClientBehaviorRendererTest.java
index 8ad1b78431..4707752700 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectBooleanCheckboxClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectBooleanCheckboxClientBehaviorRendererTest.java
@@ -27,7 +27,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlSelectBooleanCheckboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlSelectBooleanCheckboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyCheckboxClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyCheckboxClientBehaviorRendererTest.java
index 0853bad14a..3b9dbc71ee 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyCheckboxClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyCheckboxClientBehaviorRendererTest.java
@@ -18,13 +18,14 @@
*/
package org.apache.myfaces.renderkit.html.behavior;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UISelectItem;
import jakarta.faces.component.behavior.AjaxBehavior;
import jakarta.faces.component.behavior.ClientBehaviorHolder;
import jakarta.faces.component.html.HtmlSelectManyCheckbox;
import org.junit.jupiter.api.AfterEach;
-
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -33,7 +34,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlSelectManyCheckboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlSelectManyCheckboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
@@ -71,7 +72,7 @@ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes(
}
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ public void clientBehaviorHolderRendersIdAndName()
{
HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
@@ -80,18 +81,13 @@ public void testClientBehaviorHolderRendersIdAndName()
UIComponent component = createComponentToTest();
ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
component.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertTrue(output.contains("id=\"j_id__"));
- Assertions.assertTrue(output.contains("name=\"j_id__"));
+ assertTrue(output.contains("id=\"j_id__"));
+ assertTrue(output.contains("name=\"j_id__"));
outputWriter.reset();
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ });
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyListboxClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyListboxClientBehaviorRendererTest.java
index 2fc469df37..6de67d4f92 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyListboxClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyListboxClientBehaviorRendererTest.java
@@ -28,7 +28,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlSelectManyListboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlSelectManyListboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyMenuClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyMenuClientBehaviorRendererTest.java
index b7277e19db..b87540aede 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyMenuClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyMenuClientBehaviorRendererTest.java
@@ -28,7 +28,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlSelectManyMenuClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlSelectManyMenuClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneListboxClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneListboxClientBehaviorRendererTest.java
index 458cfe61af..9f88695a14 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneListboxClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneListboxClientBehaviorRendererTest.java
@@ -28,7 +28,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlSelectOneListboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlSelectOneListboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneMenuClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneMenuClientBehaviorRendererTest.java
index 1a036e2e5e..54c2f586a7 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneMenuClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneMenuClientBehaviorRendererTest.java
@@ -28,7 +28,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlSelectOneMenuClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlSelectOneMenuClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneRadioClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneRadioClientBehaviorRendererTest.java
index 4412533444..9d2331c943 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneRadioClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneRadioClientBehaviorRendererTest.java
@@ -18,13 +18,14 @@
*/
package org.apache.myfaces.renderkit.html.behavior;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UISelectItem;
import jakarta.faces.component.behavior.AjaxBehavior;
import jakarta.faces.component.behavior.ClientBehaviorHolder;
import jakarta.faces.component.html.HtmlSelectOneRadio;
import org.junit.jupiter.api.AfterEach;
-
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -33,7 +34,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlSelectOneRadioClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlSelectOneRadioClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
@@ -71,7 +72,7 @@ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes(
}
@Test
- public void testClientBehaviorHolderRendersIdAndName()
+ public void clientBehaviorHolderRendersIdAndName()
{
HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
@@ -80,18 +81,13 @@ public void testClientBehaviorHolderRendersIdAndName()
UIComponent component = createComponentToTest();
ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
component.encodeAll(facesContext);
String output = outputWriter.toString();
- Assertions.assertTrue(output.contains("id=\"j_id__"));
- Assertions.assertTrue(output.contains("name=\"j_id__"));
+ assertTrue(output.contains("id=\"j_id__"));
+ assertTrue(output.contains("name=\"j_id__"));
outputWriter.reset();
- }
- catch (Exception e)
- {
- Assertions.fail(e.getMessage());
- }
+ });
}
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextClientBehaviorRendererTest.java
index d410ae343b..cfceda73a7 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextClientBehaviorRendererTest.java
@@ -27,7 +27,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlTextClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlTextClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextareaClientBehaviorRendererTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextareaClientBehaviorRendererTest.java
index 0eb76073af..d7c39b1f49 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextareaClientBehaviorRendererTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextareaClientBehaviorRendererTest.java
@@ -27,7 +27,7 @@
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class HtmlTextareaClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+class HtmlTextareaClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
{
private HtmlRenderedClientEventAttr[] attrs = null;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/util/AjaxScriptBuilderTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/util/AjaxScriptBuilderTest.java
index 991b62d0f7..787de35e42 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/util/AjaxScriptBuilderTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/util/AjaxScriptBuilderTest.java
@@ -22,15 +22,17 @@
import org.apache.myfaces.component.search.*;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.apache.myfaces.test.mock.MockApplication;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
+
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.Arrays;
import java.util.List;
-public class AjaxScriptBuilderTest extends AbstractFacesTestCase
+class AjaxScriptBuilderTest extends AbstractFacesTestCase
{
@BeforeEach
@Override
@@ -61,7 +63,7 @@ public void setUp() throws Exception
}
@Test
- public void test()
+ void test()
{
UIComponentMock component = new UIComponentMock();
component.setId("test");
@@ -86,8 +88,8 @@ public void test()
String script = sb.toString();
- Assertions.assertFalse(script.contains("':testJsparams:{"));
- Assertions.assertTrue(script.contains("':testJs,'params':{"));
- Assertions.assertEquals("myfaces.ab('j_id_i',event,'click','test','',{'onevent':testJs,'params':{'var1':'NEW VALUE'}})", script);
+ assertFalse(script.contains("':testJsparams:{"));
+ assertTrue(script.contains("':testJs,'params':{"));
+ assertEquals("myfaces.ab('j_id_i',event,'click','test','',{'onevent':testJs,'params':{'var1':'NEW VALUE'}})", script);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/util/HTMLEncoderTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/util/HTMLEncoderTest.java
index 330fdbd8eb..191fce896c 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/util/HTMLEncoderTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/util/HTMLEncoderTest.java
@@ -16,18 +16,21 @@
package org.apache.myfaces.renderkit.html.util;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.CharArrayWriter;
-import java.io.IOException;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.apache.myfaces.test.mock.MockFacesContext;
+
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* HTMLEncoderTest tests org.apache.myfaces.shared.renderkit.html.util.HTMLEncoder.
*/
-public class HTMLEncoderTest extends AbstractFacesTestCase {
+class HTMLEncoderTest extends AbstractFacesTestCase {
private String stringNoSpecialChars = "Hello, this is MyFaces speaking!";
private String stringNoSpecialCharsEncoded = "Hello, this is MyFaces speaking!";
private String stringNoSpecialCharsEncodedPartial = "lo, this is MyFaces speakin";
@@ -42,218 +45,192 @@ public class HTMLEncoderTest extends AbstractFacesTestCase {
private String stringBlanks = "";
private String stringBlanksEncoded = "<Hello this is MyFaces speaking!>";
- /**
- * Test method for
- * {@link org.apache.myfaces.shared.renderkit.html.util.HTMLEncoder#encode(String)}.
- */
- @Test
- public void testEncodeStringNoSpecialChars() {
+ /**
+ * Test method for
+ * {@link org.apache.myfaces.shared.renderkit.html.util.HTMLEncoder#encode(String)}.
+ */
+ @Test
+ void encodeStringNoSpecialChars() {
String encodedStr = HTMLEncoder.encode(new MockFacesContext(), stringNoSpecialChars);
- Assertions.assertEquals(stringNoSpecialCharsEncoded, encodedStr);
+ assertEquals(stringNoSpecialCharsEncoded, encodedStr);
}
- @Test
- public void testEncodeStringSpecialChars1() {
+ @Test
+ void encodeStringSpecialChars1() {
String encodedStr = HTMLEncoder.encode(new MockFacesContext(), stringSpecialChars1);
- Assertions.assertEquals(stringSpecialChars1Encoded, encodedStr);
+ assertEquals(stringSpecialChars1Encoded, encodedStr);
}
- @Test
- public void testEncodeStringSpecialChars2() {
+ @Test
+ void encodeStringSpecialChars2() {
String encodedStr = HTMLEncoder.encode(new MockFacesContext(), stringSpecialChars2);
- Assertions.assertEquals(stringSpecialChars2Encoded, encodedStr);
+ assertEquals(stringSpecialChars2Encoded, encodedStr);
}
- @Test
- public void testEncodeStringLineBreak1() {
+ @Test
+ void encodeStringLineBreak1() {
String encodedStr = HTMLEncoder.encode(new MockFacesContext(), stringLineBreak, true);
- Assertions.assertEquals(stringLineBreakEncoded1, encodedStr);
+ assertEquals(stringLineBreakEncoded1, encodedStr);
}
- @Test
- public void testEncodeStringLineBreak2() {
+ @Test
+ void encodeStringLineBreak2() {
String encodedStr = HTMLEncoder.encode(new MockFacesContext(), stringLineBreak, false);
- Assertions.assertEquals(stringLineBreakEncoded2, encodedStr);
+ assertEquals(stringLineBreakEncoded2, encodedStr);
}
- @Test
- public void testEncodeStringEmpty() {
+ @Test
+ void encodeStringEmpty() {
String encodedStr = HTMLEncoder.encode(new MockFacesContext(), "");
- Assertions.assertEquals("", encodedStr);
+ assertEquals("", encodedStr);
}
- @Test
- public void testEncodeStringNull() {
+ @Test
+ void encodeStringNull() {
String encodedStr = HTMLEncoder.encode(new MockFacesContext(), null);
- Assertions.assertEquals("", encodedStr);
+ assertEquals("", encodedStr);
}
- @Test
- public void testEncodeArrayNoSpecialChars() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- char[] source = stringNoSpecialChars.toCharArray();
- HTMLEncoder.encode(source, 0, source.length, writer);
- assertCharArrayEquals(stringNoSpecialCharsEncoded.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArrayNoSpecialChars() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ char[] source = stringNoSpecialChars.toCharArray();
+ HTMLEncoder.encode(source, 0, source.length, writer);
+ assertCharArrayEquals(stringNoSpecialCharsEncoded.toCharArray(), writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArrayNoSpecialCharsPartial() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- char[] source = stringNoSpecialChars.toCharArray();
- HTMLEncoder.encode(source, 3, source.length - 5, writer);
- assertCharArrayEquals(stringNoSpecialCharsEncodedPartial.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArrayNoSpecialCharsPartial() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ char[] source = stringNoSpecialChars.toCharArray();
+ HTMLEncoder.encode(source, 3, source.length - 5, writer);
+ assertCharArrayEquals(stringNoSpecialCharsEncodedPartial.toCharArray(), writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArraySpecialChars1() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- char[] source = stringSpecialChars1.toCharArray();
- HTMLEncoder.encode(source, 0, source.length, writer);
- assertCharArrayEquals(stringSpecialChars1Encoded.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArraySpecialChars1() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ char[] source = stringSpecialChars1.toCharArray();
+ HTMLEncoder.encode(source, 0, source.length, writer);
+ assertCharArrayEquals(stringSpecialChars1Encoded.toCharArray(), writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArraySpecialChars2() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- char[] source = stringSpecialChars2.toCharArray();
- HTMLEncoder.encode(source, 0, source.length, writer);
- assertCharArrayEquals(stringSpecialChars2Encoded.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArraySpecialChars2() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ char[] source = stringSpecialChars2.toCharArray();
+ HTMLEncoder.encode(source, 0, source.length, writer);
+ assertCharArrayEquals(stringSpecialChars2Encoded.toCharArray(), writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArrayEmpty() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- HTMLEncoder.encode(new char[]{}, 0, 1, writer);
- assertCharArrayEquals(new char[]{}, writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArrayEmpty() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ HTMLEncoder.encode(new char[]{}, 0, 1, writer);
+ assertCharArrayEquals(new char[]{}, writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArrayNull() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- HTMLEncoder.encode(null, 0, 0, writer);
- assertCharArrayEquals(new char[]{}, writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArrayNull() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ HTMLEncoder.encode(null, 0, 0, writer);
+ assertCharArrayEquals(new char[]{}, writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArrayWrongIndex1() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- char[] source = stringSpecialChars2.toCharArray();
- HTMLEncoder.encode(source, 0, source.length - 100, writer);
- assertCharArrayEquals(new char[]{}, writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArrayWrongIndex1() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ char[] source = stringSpecialChars2.toCharArray();
+ HTMLEncoder.encode(source, 0, source.length - 100, writer);
+ assertCharArrayEquals(new char[]{}, writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArrayWrongIndex2() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- char[] source = stringSpecialChars2.toCharArray();
- HTMLEncoder.encode(source, -100, source.length, writer);
- assertCharArrayEquals(stringSpecialChars2Encoded.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArrayWrongIndex2() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ char[] source = stringSpecialChars2.toCharArray();
+ HTMLEncoder.encode(source, -100, source.length, writer);
+ assertCharArrayEquals(stringSpecialChars2Encoded.toCharArray(), writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArrayWrongIndex3() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- char[] source = stringSpecialChars2.toCharArray();
- HTMLEncoder.encode(source, 100000, source.length, writer);
- assertCharArrayEquals(new char[]{}, writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArrayWrongIndex3() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ char[] source = stringSpecialChars2.toCharArray();
+ HTMLEncoder.encode(source, 100000, source.length, writer);
+ assertCharArrayEquals(new char[]{}, writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArrayLineBreak1() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- char[] source = stringLineBreak.toCharArray();
- HTMLEncoder.encode(source, 0, source.length, true, writer);
- assertCharArrayEquals(stringLineBreakEncoded1.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArrayLineBreak1() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ char[] source = stringLineBreak.toCharArray();
+ HTMLEncoder.encode(source, 0, source.length, true, writer);
+ assertCharArrayEquals(stringLineBreakEncoded1.toCharArray(), writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArrayLineBreak2() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- char[] source = stringLineBreak.toCharArray();
- HTMLEncoder.encode(source, 0, source.length, false, writer);
- assertCharArrayEquals(stringLineBreakEncoded2.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArrayLineBreak2() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ char[] source = stringLineBreak.toCharArray();
+ HTMLEncoder.encode(source, 0, source.length, false, writer);
+ assertCharArrayEquals(stringLineBreakEncoded2.toCharArray(), writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArrayLineBreak2WrongIndex() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- char[] source = stringLineBreak.toCharArray();
- HTMLEncoder.encode(source, 0, source.length + 5, false, writer);
- assertCharArrayEquals(stringLineBreakEncoded2.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArrayLineBreak2WrongIndex() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ char[] source = stringLineBreak.toCharArray();
+ HTMLEncoder.encode(source, 0, source.length + 5, false, writer);
+ assertCharArrayEquals(stringLineBreakEncoded2.toCharArray(), writer.toCharArray());
+ });
}
- @Test
- public void testEncodeArrayLineBreakPartial() {
- try {
- CharArrayWriter writer = new CharArrayWriter();
- char[] source = stringLineBreak.toCharArray();
- HTMLEncoder.encode(source, 4, source.length - 5, writer);
- char[] expected = stringLineBreakEncoded2Partial.toCharArray();
- assertCharArrayEquals(expected, writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ @Test
+ void encodeArrayLineBreakPartial() {
+ Assertions.assertDoesNotThrow(() -> {
+ CharArrayWriter writer = new CharArrayWriter();
+ char[] source = stringLineBreak.toCharArray();
+ HTMLEncoder.encode(source, 4, source.length - 5, writer);
+ char[] expected = stringLineBreakEncoded2Partial.toCharArray();
+ assertCharArrayEquals(expected, writer.toCharArray());
+ });
}
- @Test
- public void testSimpleWriteURIAttribute() throws Exception
+ @Test
+ void simpleWriteURIAttribute() throws Exception
{
String cad1 = "http://myfaces.apache.org/hello.jsf?key1=val&key2=val2#id";
String cad2 = "http://myfaces.apache.org/hello.jsf?key1=val&key2=val2#id";
String cad3 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad1, "UTF-8");
- Assertions.assertEquals(cad2, cad3);
+ assertEquals(cad2, cad3);
}
-
- @Test
- public void testUsAsciiEscapedCharactersBeforeQuery() throws Exception
+
+ @Test
+ void usAsciiEscapedCharactersBeforeQuery() throws Exception
{
// Escape
// - From %00 to %20,
@@ -265,18 +242,18 @@ public void testUsAsciiEscapedCharactersBeforeQuery() throws Exception
String cad1 = "?key=\"%<>\\`{|}^\n "; //Omit %
String cad2 = "?key=%22%25%3C%3E%5C%60%7B%7C%7D%5E%0A%20";
String cad3 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad1,"UTF-8");
- Assertions.assertEquals(cad2, cad3);
+ assertEquals(cad2, cad3);
String cad4 = "\"%<>\\`{|}^\n ";
String cad5 = "%22%25%3C%3E%5C%60%7B%7C%7D%5E%0A%20";
String cad6 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad4,"UTF-8");
- Assertions.assertEquals(cad5, cad6);
+ assertEquals(cad5, cad6);
}
-
- @Test
- public void testUsAsciiEscapedCharactersBeforeQueryLowerCase() throws Exception
+
+ @Test
+ void usAsciiEscapedCharactersBeforeQueryLowerCase() throws Exception
{
// Escape
// - From %00 to %20,
@@ -288,17 +265,17 @@ public void testUsAsciiEscapedCharactersBeforeQueryLowerCase() throws Exception
String cad1 = "?key=\"%<>\\`{|}^\n "; //Omit %
String cad2 = "?key=%22%25%3c%3e%5c%60%7b%7c%7d%5e%0a%20";
String cad3 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad1,"UTF-8");
- Assertions.assertEquals(cad2.substring(0,5) + cad2.substring(5).toUpperCase(), cad3);
+ assertEquals(cad2.substring(0,5) + cad2.substring(5).toUpperCase(), cad3);
String cad4 = "\"%<>\\`{|}^\n ";
String cad5 = "%22%25%3c%3e%5c%60%7b%7c%7d%5e%0a%20";
String cad6 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad4,"UTF-8");
- Assertions.assertEquals(cad5.substring(0,5) + cad5.substring(5).toUpperCase(), cad6);
+ assertEquals(cad5.substring(0,5) + cad5.substring(5).toUpperCase(), cad6);
- }
-
- @Test
- public void testWriteNonUsAsciiOnURIAttribute() throws Exception
+ }
+
+ @Test
+ void writeNonUsAsciiOnURIAttribute() throws Exception
{
// Character ü in ISO-8859-1 is %FC but on UTF-8 is %C3%BC. In this case,
// it should encode as %C3%BC
@@ -306,12 +283,12 @@ public void testWriteNonUsAsciiOnURIAttribute() throws Exception
String cad1 = new String(array,"ISO-8859-1");//+(char)0xC3BC;//"http://myfaces.apache.org/heüll o.jsf?key=val#id";
String cad2 = "%C3%BC";//"http://myfaces.apache.org/he%FCll%20o.jsf?key=val#id";
String cad3 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad1,"UTF-8");
- Assertions.assertEquals(cad2, cad3);
+ assertEquals(cad2, cad3);
}
-
- @Test
- public void testReservedCharactersOnURIAttribute() throws Exception
+
+ @Test
+ void reservedCharactersOnURIAttribute() throws Exception
{
//Reserved
// Reserved characters (should not be percent-encoded)
@@ -323,15 +300,15 @@ public void testReservedCharactersOnURIAttribute() throws Exception
String cad1 = "?key=:/[]@!$'()*+,;="; //Omit &
String cad2 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad1,"UTF-8");
- Assertions.assertEquals(cad1, cad2);
+ assertEquals(cad1, cad2);
String cad7 = ":/[]@!$&'()*+,;=";
String cad8 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad7,"UTF-8");
- Assertions.assertEquals(cad7, cad8);
+ assertEquals(cad7, cad8);
}
- @Test
- public void testNonEncodedCharactersOnURIAttribute() throws Exception
+ @Test
+ void nonEncodedCharactersOnURIAttribute() throws Exception
{
// "... for consistency, percent-encoded octets in the ranges of ALPHA
// (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E),
@@ -339,19 +316,19 @@ public void testNonEncodedCharactersOnURIAttribute() throws Exception
// producers...."
String cad1 = "?key=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
String cad2 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad1,"UTF-8");
- Assertions.assertEquals(cad1, cad2);
+ assertEquals(cad1, cad2);
String cad3 = "#somefile?key=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
String cad4 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad3,"UTF-8");
- Assertions.assertEquals(cad3, cad4);
+ assertEquals(cad3, cad4);
String cad5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
String cad6 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad5,"UTF-8");
- Assertions.assertEquals(cad5, cad6);
+ assertEquals(cad5, cad6);
}
- @Test
- public void testWriteURIAttribute() throws Exception
+ @Test
+ void writeURIAttribute() throws Exception
{
//Note char 256 or 0x100 should not be passed or percent encoded, because it is not
//valid for URIs.
@@ -366,13 +343,13 @@ public void testWriteURIAttribute() throws Exception
String cad12 = "%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD"+
"%C2%AE%C2%AF%C2%B0%C2%B1%C3%BF%C4%80";
String cad13 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad11,"UTF-8");
- Assertions.assertEquals(cad12, cad13);
+ assertEquals(cad12, cad13);
String cad1= "?key=" + new String(array11,"UTF-8")+((char)(0xFF))+((char)(0x100));
String cad2 = "?key=%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD"+
"%C2%AE%C2%AF%C2%B0%C2%B1%C3%BF%C4%80";
String cad3 = HTMLEncoder.encodeURIAttribute(new MockFacesContext(), cad1,"UTF-8");
- Assertions.assertEquals(cad2, cad3);
+ assertEquals(cad2, cad3);
//String cad14 = "http://myfaces.apache.org/page.jsf?key="+((char)0xFF)+((char)0x100);
//String cad15 = HTMLEncoder.encodeURIAttribute(cad14,false);
@@ -381,10 +358,10 @@ public void testWriteURIAttribute() throws Exception
private void assertCharArrayEquals(char[] expected, char[] actual) {
if ((expected == null ^ actual == null) || expected.length != actual.length) {
- Assertions.fail();
+ fail();
}
for (int i = 0; i < expected.length; i++) {
- Assertions.assertEquals(expected[i], actual[i]);
+ assertEquals(expected[i], actual[i]);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/util/HTMLEncoderWriterTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/util/HTMLEncoderWriterTest.java
index 879e8f2a45..6c82ced632 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/util/HTMLEncoderWriterTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/util/HTMLEncoderWriterTest.java
@@ -15,8 +15,10 @@
*/
package org.apache.myfaces.renderkit.html.util;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.CharArrayWriter;
-import java.io.IOException;
import java.io.StringWriter;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
@@ -29,7 +31,7 @@
* HTMLEncoderTest tests
* org.apache.myfaces.shared.renderkit.html.util.HTMLEncoder.
*/
-public class HTMLEncoderWriterTest extends AbstractFacesTestCase {
+class HTMLEncoderWriterTest extends AbstractFacesTestCase {
private String stringNoSpecialChars = "Hello, this is MyFaces speaking!";
private String stringNoSpecialCharsEncoded = "Hello, this is MyFaces speaking!";
@@ -66,213 +68,187 @@ public void tearDown() throws Exception {
* {@link org.apache.myfaces.shared.renderkit.html.util.HTMLEncoder#encode(String)}.
*/
@Test
- public void testEncodeStringNoSpecialChars() throws Exception {
+ void encodeStringNoSpecialChars() throws Exception {
HTMLEncoder.encode(sw, stringNoSpecialChars);
- Assertions.assertEquals(stringNoSpecialCharsEncoded, sw.toString());
+ assertEquals(stringNoSpecialCharsEncoded, sw.toString());
}
@Test
- public void testEncodeStringSpecialChars1() throws Exception {
+ void encodeStringSpecialChars1() throws Exception {
HTMLEncoder.encode(sw, stringSpecialChars1);
- Assertions.assertEquals(stringSpecialChars1Encoded, sw.toString());
+ assertEquals(stringSpecialChars1Encoded, sw.toString());
}
@Test
- public void testEncodeStringSpecialChars2() throws Exception {
+ void encodeStringSpecialChars2() throws Exception {
HTMLEncoder.encode(sw, stringSpecialChars2);
- Assertions.assertEquals(stringSpecialChars2Encoded, sw.toString());
+ assertEquals(stringSpecialChars2Encoded, sw.toString());
}
@Test
- public void testEncodeStringLineBreak1() throws Exception {
+ void encodeStringLineBreak1() throws Exception {
HTMLEncoder.encode(sw, stringLineBreak, true);
- Assertions.assertEquals(stringLineBreakEncoded1, sw.toString());
+ assertEquals(stringLineBreakEncoded1, sw.toString());
}
@Test
- public void testEncodeStringLineBreak2() throws Exception {
+ void encodeStringLineBreak2() throws Exception {
HTMLEncoder.encode(sw, stringLineBreak, false);
- Assertions.assertEquals(stringLineBreakEncoded2, sw.toString());
+ assertEquals(stringLineBreakEncoded2, sw.toString());
}
@Test
- public void testEncodeStringEmpty() throws Exception {
+ void encodeStringEmpty() throws Exception {
HTMLEncoder.encode(sw, "");
- Assertions.assertEquals("", sw.toString());
+ assertEquals("", sw.toString());
}
@Test
- public void testEncodeStringNull() throws Exception {
+ void encodeStringNull() throws Exception {
HTMLEncoder.encode(sw, null);
- Assertions.assertEquals("", sw.toString());
+ assertEquals("", sw.toString());
}
@Test
- public void testEncodeArrayNoSpecialChars() throws Exception {
- try {
+ void encodeArrayNoSpecialChars() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
char[] source = stringNoSpecialChars.toCharArray();
HTMLEncoder.encode(source, 0, source.length, writer);
assertCharArrayEquals(stringNoSpecialCharsEncoded.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArrayNoSpecialCharsPartial() throws Exception {
- try {
+ void encodeArrayNoSpecialCharsPartial() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
char[] source = stringNoSpecialChars.toCharArray();
HTMLEncoder.encode(source, 3, source.length - 5, writer);
assertCharArrayEquals(stringNoSpecialCharsEncodedPartial.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArraySpecialChars1() throws Exception {
- try {
+ void encodeArraySpecialChars1() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
char[] source = stringSpecialChars1.toCharArray();
HTMLEncoder.encode(source, 0, source.length, writer);
assertCharArrayEquals(stringSpecialChars1Encoded.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArraySpecialChars2() throws Exception {
- try {
+ void encodeArraySpecialChars2() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
char[] source = stringSpecialChars2.toCharArray();
HTMLEncoder.encode(source, 0, source.length, writer);
assertCharArrayEquals(stringSpecialChars2Encoded.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArrayEmpty() throws Exception {
- try {
+ void encodeArrayEmpty() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
HTMLEncoder.encode(new char[]{}, 0, 1, writer);
assertCharArrayEquals(new char[]{}, writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArrayNull() throws Exception {
- try {
+ void encodeArrayNull() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
HTMLEncoder.encode(null, 0, 0, writer);
assertCharArrayEquals(new char[]{}, writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArrayWrongIndex1() throws Exception {
- try {
+ void encodeArrayWrongIndex1() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
char[] source = stringSpecialChars2.toCharArray();
HTMLEncoder.encode(source, 0, source.length - 100, writer);
assertCharArrayEquals(new char[]{}, writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArrayWrongIndex2() throws Exception {
- try {
+ void encodeArrayWrongIndex2() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
char[] source = stringSpecialChars2.toCharArray();
HTMLEncoder.encode(source, -100, source.length, writer);
assertCharArrayEquals(stringSpecialChars2Encoded.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArrayWrongIndex3() throws Exception {
- try {
+ void encodeArrayWrongIndex3() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
char[] source = stringSpecialChars2.toCharArray();
HTMLEncoder.encode(source, 100000, source.length, writer);
assertCharArrayEquals(new char[]{}, writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArrayLineBreak1() throws Exception {
- try {
+ void encodeArrayLineBreak1() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
char[] source = stringLineBreak.toCharArray();
HTMLEncoder.encode(source, 0, source.length, true, writer);
assertCharArrayEquals(stringLineBreakEncoded1.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArrayLineBreak2() throws Exception {
- try {
+ void encodeArrayLineBreak2() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
char[] source = stringLineBreak.toCharArray();
HTMLEncoder.encode(source, 0, source.length, false, writer);
assertCharArrayEquals(stringLineBreakEncoded2.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArrayLineBreak2WrongIndex() throws Exception {
- try {
+ void encodeArrayLineBreak2WrongIndex() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
char[] source = stringLineBreak.toCharArray();
HTMLEncoder.encode(source, 0, source.length + 5, false, writer);
assertCharArrayEquals(stringLineBreakEncoded2.toCharArray(), writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testEncodeArrayLineBreakPartial() throws Exception {
- try {
+ void encodeArrayLineBreakPartial() throws Exception {
+ Assertions.assertDoesNotThrow(() -> {
CharArrayWriter writer = new CharArrayWriter();
char[] source = stringLineBreak.toCharArray();
HTMLEncoder.encode(source, 4, source.length - 5, writer);
char[] expected = stringLineBreakEncoded2Partial.toCharArray();
assertCharArrayEquals(expected, writer.toCharArray());
- } catch (IOException e) {
- Assertions.fail(e.getMessage());
- }
+ });
}
@Test
- public void testSimpleWriteURIAttribute() throws Exception {
+ void simpleWriteURIAttribute() throws Exception {
String cad1 = "http://myfaces.apache.org/hello.jsf?key1=val&key2=val2#id";
String cad2 = "http://myfaces.apache.org/hello.jsf?key1=val&key2=val2#id";
HTMLEncoder.encodeURIAttribute(sw, cad1, "UTF-8");
String cad3 = sw.toString();
- Assertions.assertEquals(cad2, cad3);
+ assertEquals(cad2, cad3);
}
@Test
- public void testUsAsciiEscapedCharactersBeforeQuery() throws Exception {
+ void usAsciiEscapedCharactersBeforeQuery() throws Exception {
// Escape
// - From %00 to %20,
// - <"> %22, "%" %25
@@ -284,19 +260,19 @@ public void testUsAsciiEscapedCharactersBeforeQuery() throws Exception {
String cad2 = "?key=%22%25%3C%3E%5C%60%7B%7C%7D%5E%0A%20";
HTMLEncoder.encodeURIAttribute(sw, cad1, "UTF-8");
String cad3 = sw.toString();
- Assertions.assertEquals(cad2, cad3);
+ assertEquals(cad2, cad3);
String cad4 = "\"%<>\\`{|}^\n ";
String cad5 = "%22%25%3C%3E%5C%60%7B%7C%7D%5E%0A%20";
sw = new StringWriter();
HTMLEncoder.encodeURIAttribute(sw, cad4, "UTF-8");
String cad6 = sw.toString();
- Assertions.assertEquals(cad5, cad6);
+ assertEquals(cad5, cad6);
}
@Test
- public void testWriteNonUsAsciiOnURIAttribute() throws Exception {
+ void writeNonUsAsciiOnURIAttribute() throws Exception {
// Character ü in ISO-8859-1 is %FC but on UTF-8 is %C3%BC. In this case,
// it should encode as %C3%BC
byte[] array = new byte[]{(byte) 0xFC};
@@ -304,12 +280,12 @@ public void testWriteNonUsAsciiOnURIAttribute() throws Exception {
String cad2 = "%C3%BC";//"http://myfaces.apache.org/he%FCll%20o.jsf?key=val#id";
HTMLEncoder.encodeURIAttribute(sw, cad1, "UTF-8");
String cad3 = sw.toString();
- Assertions.assertEquals(cad2, cad3);
+ assertEquals(cad2, cad3);
}
@Test
- public void testReservedCharactersOnURIAttribute() throws Exception {
+ void reservedCharactersOnURIAttribute() throws Exception {
//Reserved
// Reserved characters (should not be percent-encoded)
// reserved = gen-delims / sub-delims
@@ -321,17 +297,17 @@ public void testReservedCharactersOnURIAttribute() throws Exception {
String cad1 = "?key=:/[]@!$'()*+,;="; //Omit &
HTMLEncoder.encodeURIAttribute(sw, cad1, "UTF-8");
String cad2 = sw.toString();
- Assertions.assertEquals(cad1, cad2);
+ assertEquals(cad1, cad2);
String cad7 = ":/[]@!$&'()*+,;=";
sw = new StringWriter(40);
HTMLEncoder.encodeURIAttribute(sw, cad7, "UTF-8");
String cad8 = sw.toString();
- Assertions.assertEquals(cad7, cad8);
+ assertEquals(cad7, cad8);
}
@Test
- public void testNonEncodedCharactersOnURIAttribute() throws Exception {
+ void nonEncodedCharactersOnURIAttribute() throws Exception {
// "... for consistency, percent-encoded octets in the ranges of ALPHA
// (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E),
// underscore (%5F), or tilde (%7E) should not be created by URI
@@ -339,23 +315,23 @@ public void testNonEncodedCharactersOnURIAttribute() throws Exception {
String cad1 = "?key=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
HTMLEncoder.encodeURIAttribute(sw, cad1, "UTF-8");
String cad2 = sw.toString();
- Assertions.assertEquals(cad1, cad2);
+ assertEquals(cad1, cad2);
String cad3 = "#somefile?key=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
sw = new StringWriter(40);
HTMLEncoder.encodeURIAttribute(sw, cad3, "UTF-8");
String cad4 = sw.toString();
- Assertions.assertEquals(cad3, cad4);
+ assertEquals(cad3, cad4);
String cad5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
sw = new StringWriter(40);
HTMLEncoder.encodeURIAttribute(sw, cad5, "UTF-8");
String cad6 = sw.toString();
- Assertions.assertEquals(cad5, cad6);
+ assertEquals(cad5, cad6);
}
@Test
- public void testWriteURIAttribute() throws Exception {
+ void writeURIAttribute() throws Exception {
//Note char 256 or 0x100 should not be passed or percent encoded, because it is not
//valid for URIs.
byte[] array11 = new byte[]{(byte) 0xC2, (byte) 0xA1, (byte) 0xC2, (byte) 0xA2,
@@ -370,7 +346,7 @@ public void testWriteURIAttribute() throws Exception {
+ "%C2%AE%C2%AF%C2%B0%C2%B1%C3%BF%C4%80";
HTMLEncoder.encodeURIAttribute(sw, cad11, "UTF-8");
String cad13 = sw.toString();
- Assertions.assertEquals(cad12, cad13);
+ assertEquals(cad12, cad13);
String cad1 = "?key=" + new String(array11, "UTF-8") + ((char) (0xFF)) + ((char) (0x100));
String cad2 = "?key=%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD"
@@ -378,7 +354,7 @@ public void testWriteURIAttribute() throws Exception {
sw = new StringWriter(40);
HTMLEncoder.encodeURIAttribute(sw, cad1, "UTF-8");
String cad3 = sw.toString();
- Assertions.assertEquals(cad2, cad3);
+ assertEquals(cad2, cad3);
//String cad14 = "http://myfaces.apache.org/page.jsf?key="+((char)0xFF)+((char)0x100);
//String cad15 = HTMLEncoder.encodeURIAttribute(cad14,false);
@@ -387,10 +363,10 @@ public void testWriteURIAttribute() throws Exception {
private void assertCharArrayEquals(char[] expected, char[] actual) {
if ((expected == null ^ actual == null) || expected.length != actual.length) {
- Assertions.fail();
+ fail();
}
for (int i = 0; i < expected.length; i++) {
- Assertions.assertEquals(expected[i], actual[i]);
+ assertEquals(expected[i], actual[i]);
}
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/util/JavascriptUtilsTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/util/JavascriptUtilsTest.java
index a4ea3f8a99..6eb080ba68 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/util/JavascriptUtilsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/util/JavascriptUtilsTest.java
@@ -18,65 +18,66 @@
*/
package org.apache.myfaces.renderkit.html.util;
-import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import org.junit.jupiter.api.Test;
-public class JavascriptUtilsTest
+class JavascriptUtilsTest
{
@Test
- public void testGetValidJavascriptNameTest_SimpleIdentifierUnchanged()
+ void getValidJavascriptNameTestSimpleIdentifierUnchanged()
{
- Assertions.assertEquals("fooBar123",
+ assertEquals("fooBar123",
JavascriptUtils.getValidJavascriptName("fooBar123", false));
- Assertions.assertEquals("fooBar123",
+ assertEquals("fooBar123",
JavascriptUtils.getValidJavascriptName("fooBar123", true, false));
}
@Test
- public void testGetValidJavascriptNameTest_ReservedWordAppendsUnderscoreWhenChecking()
+ void getValidJavascriptNameTestReservedWordAppendsUnderscoreWhenChecking()
{
- Assertions.assertEquals("var_",
+ assertEquals("var_",
JavascriptUtils.getValidJavascriptName("var", true));
- Assertions.assertEquals("var_",
+ assertEquals("var_",
JavascriptUtils.getValidJavascriptName("var", true, true));
}
@Test
- public void testGetValidJavascriptNameTest_ReservedWordUnchangedWhenNotChecking()
+ void getValidJavascriptNameTestReservedWordUnchangedWhenNotChecking()
{
- Assertions.assertEquals("var",
+ assertEquals("var",
JavascriptUtils.getValidJavascriptName("var", false));
}
@Test
- public void testGetValidJavascriptNameTest_InvalidCharactersBecomeUnderscorePlusHex()
+ void getValidJavascriptNameTestInvalidCharactersBecomeUnderscorePlusHex()
{
- Assertions.assertEquals("a_2Db",
+ assertEquals("a_2Db",
JavascriptUtils.getValidJavascriptName("a-b", false));
- Assertions.assertEquals("x_2Ey",
+ assertEquals("x_2Ey",
JavascriptUtils.getValidJavascriptName("x.y", false));
}
@Test
- public void testGetValidJavascriptNameTest_AllowNamespacesSplitsSegments()
+ void getValidJavascriptNameTestAllowNamespacesSplitsSegments()
{
- Assertions.assertEquals("a.b",
+ assertEquals("a.b",
JavascriptUtils.getValidJavascriptName("a.b", true, false));
- Assertions.assertEquals("a_3Ab.c",
+ assertEquals("a_3Ab.c",
JavascriptUtils.getValidJavascriptName("a:b.c", true, false));
}
@Test
- public void testGetValidJavascriptNameTest_AllowNamespacesFalseTreatsDotsAsInvalid()
+ void getValidJavascriptNameTestAllowNamespacesFalseTreatsDotsAsInvalid()
{
- Assertions.assertEquals("a_2Eb",
+ assertEquals("a_2Eb",
JavascriptUtils.getValidJavascriptName("a.b", false, false));
}
@Test
- public void testGetValidJavascriptNameTest_EmptyString()
+ void getValidJavascriptNameTestEmptyString()
{
- Assertions.assertEquals("",
+ assertEquals("",
JavascriptUtils.getValidJavascriptName("", false));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/html/util/UnicodeEncoderTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/html/util/UnicodeEncoderTest.java
index ab313716d9..045cfa3620 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/html/util/UnicodeEncoderTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/html/util/UnicodeEncoderTest.java
@@ -15,44 +15,45 @@
*/
package org.apache.myfaces.renderkit.html.util;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.io.StringWriter;
-import org.junit.jupiter.api.Assertions;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.junit.jupiter.api.Test;
-public class UnicodeEncoderTest extends AbstractFacesTestCase
+class UnicodeEncoderTest extends AbstractFacesTestCase
{
@Test
- public void testUnicodeEncoder1() throws Exception
+ void unicodeEncoder1() throws Exception
{
StringWriter sw = new StringWriter(40);
UnicodeEncoder.encode(sw, ""+(char)0xE1);
- Assertions.assertEquals(UnicodeEncoder.encode(""+(char)0xE1), sw.toString());
+ assertEquals(UnicodeEncoder.encode(""+(char)0xE1), sw.toString());
}
-
+
@Test
- public void testUnicodeEncoder2() throws Exception
+ void unicodeEncoder2() throws Exception
{
StringWriter sw = new StringWriter(40);
UnicodeEncoder.encode(sw, "h"+(char)0xE1);
- Assertions.assertEquals(UnicodeEncoder.encode("h"+(char)0xE1), sw.toString());
+ assertEquals(UnicodeEncoder.encode("h"+(char)0xE1), sw.toString());
}
-
+
@Test
- public void testUnicodeEncoder3() throws Exception
+ void unicodeEncoder3() throws Exception
{
StringWriter sw = new StringWriter(40);
UnicodeEncoder.encode(sw, ""+(char)0xE1+"a");
- Assertions.assertEquals(UnicodeEncoder.encode(""+(char)0xE1)+"a", sw.toString());
+ assertEquals(UnicodeEncoder.encode(""+(char)0xE1)+"a", sw.toString());
}
-
+
@Test
- public void testUnicodeEncoder4() throws Exception
+ void unicodeEncoder4() throws Exception
{
StringWriter sw = new StringWriter(40);
UnicodeEncoder.encode(sw, "hello h"+(char)0xE1+"aaa ");
- Assertions.assertEquals("hello háaaa ", sw.toString());
+ assertEquals("hello háaaa ", sw.toString());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/renderkits/OwnRenderkitTest.java b/impl/src/test/java/org/apache/myfaces/renderkits/OwnRenderkitTest.java
index 32a2af14b3..8089c1f961 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkits/OwnRenderkitTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkits/OwnRenderkitTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.renderkits;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.faces.FactoryFinder;
@@ -31,7 +33,6 @@
import org.apache.myfaces.test.mock.MockFacesContext12;
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -77,12 +78,12 @@ public void tearDown() throws Exception {
}
@Test
- public void testOwnRenderKit() throws Exception {
+ void ownRenderKit() throws Exception {
inputText.encodeEnd(facesContext);
facesContext.renderResponse();
- Assertions.assertTrue(isOwnRenderKit);
+ assertTrue(isOwnRenderKit);
}
diff --git a/impl/src/test/java/org/apache/myfaces/resource/ResourceLoaderUtilsTest.java b/impl/src/test/java/org/apache/myfaces/resource/ResourceLoaderUtilsTest.java
index 76e3237e48..6be42a725a 100644
--- a/impl/src/test/java/org/apache/myfaces/resource/ResourceLoaderUtilsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/resource/ResourceLoaderUtilsTest.java
@@ -18,30 +18,27 @@
*/
package org.apache.myfaces.resource;
-import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import org.junit.jupiter.api.Test;
-public class ResourceLoaderUtilsTest {
-
+class ResourceLoaderUtilsTest {
+
@Test
- public void testFormatDateHeader()
+ void formatDateHeader()
{
- Assertions.assertEquals("Tue, 16 Jul 2019 08:10:19 GMT",
+ assertEquals("Tue, 16 Jul 2019 08:10:19 GMT",
ResourceLoaderUtils.formatDateHeader(1563264619000L));
- Assertions.assertEquals("Tue, 16 Jul 2019 08:29:38 GMT",
+ assertEquals("Tue, 16 Jul 2019 08:29:38 GMT",
ResourceLoaderUtils.formatDateHeader(1563265778653L));
}
-
+
@Test
- public void testParseDateHeader()
+ void parseDateHeader()
{
- Assertions.assertEquals(1563264619000L,
- ResourceLoaderUtils.parseDateHeader("Tue, 16 Jul 2019 08:10:19 GMT"),
- 2000);
-
- Assertions.assertEquals(1563265778653L,
- ResourceLoaderUtils.parseDateHeader("Tue, 16 Jul 2019 08:29:38 GMT"),
- 2000);
+ assertEquals(1563264619000L, ResourceLoaderUtils.parseDateHeader("Tue, 16 Jul 2019 08:10:19 GMT"), 2000);
+
+ assertEquals(1563265778653L, ResourceLoaderUtils.parseDateHeader("Tue, 16 Jul 2019 08:29:38 GMT"), 2000);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/resource/ResourceValidationUtilsTest.java b/impl/src/test/java/org/apache/myfaces/resource/ResourceValidationUtilsTest.java
index df523942af..11672f2353 100644
--- a/impl/src/test/java/org/apache/myfaces/resource/ResourceValidationUtilsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/resource/ResourceValidationUtilsTest.java
@@ -19,80 +19,83 @@
package org.apache.myfaces.resource;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
+
import org.junit.jupiter.api.Test;
-public class ResourceValidationUtilsTest extends AbstractFacesTestCase
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class ResourceValidationUtilsTest extends AbstractFacesTestCase
{
@Test
- public void testLocaleNames() throws Exception
+ void localeNames() throws Exception
{
- Assertions.assertTrue(ResourceValidationUtils.isValidLocalePrefix("es_CO"));
- Assertions.assertTrue(ResourceValidationUtils.isValidLocalePrefix("de"));
- Assertions.assertTrue(ResourceValidationUtils.isValidLocalePrefix("de_AT"));
- Assertions.assertTrue(ResourceValidationUtils.isValidLocalePrefix("zh_CN_id"));
- Assertions.assertTrue(ResourceValidationUtils.isValidLocalePrefix("zh_CN_23"));
+ assertTrue(ResourceValidationUtils.isValidLocalePrefix("es_CO"));
+ assertTrue(ResourceValidationUtils.isValidLocalePrefix("de"));
+ assertTrue(ResourceValidationUtils.isValidLocalePrefix("de_AT"));
+ assertTrue(ResourceValidationUtils.isValidLocalePrefix("zh_CN_id"));
+ assertTrue(ResourceValidationUtils.isValidLocalePrefix("zh_CN_23"));
- Assertions.assertFalse(ResourceValidationUtils.isValidLocalePrefix("de-AT"));
- Assertions.assertFalse(ResourceValidationUtils.isValidLocalePrefix("."));
- Assertions.assertFalse(ResourceValidationUtils.isValidLocalePrefix(".."));
- Assertions.assertFalse(ResourceValidationUtils.isValidLocalePrefix("zh_"+'\t'+"CN"));
- Assertions.assertFalse(ResourceValidationUtils.isValidLocalePrefix("\\.."));
- Assertions.assertFalse(ResourceValidationUtils.isValidLocalePrefix("/.."));
- Assertions.assertFalse(ResourceValidationUtils.isValidLocalePrefix("../"));
- Assertions.assertFalse(ResourceValidationUtils.isValidLocalePrefix("..\\"));
- Assertions.assertFalse(ResourceValidationUtils.isValidLocalePrefix(".."));
+ assertFalse(ResourceValidationUtils.isValidLocalePrefix("de-AT"));
+ assertFalse(ResourceValidationUtils.isValidLocalePrefix("."));
+ assertFalse(ResourceValidationUtils.isValidLocalePrefix(".."));
+ assertFalse(ResourceValidationUtils.isValidLocalePrefix("zh_"+'\t'+"CN"));
+ assertFalse(ResourceValidationUtils.isValidLocalePrefix("\\.."));
+ assertFalse(ResourceValidationUtils.isValidLocalePrefix("/.."));
+ assertFalse(ResourceValidationUtils.isValidLocalePrefix("../"));
+ assertFalse(ResourceValidationUtils.isValidLocalePrefix("..\\"));
+ assertFalse(ResourceValidationUtils.isValidLocalePrefix(".."));
}
-
+
@Test
- public void testLibraryNames() throws Exception
+ void libraryNames() throws Exception
{
- Assertions.assertTrue(ResourceValidationUtils.isValidLibraryName("mylib"));
- Assertions.assertTrue(ResourceValidationUtils.isValidLibraryName("org.apache.myfaces"));
- Assertions.assertTrue(ResourceValidationUtils.isValidLibraryName("some-js-lib"));
- Assertions.assertTrue(ResourceValidationUtils.isValidLibraryName("some_js_lib"));
+ assertTrue(ResourceValidationUtils.isValidLibraryName("mylib"));
+ assertTrue(ResourceValidationUtils.isValidLibraryName("org.apache.myfaces"));
+ assertTrue(ResourceValidationUtils.isValidLibraryName("some-js-lib"));
+ assertTrue(ResourceValidationUtils.isValidLibraryName("some_js_lib"));
- Assertions.assertTrue(ResourceValidationUtils.isValidLibraryName("components/panels", true));
- Assertions.assertFalse(ResourceValidationUtils.isValidLibraryName("components/panels", false));
+ assertTrue(ResourceValidationUtils.isValidLibraryName("components/panels", true));
+ assertFalse(ResourceValidationUtils.isValidLibraryName("components/panels", false));
- Assertions.assertFalse(ResourceValidationUtils.isValidLibraryName("/mylib"));
- Assertions.assertFalse(ResourceValidationUtils.isValidLibraryName("mylib"+'\t'+"22"));
- Assertions.assertFalse(ResourceValidationUtils.isValidLibraryName("\\mylib"));
- Assertions.assertFalse(ResourceValidationUtils.isValidLibraryName(".."));
- Assertions.assertFalse(ResourceValidationUtils.isValidLibraryName("..", true));
- Assertions.assertFalse(ResourceValidationUtils.isValidLibraryName("some:js"));
- Assertions.assertFalse(ResourceValidationUtils.isValidLibraryName("some?js"));
- Assertions.assertFalse(ResourceValidationUtils.isValidLibraryName("some&js"));
+ assertFalse(ResourceValidationUtils.isValidLibraryName("/mylib"));
+ assertFalse(ResourceValidationUtils.isValidLibraryName("mylib"+'\t'+"22"));
+ assertFalse(ResourceValidationUtils.isValidLibraryName("\\mylib"));
+ assertFalse(ResourceValidationUtils.isValidLibraryName(".."));
+ assertFalse(ResourceValidationUtils.isValidLibraryName("..", true));
+ assertFalse(ResourceValidationUtils.isValidLibraryName("some:js"));
+ assertFalse(ResourceValidationUtils.isValidLibraryName("some?js"));
+ assertFalse(ResourceValidationUtils.isValidLibraryName("some&js"));
}
@Test
- public void testResourceNames() throws Exception
+ void resourceNames() throws Exception
{
- Assertions.assertTrue(ResourceValidationUtils.isValidResourceName("myres"));
- Assertions.assertTrue(ResourceValidationUtils.isValidResourceName("myres.css"));
- Assertions.assertTrue(ResourceValidationUtils.isValidResourceName("/myres"));
- Assertions.assertTrue(ResourceValidationUtils.isValidResourceName("/mydir/./myres.css"));
- Assertions.assertTrue(ResourceValidationUtils.isValidResourceName("org.apache.myfaces"));
- Assertions.assertTrue(ResourceValidationUtils.isValidResourceName("my_res_file.css"));
- Assertions.assertTrue(ResourceValidationUtils.isValidResourceName("my-res-file.css"));
+ assertTrue(ResourceValidationUtils.isValidResourceName("myres"));
+ assertTrue(ResourceValidationUtils.isValidResourceName("myres.css"));
+ assertTrue(ResourceValidationUtils.isValidResourceName("/myres"));
+ assertTrue(ResourceValidationUtils.isValidResourceName("/mydir/./myres.css"));
+ assertTrue(ResourceValidationUtils.isValidResourceName("org.apache.myfaces"));
+ assertTrue(ResourceValidationUtils.isValidResourceName("my_res_file.css"));
+ assertTrue(ResourceValidationUtils.isValidResourceName("my-res-file.css"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("myres"+'\t'+"22"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("\\myres"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName(".."));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("../"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("/.."));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("\\.."));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("..\\"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("myres.css/.."));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("myres.css\\.."));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("../myres.css"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("..\\myres.css"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("my/../res.css"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("my\\../res.css"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("my/..\\res.css"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("/mydir/../myres.css"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("my_res:file.css"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("my_res?file.css"));
- Assertions.assertFalse(ResourceValidationUtils.isValidResourceName("my_res&file.css"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("myres"+'\t'+"22"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("\\myres"));
+ assertFalse(ResourceValidationUtils.isValidResourceName(".."));
+ assertFalse(ResourceValidationUtils.isValidResourceName("../"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("/.."));
+ assertFalse(ResourceValidationUtils.isValidResourceName("\\.."));
+ assertFalse(ResourceValidationUtils.isValidResourceName("..\\"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("myres.css/.."));
+ assertFalse(ResourceValidationUtils.isValidResourceName("myres.css\\.."));
+ assertFalse(ResourceValidationUtils.isValidResourceName("../myres.css"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("..\\myres.css"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("my/../res.css"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("my\\../res.css"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("my/..\\res.css"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("/mydir/../myres.css"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("my_res:file.css"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("my_res?file.css"));
+ assertFalse(ResourceValidationUtils.isValidResourceName("my_res&file.css"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/spi/FactoryFinderProviderTest.java b/impl/src/test/java/org/apache/myfaces/spi/FactoryFinderProviderTest.java
index 2bfbeba4c0..da95c4d63e 100644
--- a/impl/src/test/java/org/apache/myfaces/spi/FactoryFinderProviderTest.java
+++ b/impl/src/test/java/org/apache/myfaces/spi/FactoryFinderProviderTest.java
@@ -18,10 +18,11 @@
*/
package org.apache.myfaces.spi;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import jakarta.faces.FactoryFinder;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -34,18 +35,18 @@ public FactoryFinderProviderTest()
}
@BeforeEach
- public void setUp() throws Exception
+ void setUp() throws Exception
{
}
@AfterEach
- public void tearDown() throws Exception
+ void tearDown() throws Exception
{
}
-
+
@Test
- public void testGetFactory() throws Exception
+ void getFactory() throws Exception
{
FactoryFinderProviderFactory ffp = new CustomFactoryFinderProviderFactoryImpl();
@@ -53,7 +54,7 @@ public void testGetFactory() throws Exception
Object uno = FactoryFinder.getFactory("anything");
- Assertions.assertEquals(1, uno);
+ assertEquals(1, uno);
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, "sfdsfdsf");
diff --git a/impl/src/test/java/org/apache/myfaces/test/core/mock/MockMyFacesClient.java b/impl/src/test/java/org/apache/myfaces/test/core/mock/MockMyFacesClient.java
index 1c178cc662..22b292c71f 100644
--- a/impl/src/test/java/org/apache/myfaces/test/core/mock/MockMyFacesClient.java
+++ b/impl/src/test/java/org/apache/myfaces/test/core/mock/MockMyFacesClient.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.test.core.mock;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.util.HashMap;
import java.util.Map;
import jakarta.faces.FacesException;
@@ -42,7 +44,6 @@
import org.apache.myfaces.renderkit.RendererUtils;
import org.apache.myfaces.test.mock.MockHttpServletRequest;
import org.apache.myfaces.test.mock.MockHttpServletResponse;
-import org.junit.jupiter.api.Assertions;
/**
* Client that keep track and "translate" the commands done in a Faces component.
@@ -95,7 +96,7 @@ public void processRedirect()
}
else
{
- Assertions.fail("Expected redirect not found");
+ fail("Expected redirect not found");
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/test/mock/MockRenderedValueExpression.java b/impl/src/test/java/org/apache/myfaces/test/mock/MockRenderedValueExpression.java
index faa5bb5693..f668daf4c3 100644
--- a/impl/src/test/java/org/apache/myfaces/test/mock/MockRenderedValueExpression.java
+++ b/impl/src/test/java/org/apache/myfaces/test/mock/MockRenderedValueExpression.java
@@ -18,13 +18,13 @@
*/
package org.apache.myfaces.test.mock;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import jakarta.el.ELContext;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIPanel;
import jakarta.faces.context.FacesContext;
-import org.junit.jupiter.api.Assertions;
-
/**
* Verifies the current component on stack in method getValue. Created for MYFACES-3157
*/
@@ -48,7 +48,7 @@ public MockRenderedValueExpression(String expression, Class> expectedType, UIC
public Object getValue(ELContext elContext) {
FacesContext facesContext = (FacesContext) elContext.getContext(FacesContext.class);
UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext);
- Assertions.assertEquals(currentComponent , toVerify,
+ assertEquals(currentComponent , toVerify,
"If this ValueExpression is evaluated, component on stack must be actual");
return value;
}
diff --git a/impl/src/test/java/org/apache/myfaces/util/CommentUtilsTest.java b/impl/src/test/java/org/apache/myfaces/util/CommentUtilsTest.java
index ce50e53d97..fcfbc1fce4 100644
--- a/impl/src/test/java/org/apache/myfaces/util/CommentUtilsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/util/CommentUtilsTest.java
@@ -18,54 +18,54 @@
*/
package org.apache.myfaces.util;
-import java.io.IOException;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CommentUtilsTest extends AbstractFacesTestCase
+class CommentUtilsTest extends AbstractFacesTestCase
{
@Test
- public void testIsStartMatchWithCommentedCDATA() throws IOException
+ void isStartMatchWithCommentedCDATA() throws Exception
{
- Assertions.assertTrue(CommentUtils.isStartMatchWithCommentedCDATA("/*"+CommentUtils.CDATA_SIMPLE_START));
- Assertions.assertTrue(CommentUtils.isStartMatchWithCommentedCDATA("/* "+CommentUtils.CDATA_SIMPLE_START));
- Assertions.assertTrue(CommentUtils.isStartMatchWithCommentedCDATA("/* \n\t"+CommentUtils.CDATA_SIMPLE_START));
+ assertTrue(CommentUtils.isStartMatchWithCommentedCDATA("/*"+CommentUtils.CDATA_SIMPLE_START));
+ assertTrue(CommentUtils.isStartMatchWithCommentedCDATA("/* "+CommentUtils.CDATA_SIMPLE_START));
+ assertTrue(CommentUtils.isStartMatchWithCommentedCDATA("/* \n\t"+CommentUtils.CDATA_SIMPLE_START));
}
-
+
@Test
- public void testIsEndMatchWithCommentedCDATA() throws IOException
+ void isEndMatchWithCommentedCDATA() throws Exception
{
- Assertions.assertTrue(CommentUtils.isEndMatchWithCommentedCDATA("fkdjslkfjsl "+CommentUtils.CDATA_SIMPLE_END+"*/"));
- Assertions.assertTrue(CommentUtils.isEndMatchWithCommentedCDATA("fkdjslkfjsl "+CommentUtils.CDATA_SIMPLE_END+" */"));
- Assertions.assertTrue(CommentUtils.isEndMatchWithCommentedCDATA("fkdjslkfjsl "+CommentUtils.CDATA_SIMPLE_END+"\n\t */"));
+ assertTrue(CommentUtils.isEndMatchWithCommentedCDATA("fkdjslkfjsl "+CommentUtils.CDATA_SIMPLE_END+"*/"));
+ assertTrue(CommentUtils.isEndMatchWithCommentedCDATA("fkdjslkfjsl "+CommentUtils.CDATA_SIMPLE_END+" */"));
+ assertTrue(CommentUtils.isEndMatchWithCommentedCDATA("fkdjslkfjsl "+CommentUtils.CDATA_SIMPLE_END+"\n\t */"));
}
-
+
@Test
- public void testIsStartMatchWithInlineCommentedCDATA() throws IOException
+ void isStartMatchWithInlineCommentedCDATA() throws Exception
{
- Assertions.assertTrue(CommentUtils.isStartMatchWithInlineCommentedCDATA("//"+CommentUtils.CDATA_SIMPLE_START));
- Assertions.assertTrue(CommentUtils.isStartMatchWithInlineCommentedCDATA("// "+CommentUtils.CDATA_SIMPLE_START));
- Assertions.assertTrue(CommentUtils.isStartMatchWithInlineCommentedCDATA("// \t"+CommentUtils.CDATA_SIMPLE_START));
- Assertions.assertFalse(CommentUtils.isStartMatchWithInlineCommentedCDATA("// \n"+CommentUtils.CDATA_SIMPLE_START));
+ assertTrue(CommentUtils.isStartMatchWithInlineCommentedCDATA("//"+CommentUtils.CDATA_SIMPLE_START));
+ assertTrue(CommentUtils.isStartMatchWithInlineCommentedCDATA("// "+CommentUtils.CDATA_SIMPLE_START));
+ assertTrue(CommentUtils.isStartMatchWithInlineCommentedCDATA("// \t"+CommentUtils.CDATA_SIMPLE_START));
+ assertFalse(CommentUtils.isStartMatchWithInlineCommentedCDATA("// \n"+CommentUtils.CDATA_SIMPLE_START));
}
@Test
- public void testIsEndMatchWithInlineCommentedCDATA() throws IOException
+ void isEndMatchWithInlineCommentedCDATA() throws Exception
{
- Assertions.assertTrue(CommentUtils.isEndMatchWithInlineCommentedCDATA("fkdjslkfjsl //"+CommentUtils.CDATA_SIMPLE_END));
- Assertions.assertTrue(CommentUtils.isEndMatchWithInlineCommentedCDATA("fkdjslkfjsl // "+CommentUtils.CDATA_SIMPLE_END));
- Assertions.assertTrue(CommentUtils.isEndMatchWithInlineCommentedCDATA("fkdjslkfjsl //\t "+CommentUtils.CDATA_SIMPLE_END));
- Assertions.assertFalse(CommentUtils.isEndMatchWithInlineCommentedCDATA("fkdjslkfjsl //\n\t "+CommentUtils.CDATA_SIMPLE_END));
+ assertTrue(CommentUtils.isEndMatchWithInlineCommentedCDATA("fkdjslkfjsl //"+CommentUtils.CDATA_SIMPLE_END));
+ assertTrue(CommentUtils.isEndMatchWithInlineCommentedCDATA("fkdjslkfjsl // "+CommentUtils.CDATA_SIMPLE_END));
+ assertTrue(CommentUtils.isEndMatchWithInlineCommentedCDATA("fkdjslkfjsl //\t "+CommentUtils.CDATA_SIMPLE_END));
+ assertFalse(CommentUtils.isEndMatchWithInlineCommentedCDATA("fkdjslkfjsl //\n\t "+CommentUtils.CDATA_SIMPLE_END));
}
-
+
@Test
- public void testIsEndMatchtWithInlineCommentedXmlCommentTag() throws IOException
+ void isEndMatchtWithInlineCommentedXmlCommentTag() throws Exception
{
- Assertions.assertTrue(CommentUtils.isEndMatchtWithInlineCommentedXmlCommentTag("fkdjslkfjsl //"+CommentUtils.COMMENT_SIMPLE_END));
- Assertions.assertTrue(CommentUtils.isEndMatchtWithInlineCommentedXmlCommentTag("fkdjslkfjsl // "+CommentUtils.COMMENT_SIMPLE_END));
- Assertions.assertTrue(CommentUtils.isEndMatchtWithInlineCommentedXmlCommentTag("fkdjslkfjsl //\t "+CommentUtils.COMMENT_SIMPLE_END));
- Assertions.assertFalse(CommentUtils.isEndMatchtWithInlineCommentedXmlCommentTag("fkdjslkfjsl //\n\t "+CommentUtils.COMMENT_SIMPLE_END));
+ assertTrue(CommentUtils.isEndMatchtWithInlineCommentedXmlCommentTag("fkdjslkfjsl //"+CommentUtils.COMMENT_SIMPLE_END));
+ assertTrue(CommentUtils.isEndMatchtWithInlineCommentedXmlCommentTag("fkdjslkfjsl // "+CommentUtils.COMMENT_SIMPLE_END));
+ assertTrue(CommentUtils.isEndMatchtWithInlineCommentedXmlCommentTag("fkdjslkfjsl //\t "+CommentUtils.COMMENT_SIMPLE_END));
+ assertFalse(CommentUtils.isEndMatchtWithInlineCommentedXmlCommentTag("fkdjslkfjsl //\n\t "+CommentUtils.COMMENT_SIMPLE_END));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/util/MessageUtilsTest.java b/impl/src/test/java/org/apache/myfaces/util/MessageUtilsTest.java
index 5469926784..9587b8aa5c 100644
--- a/impl/src/test/java/org/apache/myfaces/util/MessageUtilsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/util/MessageUtilsTest.java
@@ -15,6 +15,8 @@
*/
package org.apache.myfaces.util;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.text.NumberFormat;
import java.util.Locale;
import java.util.ResourceBundle;
@@ -22,13 +24,12 @@
import jakarta.faces.application.FacesMessage;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* TestCase for MessageUtils
*/
-public class MessageUtilsTest extends AbstractFacesTestCase
+class MessageUtilsTest extends AbstractFacesTestCase
{
private static final String DEFAULT_BUNDLE = "jakarta.faces.Messages";
@@ -36,76 +37,76 @@ public class MessageUtilsTest extends AbstractFacesTestCase
* Test method for 'org.apache.myfaces.shared.util.MessageUtils.getMessage(Severity, String, Object)'
*/
@Test
- public void testGetMessageSeverityStringObject()
+ void getMessageSeverityStringObject()
{
facesContext.getViewRoot().setLocale(Locale.ENGLISH);
FacesMessage msg = MessageUtils.getMessage(FacesMessage.Severity.ERROR,
"jakarta.faces.component.UIInput.CONVERSION", null);
- Assertions.assertEquals("{0}: Conversion error occurred.", msg.getSummary());
+ assertEquals("{0}: Conversion error occurred.", msg.getSummary());
facesContext.getViewRoot().setLocale(Locale.GERMAN);
msg = MessageUtils.getMessage(FacesMessage.Severity.ERROR,
"jakarta.faces.component.UIInput.CONVERSION",
"blubb");
- Assertions.assertEquals("blubb: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
+ assertEquals("blubb: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
}
/**
* Test method for 'org.apache.myfaces.shared.util.MessageUtils.getMessage(Severity, String, Object[])'
*/
@Test
- public void testGetMessageSeverityStringObjectArray()
+ void getMessageSeverityStringObjectArray()
{
facesContext.getViewRoot().setLocale(Locale.ENGLISH);
FacesMessage msg = MessageUtils.getMessage(FacesMessage.Severity.ERROR,
"jakarta.faces.component.UIInput.CONVERSION", null);
- Assertions.assertEquals("{0}: Conversion error occurred.", msg.getSummary());
+ assertEquals("{0}: Conversion error occurred.", msg.getSummary());
facesContext.getViewRoot().setLocale(Locale.GERMAN);
msg = MessageUtils.getMessage(FacesMessage.Severity.ERROR,
"jakarta.faces.component.UIInput.CONVERSION", null);
- Assertions.assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
+ assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
}
/**
* Test method for 'org.apache.myfaces.shared.util.MessageUtils.getMessage(Severity, String, Object[], FacesContext)'
*/
@Test
- public void testGetMessageSeverityStringObjectArrayFacesContext()
+ void getMessageSeverityStringObjectArrayFacesContext()
{
facesContext.getViewRoot().setLocale(Locale.ENGLISH);
FacesMessage msg = MessageUtils.getMessage(FacesMessage.Severity.ERROR,
"jakarta.faces.component.UIInput.CONVERSION", null, facesContext);
- Assertions.assertEquals("{0}: Conversion error occurred.", msg.getSummary());
+ assertEquals("{0}: Conversion error occurred.", msg.getSummary());
facesContext.getViewRoot().setLocale(Locale.GERMAN);
msg = MessageUtils.getMessage(FacesMessage.Severity.ERROR,
"jakarta.faces.component.UIInput.CONVERSION", null,
facesContext);
- Assertions.assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
+ assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
}
/**
* Test method for 'org.apache.myfaces.shared.util.MessageUtils.getMessage(Locale, String, Object[])'
*/
@Test
- public void testGetMessageLocaleStringObjectArray()
+ void getMessageLocaleStringObjectArray()
{
facesContext.getViewRoot().setLocale(Locale.ENGLISH);
FacesMessage msg = org.apache.myfaces.util.MessageUtils.getMessage(Locale.ENGLISH,
"jakarta.faces.component.UIInput.CONVERSION", null);
- Assertions.assertEquals("{0}: Conversion error occurred.", msg.getSummary());
+ assertEquals("{0}: Conversion error occurred.", msg.getSummary());
msg = MessageUtils.getMessage(Locale.GERMAN,
"jakarta.faces.component.UIInput.CONVERSION", null);
- Assertions.assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
+ assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
}
@@ -113,45 +114,45 @@ public void testGetMessageLocaleStringObjectArray()
* Test method for 'org.apache.myfaces.shared.util.MessageUtils.getMessage(FacesContext, String)'
*/
@Test
- public void testGetMessageFacesContextString()
+ void getMessageFacesContextString()
{
facesContext.getViewRoot().setLocale(Locale.ENGLISH);
FacesMessage msg = MessageUtils.getMessage(facesContext,
"jakarta.faces.component.UIInput.CONVERSION");
- Assertions.assertEquals("{0}: Conversion error occurred.", msg.getSummary());
+ assertEquals("{0}: Conversion error occurred.", msg.getSummary());
facesContext.getViewRoot().setLocale(Locale.GERMAN);
msg = MessageUtils.getMessage(facesContext,
"jakarta.faces.component.UIInput.CONVERSION");
- Assertions.assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
+ assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
}
/**
* Test method for 'org.apache.myfaces.shared.util.MessageUtils.getMessage(FacesContext, String, Object[])'
*/
@Test
- public void testGetMessageFacesContextStringObjectArray()
+ void getMessageFacesContextStringObjectArray()
{
facesContext.getViewRoot().setLocale(Locale.ENGLISH);
FacesMessage msg = MessageUtils.getMessage(facesContext,
"jakarta.faces.component.UIInput.CONVERSION", null);
- Assertions.assertEquals("{0}: Conversion error occurred.", msg.getSummary());
+ assertEquals("{0}: Conversion error occurred.", msg.getSummary());
facesContext.getViewRoot().setLocale(Locale.GERMAN);
msg = MessageUtils.getMessage(facesContext,
"jakarta.faces.component.UIInput.CONVERSION", null);
- Assertions.assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
+ assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
}
/**
* testGetMessageWithBundle
*/
@Test
- public void testGetMessageWithBundle()
+ void getMessageWithBundle()
{
facesContext.getViewRoot().setLocale(Locale.ENGLISH);
@@ -160,55 +161,55 @@ public void testGetMessageWithBundle()
FacesMessage msg = MessageUtils.getMessage(bundle,
"jakarta.faces.component.UIInput.CONVERSION", null);
- Assertions.assertEquals("{0}: Conversion error occurred.", msg.getSummary());
+ assertEquals("{0}: Conversion error occurred.", msg.getSummary());
}
/**
* testGetMessageWithBundleName
*/
@Test
- public void testGetMessageWithBundleName()
+ void getMessageWithBundleName()
{
facesContext.getViewRoot().setLocale(Locale.ENGLISH);
FacesMessage msg = MessageUtils.getMessage(DEFAULT_BUNDLE,
"jakarta.faces.component.UIInput.CONVERSION", null);
- Assertions.assertEquals("{0}: Conversion error occurred.", msg.getSummary());
+ assertEquals("{0}: Conversion error occurred.", msg.getSummary());
}
/**
* testGetMessageWithBundleNameLocale
*/
@Test
- public void testGetMessageWithBundleNameLocale()
+ void getMessageWithBundleNameLocale()
{
FacesMessage msg = MessageUtils.getMessage(DEFAULT_BUNDLE,
Locale.GERMAN, "jakarta.faces.component.UIInput.CONVERSION", null);
- Assertions.assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
+ assertEquals("{0}: Ein Konvertierungsfehler ist aufgetreten.", msg.getSummary());
}
/**
* testSubstituteParamsWithDELocale(
*/
@Test
- public void testSubstituteParamsWithDELocale() {
+ void substituteParamsWithDELocale() {
String paramString = MessageUtils.substituteParams(Locale.GERMANY, "currency {0,number,currency}", new Object[]{100});
String expected = "currency " + NumberFormat.getCurrencyInstance(Locale.GERMANY).format(100);
- Assertions.assertEquals(expected, paramString);
+ assertEquals(expected, paramString);
}
/**
* testSubstituteParamsWithGBLocale(
*/
@Test
- public void testSubstituteParamsWithGBLocale() {
+ void substituteParamsWithGBLocale() {
String paramString = MessageUtils.substituteParams(Locale.UK, "currency {0,number,currency}", new Object[]{100});
//System.out.println(paramString);
- Assertions.assertEquals("currency \u00a3100.00",paramString);
+ assertEquals("currency \u00a3100.00",paramString);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/util/lang/AbstractAttributeMapTest.java b/impl/src/test/java/org/apache/myfaces/util/lang/AbstractAttributeMapTest.java
index 6eb95edf6c..946f5556f3 100644
--- a/impl/src/test/java/org/apache/myfaces/util/lang/AbstractAttributeMapTest.java
+++ b/impl/src/test/java/org/apache/myfaces/util/lang/AbstractAttributeMapTest.java
@@ -18,12 +18,14 @@
*/
package org.apache.myfaces.util.lang;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -31,32 +33,32 @@
* @author Mathias Broekelmann (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class AbstractAttributeMapTest
+class AbstractAttributeMapTest
{
private TestAttributeMap _testimpl;
@BeforeEach
- public void setUp() throws Exception
+ void setUp() throws Exception
{
Map map = new HashMap();
map.put("key", "value");
_testimpl = new TestAttributeMap(map);
}
-
+
/**
* Test method for {@link java.util.AbstractMap#hashCode()}.
*/
@Test
- public void testHashCodeEquals()
+ void hashCodeEquals()
{
- Assertions.assertEquals(_testimpl.hashCode(), _testimpl.hashCode());
+ assertEquals(_testimpl.hashCode(), _testimpl.hashCode());
}
@Test
- public void testValues() throws Exception
+ void values() throws Exception
{
_testimpl.put("myKey", "myValue");
- Assertions.assertTrue(_testimpl.containsValue("myValue"));
+ assertTrue(_testimpl.containsValue("myValue"));
}
private static final class TestAttributeMap extends AbstractAttributeMap
diff --git a/impl/src/test/java/org/apache/myfaces/util/lang/ConcurrentLRUCacheTest.java b/impl/src/test/java/org/apache/myfaces/util/lang/ConcurrentLRUCacheTest.java
index 40cef0065a..8a35b908fa 100644
--- a/impl/src/test/java/org/apache/myfaces/util/lang/ConcurrentLRUCacheTest.java
+++ b/impl/src/test/java/org/apache/myfaces/util/lang/ConcurrentLRUCacheTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.util.lang;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
@@ -30,129 +32,128 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class ConcurrentLRUCacheTest
+class ConcurrentLRUCacheTest
{
@Test
- public void testPutAndGet()
+ void putAndGet()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
- Assertions.assertNull(cache.get("a"));
- Assertions.assertEquals(0, cache.size());
+ assertNull(cache.get("a"));
+ assertEquals(0, cache.size());
- Assertions.assertNull(cache.put("a", "1"));
- Assertions.assertEquals("1", cache.get("a"));
- Assertions.assertEquals(1, cache.size());
+ assertNull(cache.put("a", "1"));
+ assertEquals("1", cache.get("a"));
+ assertEquals(1, cache.size());
- Assertions.assertNull(cache.get("b"));
+ assertNull(cache.get("b"));
}
@Test
- public void testPutReturnsPreviousValue()
+ void putReturnsPreviousValue()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
- Assertions.assertNull(cache.put("a", "1"));
- Assertions.assertEquals("1", cache.put("a", "2"));
- Assertions.assertEquals("2", cache.get("a"));
- Assertions.assertEquals(1, cache.size());
+ assertNull(cache.put("a", "1"));
+ assertEquals("1", cache.put("a", "2"));
+ assertEquals("2", cache.get("a"));
+ assertEquals(1, cache.size());
}
@Test
- public void testPutIgnoresNullValue()
+ void putIgnoresNullValue()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
- Assertions.assertNull(cache.put("a", null));
- Assertions.assertEquals(0, cache.size());
+ assertNull(cache.put("a", null));
+ assertEquals(0, cache.size());
cache.put("a", "1");
// a null value must not drop the existing mapping either
- Assertions.assertNull(cache.put("a", null));
- Assertions.assertEquals("1", cache.get("a"));
+ assertNull(cache.put("a", null));
+ assertEquals("1", cache.get("a"));
}
@Test
- public void testRemove()
+ void remove()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
cache.put("a", "1");
- Assertions.assertNull(cache.remove("unknown"));
- Assertions.assertEquals("1", cache.remove("a"));
- Assertions.assertNull(cache.get("a"));
- Assertions.assertEquals(0, cache.size());
- Assertions.assertNull(cache.remove("a"));
+ assertNull(cache.remove("unknown"));
+ assertEquals("1", cache.remove("a"));
+ assertNull(cache.get("a"));
+ assertEquals(0, cache.size());
+ assertNull(cache.remove("a"));
}
@Test
- public void testClear()
+ void clear()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
putRange(cache, 0, 5);
- Assertions.assertEquals(5, cache.size());
+ assertEquals(5, cache.size());
cache.clear();
- Assertions.assertEquals(0, cache.size());
- Assertions.assertNull(cache.get("k0"));
- Assertions.assertTrue(cache.getLatestAccessedItems(10).isEmpty());
+ assertEquals(0, cache.size());
+ assertNull(cache.get("k0"));
+ assertTrue(cache.getLatestAccessedItems(10).isEmpty());
}
@Test
- public void testInvalidWaterMarks()
+ void invalidWaterMarks()
{
- Assertions.assertThrows(IllegalArgumentException.class, () -> new ConcurrentLRUCache<>(0, 0));
- Assertions.assertThrows(IllegalArgumentException.class, () -> new ConcurrentLRUCache<>(-1, 0));
- Assertions.assertThrows(IllegalArgumentException.class, () -> new ConcurrentLRUCache<>(10, 10));
- Assertions.assertThrows(IllegalArgumentException.class, () -> new ConcurrentLRUCache<>(10, 11));
- Assertions.assertThrows(IllegalArgumentException.class, () -> new ConcurrentLRUCache<>(10, -1));
+ assertThrows(IllegalArgumentException.class, () -> new ConcurrentLRUCache<>(0, 0));
+ assertThrows(IllegalArgumentException.class, () -> new ConcurrentLRUCache<>(-1, 0));
+ assertThrows(IllegalArgumentException.class, () -> new ConcurrentLRUCache<>(10, 10));
+ assertThrows(IllegalArgumentException.class, () -> new ConcurrentLRUCache<>(10, 11));
+ assertThrows(IllegalArgumentException.class, () -> new ConcurrentLRUCache<>(10, -1));
}
@Test
- public void testNoEvictionBelowUpperWaterMark()
+ void noEvictionBelowUpperWaterMark()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
putRange(cache, 0, 10);
- Assertions.assertEquals(10, cache.size());
- Assertions.assertEquals(keys(0, 10), keysOf(cache));
+ assertEquals(10, cache.size());
+ assertEquals(keys(0, 10), keysOf(cache));
}
@Test
- public void testEvictionDropsDownToLowerWaterMark()
+ void evictionDropsDownToLowerWaterMark()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
putRange(cache, 0, 11);
// the 11th put crosses the upper water mark, nothing was accessed, so the entries which
// were inserted first are dropped
- Assertions.assertEquals(5, cache.size());
- Assertions.assertEquals(keys(6, 11), keysOf(cache));
+ assertEquals(5, cache.size());
+ assertEquals(keys(6, 11), keysOf(cache));
}
@Test
- public void testEvictionKeepsAccessedEntries()
+ void evictionKeepsAccessedEntries()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
putRange(cache, 0, 10);
// k0 and k1 are the oldest entries, but accessing them protects them
- Assertions.assertEquals("v0", cache.get("k0"));
- Assertions.assertEquals("v1", cache.get("k1"));
+ assertEquals("v0", cache.get("k0"));
+ assertEquals("v1", cache.get("k1"));
cache.put("k10", "v10");
- Assertions.assertEquals(5, cache.size());
- Assertions.assertEquals(new LinkedHashSet<>(Arrays.asList("k0", "k1", "k8", "k9", "k10")),
+ assertEquals(5, cache.size());
+ assertEquals(new LinkedHashSet<>(Arrays.asList("k0", "k1", "k8", "k9", "k10")),
keysOf(cache));
}
@Test
- public void testEvictionResetsTheAccessFlag()
+ void evictionResetsTheAccessFlag()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
putRange(cache, 0, 10);
@@ -165,68 +166,68 @@ public void testEvictionResetsTheAccessFlag()
cache.get("k8");
putRange(cache, 11, 17);
- Assertions.assertEquals(5, cache.size());
- Assertions.assertEquals(new LinkedHashSet<>(Arrays.asList("k8", "k13", "k14", "k15", "k16")),
+ assertEquals(5, cache.size());
+ assertEquals(new LinkedHashSet<>(Arrays.asList("k8", "k13", "k14", "k15", "k16")),
keysOf(cache));
}
@Test
- public void testEvictionWithLowerWaterMarkZero()
+ void evictionWithLowerWaterMarkZero()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(2, 0);
putRange(cache, 0, 3);
- Assertions.assertEquals(0, cache.size());
+ assertEquals(0, cache.size());
}
@Test
- public void testRepeatedPutsStayBounded()
+ void repeatedPutsStayBounded()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
for (int i = 0; i < 1000; i++)
{
cache.put("k" + i, "v" + i);
- Assertions.assertTrue(cache.size() <= 10, "size must never exceed the upper water mark");
+ assertTrue(cache.size() <= 10, "size must never exceed the upper water mark");
}
- Assertions.assertEquals(10, cache.size());
- Assertions.assertEquals(keys(990, 1000), keysOf(cache));
+ assertEquals(10, cache.size());
+ assertEquals(keys(990, 1000), keysOf(cache));
}
@Test
- public void testAccessedItemsReturnEveryEntry()
+ void accessedItemsReturnEveryEntry()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
putRange(cache, 0, 5);
// all five entries share the same state, none of them may be swallowed
- Assertions.assertEquals(5, cache.getLatestAccessedItems(5).size());
- Assertions.assertEquals(5, cache.getLatestAccessedItems(100).size());
- Assertions.assertEquals(5, cache.getOldestAccessedItems(100).size());
+ assertEquals(5, cache.getLatestAccessedItems(5).size());
+ assertEquals(5, cache.getLatestAccessedItems(100).size());
+ assertEquals(5, cache.getOldestAccessedItems(100).size());
Map items = cache.getLatestAccessedItems(100);
for (int i = 0; i < 5; i++)
{
- Assertions.assertEquals("v" + i, items.get("k" + i));
+ assertEquals("v" + i, items.get("k" + i));
}
}
@Test
- public void testAccessedItemsRespectN()
+ void accessedItemsRespectN()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
putRange(cache, 0, 5);
- Assertions.assertTrue(cache.getLatestAccessedItems(0).isEmpty());
- Assertions.assertTrue(cache.getLatestAccessedItems(-1).isEmpty());
- Assertions.assertTrue(cache.getOldestAccessedItems(0).isEmpty());
- Assertions.assertEquals(1, cache.getLatestAccessedItems(1).size());
- Assertions.assertEquals(3, cache.getOldestAccessedItems(3).size());
+ assertTrue(cache.getLatestAccessedItems(0).isEmpty());
+ assertTrue(cache.getLatestAccessedItems(-1).isEmpty());
+ assertTrue(cache.getOldestAccessedItems(0).isEmpty());
+ assertEquals(1, cache.getLatestAccessedItems(1).size());
+ assertEquals(3, cache.getOldestAccessedItems(3).size());
}
@Test
- public void testAccessedItemsOrder()
+ void accessedItemsOrder()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
cache.put("k0", "v0");
@@ -236,23 +237,23 @@ public void testAccessedItemsOrder()
// k0 was accessed, so it ranks before the untouched entries; those are ordered by insertion
cache.get("k0");
- Assertions.assertEquals(Arrays.asList("k0", "k2", "k1"),
+ assertEquals(Arrays.asList("k0", "k2", "k1"),
new ArrayList<>(cache.getLatestAccessedItems(3).keySet()));
- Assertions.assertEquals(Arrays.asList("k1", "k2", "k0"),
+ assertEquals(Arrays.asList("k1", "k2", "k0"),
new ArrayList<>(cache.getOldestAccessedItems(3).keySet()));
}
@Test
- public void testAccessedItemsOnEmptyCache()
+ void accessedItemsOnEmptyCache()
{
ConcurrentLRUCache cache = new ConcurrentLRUCache<>(10, 5);
- Assertions.assertTrue(cache.getLatestAccessedItems(10).isEmpty());
- Assertions.assertTrue(cache.getOldestAccessedItems(10).isEmpty());
+ assertTrue(cache.getLatestAccessedItems(10).isEmpty());
+ assertTrue(cache.getOldestAccessedItems(10).isEmpty());
}
@Test
- public void testConcurrentAccess() throws Exception
+ void concurrentAccess() throws Exception
{
final int upperWaterMark = 200;
final ConcurrentLRUCache cache = new ConcurrentLRUCache<>(upperWaterMark, 100);
@@ -283,7 +284,7 @@ public void testConcurrentAccess() throws Exception
if (value != null)
{
// a key must never be mapped to the value of another key
- Assertions.assertEquals(valueOf(key), value);
+ assertEquals(valueOf(key), value);
}
else
{
@@ -292,7 +293,7 @@ public void testConcurrentAccess() throws Exception
if ((j & 0xFF) == 0)
{
- Assertions.assertTrue(cache.getLatestAccessedItems(10).size() <= 10);
+ assertTrue(cache.getLatestAccessedItems(10).size() <= 10);
}
}
}
@@ -308,7 +309,7 @@ public void testConcurrentAccess() throws Exception
}
start.countDown();
- Assertions.assertTrue(done.await(60, TimeUnit.SECONDS), "threads did not finish in time");
+ assertTrue(done.await(60, TimeUnit.SECONDS), "threads did not finish in time");
}
finally
{
@@ -323,7 +324,7 @@ public void testConcurrentAccess() throws Exception
// one quiescent put is enough to bring a cache which grew during the concurrent phase back
// under the upper water mark
cache.put("quiescent", "v");
- Assertions.assertTrue(cache.size() <= upperWaterMark,
+ assertTrue(cache.size() <= upperWaterMark,
"size " + cache.size() + " exceeds the upper water mark " + upperWaterMark);
}
diff --git a/impl/src/test/java/org/apache/myfaces/util/lang/LRULinkedHashMapTest.java b/impl/src/test/java/org/apache/myfaces/util/lang/LRULinkedHashMapTest.java
index 999bc25af6..b9b398c3f4 100644
--- a/impl/src/test/java/org/apache/myfaces/util/lang/LRULinkedHashMapTest.java
+++ b/impl/src/test/java/org/apache/myfaces/util/lang/LRULinkedHashMapTest.java
@@ -18,12 +18,14 @@
*/
package org.apache.myfaces.util.lang;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
-import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -33,61 +35,61 @@
* @param
* @param
*/
-public class LRULinkedHashMapTest {
+class LRULinkedHashMapTest {
- @Test
- public void testLRU() {
+ @Test
+ void lru() {
final K[] keys = getSampleKeys();
final V[] values = getSampleValues();
Iterator kit;
Iterator vit;
final LRULinkedHashMap map = new LRULinkedHashMap<>(2);
- Assertions.assertEquals(0, map.size());
+ assertEquals(0, map.size());
map.put(keys[0], values[0]);
- Assertions.assertEquals(1, map.size());
+ assertEquals(1, map.size());
map.put(keys[1], values[1]);
- Assertions.assertEquals(2, map.size());
+ assertEquals(2, map.size());
kit = map.keySet().iterator();
- Assertions.assertSame(keys[0], kit.next());
- Assertions.assertSame(keys[1], kit.next());
+ assertSame(keys[0], kit.next());
+ assertSame(keys[1], kit.next());
vit = map.values().iterator();
- Assertions.assertSame(values[0], vit.next());
- Assertions.assertSame(values[1], vit.next());
+ assertSame(values[0], vit.next());
+ assertSame(values[1], vit.next());
map.put(keys[2], values[2]);
- Assertions.assertEquals(2, map.size());
+ assertEquals(2, map.size());
kit = map.keySet().iterator();
- Assertions.assertSame(keys[1], kit.next());
- Assertions.assertSame(keys[2], kit.next());
+ assertSame(keys[1], kit.next());
+ assertSame(keys[2], kit.next());
vit = map.values().iterator();
- Assertions.assertSame(values[1], vit.next());
- Assertions.assertSame(values[2], vit.next());
+ assertSame(values[1], vit.next());
+ assertSame(values[2], vit.next());
map.put(keys[2], values[0]);
- Assertions.assertEquals(2, map.size());
+ assertEquals(2, map.size());
kit = map.keySet().iterator();
- Assertions.assertSame(keys[1], kit.next());
- Assertions.assertSame(keys[2], kit.next());
+ assertSame(keys[1], kit.next());
+ assertSame(keys[2], kit.next());
vit = map.values().iterator();
- Assertions.assertSame(values[1], vit.next());
- Assertions.assertSame(values[0], vit.next());
+ assertSame(values[1], vit.next());
+ assertSame(values[0], vit.next());
map.put(keys[1], values[3]);
- Assertions.assertEquals(2, map.size());
+ assertEquals(2, map.size());
kit = map.keySet().iterator();
- Assertions.assertSame(keys[2], kit.next());
- Assertions.assertSame(keys[1], kit.next());
+ assertSame(keys[2], kit.next());
+ assertSame(keys[1], kit.next());
vit = map.values().iterator();
- Assertions.assertSame(values[0], vit.next());
- Assertions.assertSame(values[3], vit.next());
+ assertSame(values[0], vit.next());
+ assertSame(values[3], vit.next());
}
- //-----------------------------------------------------------------------
- @Test
- public void testAccessOrder() {
+ //-----------------------------------------------------------------------
+ @Test
+ void accessOrder() {
final K[] keys = getSampleKeys();
final V[] values = getSampleValues();
Iterator kit;
@@ -97,79 +99,79 @@ public void testAccessOrder() {
map.put(keys[0], values[0]);
map.put(keys[1], values[1]);
kit = map.keySet().iterator();
- Assertions.assertSame(keys[0], kit.next());
- Assertions.assertSame(keys[1], kit.next());
+ assertSame(keys[0], kit.next());
+ assertSame(keys[1], kit.next());
vit = map.values().iterator();
- Assertions.assertSame(values[0], vit.next());
- Assertions.assertSame(values[1], vit.next());
+ assertSame(values[0], vit.next());
+ assertSame(values[1], vit.next());
// no change to order
map.put(keys[1], values[1]);
kit = map.keySet().iterator();
- Assertions.assertSame(keys[0], kit.next());
- Assertions.assertSame(keys[1], kit.next());
+ assertSame(keys[0], kit.next());
+ assertSame(keys[1], kit.next());
vit = map.values().iterator();
- Assertions.assertSame(values[0], vit.next());
- Assertions.assertSame(values[1], vit.next());
+ assertSame(values[0], vit.next());
+ assertSame(values[1], vit.next());
// no change to order
map.put(keys[1], values[2]);
kit = map.keySet().iterator();
- Assertions.assertSame(keys[0], kit.next());
- Assertions.assertSame(keys[1], kit.next());
+ assertSame(keys[0], kit.next());
+ assertSame(keys[1], kit.next());
vit = map.values().iterator();
- Assertions.assertSame(values[0], vit.next());
- Assertions.assertSame(values[2], vit.next());
+ assertSame(values[0], vit.next());
+ assertSame(values[2], vit.next());
// change to order
map.put(keys[0], values[3]);
kit = map.keySet().iterator();
- Assertions.assertSame(keys[1], kit.next());
- Assertions.assertSame(keys[0], kit.next());
+ assertSame(keys[1], kit.next());
+ assertSame(keys[0], kit.next());
vit = map.values().iterator();
- Assertions.assertSame(values[2], vit.next());
- Assertions.assertSame(values[3], vit.next());
+ assertSame(values[2], vit.next());
+ assertSame(values[3], vit.next());
// change to order
map.get(keys[1]);
kit = map.keySet().iterator();
- Assertions.assertSame(keys[0], kit.next());
- Assertions.assertSame(keys[1], kit.next());
+ assertSame(keys[0], kit.next());
+ assertSame(keys[1], kit.next());
vit = map.values().iterator();
- Assertions.assertSame(values[3], vit.next());
- Assertions.assertSame(values[2], vit.next());
+ assertSame(values[3], vit.next());
+ assertSame(values[2], vit.next());
// change to order
map.get(keys[0]);
kit = map.keySet().iterator();
- Assertions.assertSame(keys[1], kit.next());
- Assertions.assertSame(keys[0], kit.next());
+ assertSame(keys[1], kit.next());
+ assertSame(keys[0], kit.next());
vit = map.values().iterator();
- Assertions.assertSame(values[2], vit.next());
- Assertions.assertSame(values[3], vit.next());
+ assertSame(values[2], vit.next());
+ assertSame(values[3], vit.next());
// no change to order
map.get(keys[0]);
kit = map.keySet().iterator();
- Assertions.assertSame(keys[1], kit.next());
- Assertions.assertSame(keys[0], kit.next());
+ assertSame(keys[1], kit.next());
+ assertSame(keys[0], kit.next());
vit = map.values().iterator();
- Assertions.assertSame(values[2], vit.next());
- Assertions.assertSame(values[3], vit.next());
+ assertSame(values[2], vit.next());
+ assertSame(values[3], vit.next());
}
- @SuppressWarnings("unchecked")
- @Test
- public void testClone() {
+ @SuppressWarnings("unchecked")
+ @Test
+ void testClone() {
final LRULinkedHashMap map = new LRULinkedHashMap<>(10);
map.put((K) "1", (V) "1");
final Map cloned = (Map) map.clone();
- Assertions.assertEquals(map.size(), cloned.size());
- Assertions.assertSame(map.get("1"), cloned.get("1"));
+ assertEquals(map.size(), cloned.size());
+ assertSame(map.get("1"), cloned.get("1"));
}
- @Test
- public void testSynchronizedRemoveFromEntrySet() throws InterruptedException {
+ @Test
+ void synchronizedRemoveFromEntrySet() throws Exception {
final Map map = new LRULinkedHashMap<>(10000);
@@ -191,28 +193,28 @@ public void uncaughtException(final Thread t, final Throwable e) {
@Override
public void run() {
int i = 0;
- try {
- synchronized (this) {
- notifyAll();
- wait();
- }
- final Thread thread = Thread.currentThread();
- while (i < 1000 && !interrupted()) {
- synchronized (map) {
- map.put(thread.getName() + "[" + ++i + "]", thread);
- }
- }
- synchronized (map) {
- for (final Iterator> iter = map.entrySet().iterator(); iter.hasNext();) {
- final Map.Entry entry = iter.next();
- if (entry.getValue() == this) {
- iter.remove();
+ try {
+ synchronized (this) {
+ notifyAll();
+ wait();
+ }
+ final Thread thread = Thread.currentThread();
+ while (i < 1000 && !interrupted()) {
+ synchronized (map) {
+ map.put(thread.getName() + "[" + ++i + "]", thread);
}
- }
- }
- } catch (final InterruptedException e) {
- Assertions.fail("Unexpected InterruptedException");
- }
+ }
+ synchronized (map) {
+ for (final Iterator> iter = map.entrySet().iterator();iter.hasNext();) {
+ final Map.Entry entry = iter.next();
+ if (entry.getValue() == this) {
+ iter.remove();
+ }
+ }
+ }
+ } catch (final InterruptedException e) {
+ fail("Unexpected InterruptedException");
+ }
if (i > 0) {
synchronized (counter) {
counter[0]++;
@@ -247,13 +249,13 @@ public void run() {
}
}
- Assertions.assertEquals(0, exceptions.size());
- Assertions.assertTrue(counter[0] >= threads.length, "Each thread should have put at least 1 element into the map, but only "
+ assertEquals(0, exceptions.size());
+ assertTrue(counter[0] >= threads.length, "Each thread should have put at least 1 element into the map, but only "
+ counter[0] + " did succeed");
}
- @Test
- public void testSynchronizedRemoveFromKeySet() throws InterruptedException {
+ @Test
+ void synchronizedRemoveFromKeySet() throws Exception {
final Map map = new LRULinkedHashMap<>(10000);
@@ -275,28 +277,28 @@ public void uncaughtException(final Thread t, final Throwable e) {
@Override
public void run() {
int i = 0;
- try {
- synchronized (this) {
- notifyAll();
- wait();
- }
- final Thread thread = Thread.currentThread();
- while (i < 1000 && !interrupted()) {
- synchronized (map) {
- map.put(thread.getName() + "[" + ++i + "]", thread);
- }
- }
- synchronized (map) {
- for (final Iterator iter = map.keySet().iterator(); iter.hasNext();) {
- final String name = (String) iter.next();
- if (name.substring(0, name.indexOf('[')).equals(getName())) {
- iter.remove();
+ try {
+ synchronized (this) {
+ notifyAll();
+ wait();
+ }
+ final Thread thread = Thread.currentThread();
+ while (i < 1000 && !interrupted()) {
+ synchronized (map) {
+ map.put(thread.getName() + "[" + ++i + "]", thread);
}
- }
- }
- } catch (final InterruptedException e) {
- Assertions.fail("Unexpected InterruptedException");
- }
+ }
+ synchronized (map) {
+ for (final Iterator iter = map.keySet().iterator();iter.hasNext();) {
+ final String name = (String) iter.next();
+ if (name.substring(0, name.indexOf('[')).equals(getName())) {
+ iter.remove();
+ }
+ }
+ }
+ } catch (final InterruptedException e) {
+ fail("Unexpected InterruptedException");
+ }
if (i > 0) {
synchronized (counter) {
counter[0]++;
@@ -331,13 +333,13 @@ public void run() {
}
}
- Assertions.assertEquals(0, exceptions.size());
- Assertions.assertTrue(counter[0] >= threads.length, "Each thread should have put at least 1 element into the map, but only "
+ assertEquals(0, exceptions.size());
+ assertTrue(counter[0] >= threads.length, "Each thread should have put at least 1 element into the map, but only "
+ counter[0] + " did succeed");
}
- @Test
- public void testSynchronizedRemoveFromValues() throws InterruptedException {
+ @Test
+ void synchronizedRemoveFromValues() throws Exception {
final Map map = new LinkedHashMap<>(10000);
@@ -359,27 +361,27 @@ public void uncaughtException(final Thread t, final Throwable e) {
@Override
public void run() {
int i = 0;
- try {
- synchronized (this) {
- notifyAll();
- wait();
- }
- final Thread thread = Thread.currentThread();
- while (i < 1000 && !interrupted()) {
- synchronized (map) {
- map.put(thread.getName() + "[" + ++i + "]", thread);
- }
- }
- synchronized (map) {
- for (final Iterator iter = map.values().iterator(); iter.hasNext();) {
- if (iter.next() == this) {
- iter.remove();
+ try {
+ synchronized (this) {
+ notifyAll();
+ wait();
+ }
+ final Thread thread = Thread.currentThread();
+ while (i < 1000 && !interrupted()) {
+ synchronized (map) {
+ map.put(thread.getName() + "[" + ++i + "]", thread);
}
- }
- }
- } catch (final InterruptedException e) {
- Assertions.fail("Unexpected InterruptedException");
- }
+ }
+ synchronized (map) {
+ for (final Iterator iter = map.values().iterator();iter.hasNext();) {
+ if (iter.next() == this) {
+ iter.remove();
+ }
+ }
+ }
+ } catch (final InterruptedException e) {
+ fail("Unexpected InterruptedException");
+ }
if (i > 0) {
synchronized (counter) {
counter[0]++;
@@ -414,8 +416,8 @@ public void run() {
}
}
- Assertions.assertEquals(0, exceptions.size());
- Assertions.assertTrue(counter[0] >= threads.length, "Each thread should have put at least 1 element into the map, but only "
+ assertEquals(0, exceptions.size());
+ assertTrue(counter[0] >= threads.length, "Each thread should have put at least 1 element into the map, but only "
+ counter[0] + " did succeed");
}
diff --git a/impl/src/test/java/org/apache/myfaces/util/lang/XorShiftRandomTest.java b/impl/src/test/java/org/apache/myfaces/util/lang/XorShiftRandomTest.java
index 93b8333976..5f77356f87 100644
--- a/impl/src/test/java/org/apache/myfaces/util/lang/XorShiftRandomTest.java
+++ b/impl/src/test/java/org/apache/myfaces/util/lang/XorShiftRandomTest.java
@@ -21,14 +21,15 @@
import org.junit.jupiter.api.Test;
import java.util.HashSet;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Set;
-import org.junit.jupiter.api.Assertions;
-public class XorShiftRandomTest
+class XorShiftRandomTest
{
@Test
- public void testXorShiftRandom()
+ void xorShiftRandom()
{
XorShiftRandom random = new XorShiftRandom(System.nanoTime());
Set randomVals = new HashSet(10);
@@ -41,12 +42,12 @@ public void testXorShiftRandom()
}
// if the random generator is good then we had no collisions.
- Assertions.assertEquals(randomVals.size(), 100);
+ assertEquals(100, randomVals.size());
}
@Test
- public void testThreadsafeXorShiftRandom()
+ void threadsafeXorShiftRandom()
{
XorShiftRandom random = new ThreadsafeXorShiftRandom();
Set randomVals = new HashSet(10);
@@ -59,6 +60,6 @@ public void testThreadsafeXorShiftRandom()
}
// if the random generator is good then we had no collisions.
- Assertions.assertEquals(randomVals.size(), 100);
+ assertEquals(100, randomVals.size());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/BrokenTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/BrokenTestCase.java
index 395f71a1de..02778a5d01 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/BrokenTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/BrokenTestCase.java
@@ -22,10 +22,10 @@
import org.junit.jupiter.api.Test;
-public class BrokenTestCase extends AbstractFaceletTestCase {
+class BrokenTestCase extends AbstractFaceletTestCase {
@Test
- public void testBroken() throws Exception {
+ void broken() throws Exception {
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/EncodingTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/EncodingTestCase.java
index b783987331..2eefe6bc70 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/EncodingTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/EncodingTestCase.java
@@ -28,7 +28,7 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.junit.jupiter.api.Test;
-public class EncodingTestCase extends AbstractFaceletTestCase
+class EncodingTestCase extends AbstractFaceletTestCase
{
@Override
@@ -49,7 +49,7 @@ protected void setupRenderers() throws Exception
}
@Test
- public void testPattern() throws Exception
+ void pattern() throws Exception
{
Pattern p = Pattern
.compile("^<\\?xml.+?version=['\"](.+?)['\"](.+?encoding=['\"]((.+?))['\"])?.*?\\?>");
@@ -71,7 +71,7 @@ public void testPattern() throws Exception
}
@Test
- public void testEncoding() throws Exception
+ void encoding() throws Exception
{
request.setAttribute("name", "Mr. Hookom");
UIViewRoot root = facesContext.getViewRoot();
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/ExceptionTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/ExceptionTestCase.java
index add4dce379..025fb9f360 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/ExceptionTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/ExceptionTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.IOException;
import java.util.Iterator;
@@ -44,7 +46,7 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class ExceptionTestCase extends AbstractFaceletTestCase
+class ExceptionTestCase extends AbstractFaceletTestCase
{
@Override
@@ -59,9 +61,9 @@ protected void setUpFacesContext() throws Exception
super.setUpFacesContext();
facesContext.setExceptionHandler(new ExceptionHandlerImpl());
}
-
+
@Test
- public void testActionException1() throws Exception
+ void actionException1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"testActionException1.xhtml");
@@ -69,7 +71,7 @@ public void testActionException1() throws Exception
request.addParameter("mainForm:button1", "Submit");
UICommand button = (UICommand) root.findComponent("mainForm:button1");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
ExceptionBean bean = EasyMock.createMock(ExceptionBean.class);
EasyMock.expect(bean.doSomeAction()).andThrow(new AbortProcessingException());
@@ -79,15 +81,10 @@ public void testActionException1() throws Exception
request.setAttribute("bean", bean);
button.processDecodes(facesContext);
-
- try
- {
+
+ Assertions.assertDoesNotThrow(() -> {
root.processApplication(facesContext);
- }
- catch(FacesException e)
- {
- Assertions.fail("No exception should be thrown at this point.");
- }
+ }, "No exception should be thrown at this point.");
int i = 0;
for (Iterator it = facesContext.getExceptionHandler().getUnhandledExceptionQueuedEvents().iterator(); it.hasNext();)
@@ -101,10 +98,10 @@ public void testActionException1() throws Exception
}
else
{
- Assertions.fail("Unexpected exception queued");
+ fail("Unexpected exception queued");
}
}
- Assertions.assertEquals(1, i);
+ assertEquals(1, i);
}
/**
@@ -113,7 +110,7 @@ public void testActionException1() throws Exception
* @throws Exception
*/
@Test
- public void testActionException1_1() throws Exception
+ void actionException11() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"testActionException1.xhtml");
@@ -121,7 +118,7 @@ public void testActionException1_1() throws Exception
request.addParameter("mainForm:button1", "Submit");
UICommand button = (UICommand) root.findComponent("mainForm:button1");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
ExceptionBean bean = EasyMock.createMock(ExceptionBean.class);
EasyMock.expect(bean.doSomeAction()).andThrow(new RuntimeException());
@@ -143,16 +140,16 @@ public void testActionException1_1() throws Exception
Iterable unhandledExceptionQueuedEvents = facesContext.getExceptionHandler().getUnhandledExceptionQueuedEvents();
ExceptionQueuedEvent exceptionQueuedEvent = unhandledExceptionQueuedEvents.iterator().next();
- Assertions.assertNotNull(exceptionQueuedEvent.getContext().getException());
+ assertNotNull(exceptionQueuedEvent.getContext().getException());
}
-
+
/**
* A runtime exception thrown must be
*
* @throws Exception
*/
@Test
- public void testActionException1_2() throws Exception
+ void actionException12() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"testActionException1.xhtml");
@@ -160,7 +157,7 @@ public void testActionException1_2() throws Exception
request.addParameter("mainForm:button1", "Submit");
UICommand button = (UICommand) root.findComponent("mainForm:button1");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
ExceptionBean bean = EasyMock.createMock(ExceptionBean.class);
EasyMock.expect(bean.doSomeAction()).andThrow(new IOException());
@@ -182,11 +179,11 @@ public void testActionException1_2() throws Exception
Iterable unhandledExceptionQueuedEvents = facesContext.getExceptionHandler().getUnhandledExceptionQueuedEvents();
ExceptionQueuedEvent exceptionQueuedEvent = unhandledExceptionQueuedEvents.iterator().next();
- Assertions.assertNotNull(exceptionQueuedEvent.getContext().getException());
+ assertNotNull(exceptionQueuedEvent.getContext().getException());
}
@Test
- public void testActionListenerException1() throws Exception
+ void actionListenerException1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"testActionListenerException1.xhtml");
@@ -194,7 +191,7 @@ public void testActionListenerException1() throws Exception
request.addParameter("mainForm:button1", "Submit");
UICommand button = (UICommand) root.findComponent("mainForm:button1");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
//ActionEvent event = new ActionEvent(button);
ExceptionBean bean = EasyMock.createMock(ExceptionBean.class);
@@ -206,15 +203,10 @@ public void testActionListenerException1() throws Exception
request.setAttribute("bean", bean);
button.processDecodes(facesContext);
-
- try
- {
+
+ Assertions.assertDoesNotThrow(() -> {
root.processApplication(facesContext);
- }
- catch(FacesException e)
- {
- Assertions.fail("No exception should be thrown at this point.");
- }
+ }, "No exception should be thrown at this point.");
int i = 0;
for (Iterator it = facesContext.getExceptionHandler().getUnhandledExceptionQueuedEvents().iterator(); it.hasNext();)
@@ -228,10 +220,10 @@ public void testActionListenerException1() throws Exception
}
else
{
- Assertions.fail("Unexpected exception queued");
+ fail("Unexpected exception queued");
}
}
- Assertions.assertEquals(1, i);
+ assertEquals(1, i);
}
@@ -241,7 +233,7 @@ public void testActionListenerException1() throws Exception
* @throws Exception
*/
@Test
- public void testActionListenerException1_1() throws Exception
+ void actionListenerException11() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"testActionListenerException1.xhtml");
@@ -249,7 +241,7 @@ public void testActionListenerException1_1() throws Exception
request.addParameter("mainForm:button1", "Submit");
UICommand button = (UICommand) root.findComponent("mainForm:button1");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
//ActionEvent event = new ActionEvent(button);
ExceptionBean bean = EasyMock.createMock(ExceptionBean.class);
@@ -284,7 +276,7 @@ public void testActionListenerException1_1() throws Exception
Throwable e = eqe.getContext().getException();
if (e instanceof AbortProcessingException)
{
- Assertions.fail("Unexpected exception queued");
+ fail("Unexpected exception queued");
}
else
{
@@ -292,7 +284,7 @@ public void testActionListenerException1_1() throws Exception
i++;
}
}
- Assertions.assertEquals(1, i);
+ assertEquals(1, i);
}
@@ -304,7 +296,7 @@ private void publishException (Throwable e, PhaseId phaseId, FacesContext facesC
}
@Test
- public void testValidatorException1() throws Exception
+ void validatorException1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"testValidatorException1.xhtml");
@@ -324,21 +316,16 @@ public void invokeContextCallback(FacesContext context, UIComponent target)
UIInput input = (UIInput) target;
input.setSubmittedValue(submittedValue);
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
input.processValidators(facesContext);
- Assertions.assertTrue(facesContext.isValidationFailed());
- }
- catch(FacesException e)
- {
- Assertions.fail("No exception expected");
- }
+ assertTrue(facesContext.isValidationFailed());
+ }, "No exception expected");
}
});
}
-
+
@Test
- public void testValidatorException2() throws Exception
+ void validatorException2() throws Exception
{
application.addValidator("customValidatorId", CustomValidator.class.getName());
UIViewRoot root = facesContext.getViewRoot();
@@ -352,23 +339,18 @@ public void invokeContextCallback(FacesContext context, UIComponent target)
UIInput input = (UIInput) target;
input.setSubmittedValue(submittedValue);
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
input.processValidators(facesContext);
- Assertions.assertTrue(facesContext.isValidationFailed());
- }
- catch(FacesException e)
- {
- Assertions.fail("No exception expected");
- }
+ assertTrue(facesContext.isValidationFailed());
+ }, "No exception expected");
}
});
- Assertions.assertEquals("not valid!", facesContext.getMessageList().get(0).getSummary());
+ assertEquals("not valid!", facesContext.getMessageList().get(0).getSummary());
}
-
+
@Test
- public void testValueChangeListenerException1() throws Exception
+ void valueChangeListenerException1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"testValueChangeListenerException1.xhtml");
@@ -388,14 +370,9 @@ public void invokeContextCallback(FacesContext context, UIComponent target)
UIInput input = (UIInput) target;
input.setSubmittedValue(submittedValue);
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
input.processValidators(facesContext);
- }
- catch(FacesException e)
- {
- Assertions.fail("No exception expected");
- }
+ }, "No exception expected");
}
});
@@ -421,14 +398,14 @@ public void invokeContextCallback(FacesContext context, UIComponent target)
}
else
{
- Assertions.fail("Unexpected exception queued");
+ fail("Unexpected exception queued");
}
}
- Assertions.assertEquals(1, i);
+ assertEquals(1, i);
}
-
+
@Test
- public void testValueChangeListenerException1_1() throws Exception
+ void valueChangeListenerException11() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"testValueChangeListenerException1.xhtml");
@@ -446,14 +423,9 @@ public void invokeContextCallback(FacesContext context, UIComponent target)
UIInput input = (UIInput) target;
input.setSubmittedValue(submittedValue);
- try
- {
+ Assertions.assertDoesNotThrow(() -> {
input.processValidators(facesContext);
- }
- catch(FacesException e)
- {
- Assertions.fail("No exception expected");
- }
+ }, "No exception expected");
request.setAttribute("bean", bean);
}
@@ -476,7 +448,7 @@ public void invokeContextCallback(FacesContext context, UIComponent target)
Throwable e = eqe.getContext().getException();
if (e instanceof AbortProcessingException)
{
- Assertions.fail("Unexpected exception queued");
+ fail("Unexpected exception queued");
}
else
{
@@ -484,7 +456,7 @@ public void invokeContextCallback(FacesContext context, UIComponent target)
i++;
}
}
- Assertions.assertEquals(1, i);
+ assertEquals(1, i);
}
public static class CustomValidator implements Validator
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguageTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguageTest.java
index 25326b298a..132b281171 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguageTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguageTest.java
@@ -18,8 +18,9 @@
*/
package org.apache.myfaces.view.facelets;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.Locale;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import jakarta.faces.component.UIComponent;
@@ -34,14 +35,14 @@
*
* @author Jakob Korherr
*/
-public class FaceletViewDeclarationLanguageTest extends AbstractFaceletTestCase
+class FaceletViewDeclarationLanguageTest extends AbstractFaceletTestCase
{
/**
* Test case for MYFACES-3002.
*/
@Test
- public void testBuildViewUIViewParameters() throws Exception
+ void buildViewUIViewParameters() throws Exception
{
// build a UIViewRoot with a UIViewParameter
ViewMetadata viewMetadata = this.vdl.getViewMetadata(facesContext, "viewparameter1.xhtml");
@@ -63,16 +64,16 @@ private void checkUIViewParameter(UIViewRoot root)
{
// the metadata facet MUST be there
UIComponent metadataFacet = root.getFacet(UIViewRoot.METADATA_FACET_NAME);
- Assertions.assertNotNull(metadataFacet);
- Assertions.assertTrue(metadataFacet instanceof UIPanel); // the metadata-facet must be a UIPanel
+ assertNotNull(metadataFacet);
+ assertInstanceOf(UIPanel.class, metadataFacet); // the metadata-facet must be a UIPanel
// get the UIViewParameter
UIComponent viewParameter = metadataFacet.getChildren().get(0);
- Assertions.assertTrue(viewParameter instanceof UIViewParameter);
+ assertInstanceOf(UIViewParameter.class, viewParameter);
}
@Test
- public void testBuildViewUIViewParametersLocale() throws Exception
+ void buildViewUIViewParametersLocale() throws Exception
{
request.setAttribute("viewBean", new ViewBean());
@@ -84,7 +85,7 @@ public void testBuildViewUIViewParametersLocale() throws Exception
// UIViewParameter must be there
checkUIViewParameter(root);
- Assertions.assertEquals(Locale.FRANCE, root.getLocale());
+ assertEquals(Locale.FRANCE, root.getLocale());
// build and render view (must not remove UIViewParameter)
vdl.buildView(facesContext, root, "viewparameter2.xhtml");
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/ImportConstantsMetadataTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/ImportConstantsMetadataTest.java
index 099aaeda8d..a071824480 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/ImportConstantsMetadataTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/ImportConstantsMetadataTest.java
@@ -18,18 +18,19 @@
*/
package org.apache.myfaces.view.facelets;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.context.ResponseWriter;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.test.mock.MockPrintWriter;
import org.apache.myfaces.util.lang.FastWriter;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class ImportConstantsMetadataTest extends AbstractMyFacesCDIRequestTestCase
+class ImportConstantsMetadataTest extends AbstractMyFacesCDIRequestTestCase
{
@Test
- public void test() throws Exception
+ void test() throws Exception
{
startViewRequest("/importConstantsMetadata.xhtml");
processLifecycleExecuteAndRender();
@@ -37,6 +38,6 @@ public void test() throws Exception
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content = new String(writer1.content());
- Assertions.assertTrue(content.contains("Value:a!"));
+ assertTrue(content.contains("Value:a!"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/ImportConstantsTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/ImportConstantsTest.java
index bddfd5193e..e6f962071f 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/ImportConstantsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/ImportConstantsTest.java
@@ -20,13 +20,15 @@
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.test.mock.MockPrintWriter;
-import org.junit.jupiter.api.Assertions;
+
import org.junit.jupiter.api.Test;
-public class ImportConstantsTest extends AbstractMyFacesCDIRequestTestCase
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class ImportConstantsTest extends AbstractMyFacesCDIRequestTestCase
{
@Test
- public void test() throws Exception
+ void test() throws Exception
{
startViewRequest("/importConstants.xhtml");
processLifecycleExecuteAndRender();
@@ -34,6 +36,6 @@ public void test() throws Exception
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content = new String(writer1.content());
- Assertions.assertTrue(content.contains("Value:a!"));
+ assertTrue(content.contains("Value:a!"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/InstructionsTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/InstructionsTestCase.java
index 08d1ea8201..ea3838df73 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/InstructionsTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/InstructionsTestCase.java
@@ -25,7 +25,7 @@
import org.apache.myfaces.util.lang.FastWriter;
import org.junit.jupiter.api.Test;
-public class InstructionsTestCase extends AbstractFaceletTestCase
+class InstructionsTestCase extends AbstractFaceletTestCase
{
@Override
@@ -46,7 +46,7 @@ protected void setupRenderers() throws Exception
}
@Test
- public void testInstructions() throws Exception
+ void instructions() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "instructions.xhtml");
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/PartialStateManagementStrategyTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/PartialStateManagementStrategyTest.java
index 0d5f040e0c..cd64894439 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/PartialStateManagementStrategyTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/PartialStateManagementStrategyTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.view.facelets;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import java.beans.BeanInfo;
import java.io.IOException;
import java.util.Iterator;
@@ -50,7 +53,6 @@
import org.apache.myfaces.test.mock.MockRenderKit;
import org.apache.myfaces.view.ViewMetadataBase;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -143,7 +145,7 @@ protected void setFactories() throws Exception
}
@Test
- public void testSimpleSaveRestore() throws Exception
+ void simpleSaveRestore() throws Exception
{
ViewDeclarationLanguage vdl =((MockViewDeclarationLanguageFactory)FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY)).vdl;
PartialStateManagementStrategy stateManagement = new PartialStateManagementStrategy();
@@ -163,15 +165,15 @@ public void testSimpleSaveRestore() throws Exception
viewRoot = facesContext.getViewRoot();
- Assertions.assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
- Assertions.assertNotNull(viewRoot.findComponent("form1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:foo1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:var1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:button1"));
+ assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
+ assertNotNull(viewRoot.findComponent("form1"));
+ assertNotNull(viewRoot.findComponent("form1:foo1"));
+ assertNotNull(viewRoot.findComponent("form1:var1"));
+ assertNotNull(viewRoot.findComponent("form1:button1"));
}
-
+
@Test
- public void testSaveRestoreAddComponent() throws Exception
+ void saveRestoreAddComponent() throws Exception
{
ViewDeclarationLanguage vdl =((MockViewDeclarationLanguageFactory)FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY)).vdl;
PartialStateManagementStrategy stateManagement = new PartialStateManagementStrategy();
@@ -198,19 +200,19 @@ public void testSaveRestoreAddComponent() throws Exception
viewRoot = facesContext.getViewRoot();
- Assertions.assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
- Assertions.assertNotNull(viewRoot.findComponent("form1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:foo1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:var1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:button1"));
+ assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
+ assertNotNull(viewRoot.findComponent("form1"));
+ assertNotNull(viewRoot.findComponent("form1:foo1"));
+ assertNotNull(viewRoot.findComponent("form1:var1"));
+ assertNotNull(viewRoot.findComponent("form1:button1"));
a = (HtmlOutputText) viewRoot.findComponent("output1");
- Assertions.assertNotNull(a);
- Assertions.assertEquals("testOutput1",a.getValue());
+ assertNotNull(a);
+ assertEquals("testOutput1",a.getValue());
}
-
+
@Test
- public void testSaveRestoreAddComponentMultiplePostback() throws Exception
+ void saveRestoreAddComponentMultiplePostback() throws Exception
{
ViewDeclarationLanguage vdl =((MockViewDeclarationLanguageFactory)FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY)).vdl;
PartialStateManagementStrategy stateManagement = new PartialStateManagementStrategy();
@@ -257,28 +259,28 @@ public void testSaveRestoreAddComponentMultiplePostback() throws Exception
viewRoot = saveAndRestore(stateManagement, viewRoot);
- Assertions.assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
- Assertions.assertNotNull(viewRoot.findComponent("form1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:foo1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:var1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:button1"));
+ assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
+ assertNotNull(viewRoot.findComponent("form1"));
+ assertNotNull(viewRoot.findComponent("form1:foo1"));
+ assertNotNull(viewRoot.findComponent("form1:var1"));
+ assertNotNull(viewRoot.findComponent("form1:button1"));
a = (HtmlOutputText) viewRoot.findComponent("output1");
- Assertions.assertNotNull(a);
- Assertions.assertEquals("testOutput1",a.getValue());
+ assertNotNull(a);
+ assertEquals("testOutput1",a.getValue());
b = (HtmlOutputText) viewRoot.findComponent("output2");
- Assertions.assertNotNull(b);
- Assertions.assertEquals("testOutput2",b.getValue());
+ assertNotNull(b);
+ assertEquals("testOutput2",b.getValue());
c = (HtmlOutputText) viewRoot.findComponent("output3");
- Assertions.assertNotNull(c);
- Assertions.assertEquals("testOutput3",c.getValue());
+ assertNotNull(c);
+ assertEquals("testOutput3",c.getValue());
d = (HtmlOutputText) viewRoot.findComponent("output4");
- Assertions.assertNotNull(d);
- Assertions.assertEquals("testOutput4",d.getValue());
+ assertNotNull(d);
+ assertEquals("testOutput4",d.getValue());
}
-
+
@Test
- public void testSaveRestoreToogleComponent() throws Exception
+ void saveRestoreToogleComponent() throws Exception
{
ViewDeclarationLanguage vdl =((MockViewDeclarationLanguageFactory)FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY)).vdl;
PartialStateManagementStrategy stateManagement = new PartialStateManagementStrategy();
@@ -299,54 +301,54 @@ public void testSaveRestoreToogleComponent() throws Exception
viewRoot = saveAndRestore(stateManagement, viewRoot);
- Assertions.assertEquals("form1",viewRoot.getChildren().get(0).getId());
- Assertions.assertEquals("output1",viewRoot.getChildren().get(1).getId());
+ assertEquals("form1",viewRoot.getChildren().get(0).getId());
+ assertEquals("output1",viewRoot.getChildren().get(1).getId());
UIComponent component = viewRoot.getChildren().remove( 0 );
viewRoot.getChildren().add( component );
viewRoot = saveAndRestore(stateManagement, viewRoot);
- Assertions.assertEquals("output1",viewRoot.getChildren().get(0).getId());
- Assertions.assertEquals("form1",viewRoot.getChildren().get(1).getId());
+ assertEquals("output1",viewRoot.getChildren().get(0).getId());
+ assertEquals("form1",viewRoot.getChildren().get(1).getId());
component = viewRoot.getChildren().remove( 0 );
viewRoot.getChildren().add( component );
viewRoot = saveAndRestore(stateManagement, viewRoot);
- Assertions.assertEquals("form1",viewRoot.getChildren().get(0).getId());
- Assertions.assertEquals("output1",viewRoot.getChildren().get(1).getId());
+ assertEquals("form1",viewRoot.getChildren().get(0).getId());
+ assertEquals("output1",viewRoot.getChildren().get(1).getId());
component = viewRoot.getChildren().remove( 0 );
viewRoot.getChildren().add( component );
viewRoot = saveAndRestore(stateManagement, viewRoot);
- Assertions.assertEquals("output1",viewRoot.getChildren().get(0).getId());
- Assertions.assertEquals("form1",viewRoot.getChildren().get(1).getId());
+ assertEquals("output1",viewRoot.getChildren().get(0).getId());
+ assertEquals("form1",viewRoot.getChildren().get(1).getId());
component = viewRoot.getChildren().remove( 0 );
viewRoot.getChildren().add( component );
viewRoot = saveAndRestore(stateManagement, viewRoot);
- Assertions.assertEquals("form1",viewRoot.getChildren().get(0).getId());
- Assertions.assertEquals("output1",viewRoot.getChildren().get(1).getId());
+ assertEquals("form1",viewRoot.getChildren().get(0).getId());
+ assertEquals("output1",viewRoot.getChildren().get(1).getId());
- Assertions.assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
- Assertions.assertNotNull(viewRoot.findComponent("form1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:foo1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:var1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:button1"));
+ assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
+ assertNotNull(viewRoot.findComponent("form1"));
+ assertNotNull(viewRoot.findComponent("form1:foo1"));
+ assertNotNull(viewRoot.findComponent("form1:var1"));
+ assertNotNull(viewRoot.findComponent("form1:button1"));
a = (HtmlOutputText) viewRoot.findComponent("output1");
- Assertions.assertNotNull(a);
- Assertions.assertEquals("testOutput1",a.getValue());
+ assertNotNull(a);
+ assertEquals("testOutput1",a.getValue());
}
-
+
@Test
- public void testSaveRestoreToogleComponent2() throws Exception
+ void saveRestoreToogleComponent2() throws Exception
{
ViewDeclarationLanguage vdl =((MockViewDeclarationLanguageFactory)FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY)).vdl;
PartialStateManagementStrategy stateManagement = new PartialStateManagementStrategy();
@@ -371,55 +373,55 @@ public void testSaveRestoreToogleComponent2() throws Exception
viewRoot = saveAndRestore(stateManagement, viewRoot);
- Assertions.assertEquals("form1",viewRoot.getChildren().get(0).getId());
- Assertions.assertEquals("output1",viewRoot.getChildren().get(1).getId());
- Assertions.assertEquals("output2",viewRoot.getChildren().get(2).getId());
+ assertEquals("form1",viewRoot.getChildren().get(0).getId());
+ assertEquals("output1",viewRoot.getChildren().get(1).getId());
+ assertEquals("output2",viewRoot.getChildren().get(2).getId());
UIComponent component = viewRoot.getChildren().remove( 0 );
viewRoot.getChildren().add( component );
viewRoot = saveAndRestore(stateManagement, viewRoot);
- Assertions.assertEquals("output1",viewRoot.getChildren().get(0).getId());
- Assertions.assertEquals("output2",viewRoot.getChildren().get(1).getId());
- Assertions.assertEquals("form1",viewRoot.getChildren().get(2).getId());
+ assertEquals("output1",viewRoot.getChildren().get(0).getId());
+ assertEquals("output2",viewRoot.getChildren().get(1).getId());
+ assertEquals("form1",viewRoot.getChildren().get(2).getId());
component = viewRoot.getChildren().remove( 0 );
viewRoot.getChildren().add( component );
viewRoot = saveAndRestore(stateManagement, viewRoot);
- Assertions.assertEquals("output2",viewRoot.getChildren().get(0).getId());
- Assertions.assertEquals("form1",viewRoot.getChildren().get(1).getId());
- Assertions.assertEquals("output1",viewRoot.getChildren().get(2).getId());
+ assertEquals("output2",viewRoot.getChildren().get(0).getId());
+ assertEquals("form1",viewRoot.getChildren().get(1).getId());
+ assertEquals("output1",viewRoot.getChildren().get(2).getId());
component = viewRoot.getChildren().remove( 0 );
viewRoot.getChildren().add( component );
viewRoot = saveAndRestore(stateManagement, viewRoot);
- Assertions.assertEquals("form1",viewRoot.getChildren().get(0).getId());
- Assertions.assertEquals("output1",viewRoot.getChildren().get(1).getId());
- Assertions.assertEquals("output2",viewRoot.getChildren().get(2).getId());
+ assertEquals("form1",viewRoot.getChildren().get(0).getId());
+ assertEquals("output1",viewRoot.getChildren().get(1).getId());
+ assertEquals("output2",viewRoot.getChildren().get(2).getId());
component = viewRoot.getChildren().remove( 0 );
viewRoot.getChildren().add( component );
viewRoot = saveAndRestore(stateManagement, viewRoot);
- Assertions.assertEquals("output1",viewRoot.getChildren().get(0).getId());
- Assertions.assertEquals("output2",viewRoot.getChildren().get(1).getId());
- Assertions.assertEquals("form1",viewRoot.getChildren().get(2).getId());
+ assertEquals("output1",viewRoot.getChildren().get(0).getId());
+ assertEquals("output2",viewRoot.getChildren().get(1).getId());
+ assertEquals("form1",viewRoot.getChildren().get(2).getId());
- Assertions.assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
- Assertions.assertNotNull(viewRoot.findComponent("form1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:foo1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:var1"));
- Assertions.assertNotNull(viewRoot.findComponent("form1:button1"));
+ assertEquals("somevalue", viewRoot.getAttributes().get("somekey"));
+ assertNotNull(viewRoot.findComponent("form1"));
+ assertNotNull(viewRoot.findComponent("form1:foo1"));
+ assertNotNull(viewRoot.findComponent("form1:var1"));
+ assertNotNull(viewRoot.findComponent("form1:button1"));
a = (HtmlOutputText) viewRoot.findComponent("output1");
- Assertions.assertNotNull(a);
- Assertions.assertEquals("testOutput1",a.getValue());
+ assertNotNull(a);
+ assertEquals("testOutput1",a.getValue());
}
public UIViewRoot saveAndRestore(StateManagementStrategy stateManagement, UIViewRoot viewRoot)
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsClientSideTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsClientSideTest.java
index c7d3c89d7d..89550ac400 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsClientSideTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsClientSideTest.java
@@ -42,15 +42,15 @@ protected void setUpServletContextAndSession() throws Exception
}
@Override
- public void testWriteAndRestoreState() throws Exception
+ void writeAndRestoreState() throws Exception
{
- super.testWriteAndRestoreState();
+ super.writeAndRestoreState();
}
@Override
- public void testWriteAndRestoreStateWithMyFacesRSM() throws Exception
+ void writeAndRestoreStateWithMyFacesRSM() throws Exception
{
- super.testWriteAndRestoreStateWithMyFacesRSM();
+ super.writeAndRestoreStateWithMyFacesRSM();
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsTest.java
index d2e8322923..406daeac11 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import jakarta.faces.application.StateManager;
import jakarta.faces.application.ViewHandler;
import jakarta.faces.component.UIViewRoot;
@@ -32,7 +34,6 @@
import org.apache.myfaces.spi.impl.DefaultSerialFactory;
import org.apache.myfaces.test.mock.MockFacesContext20;
import org.apache.myfaces.test.mock.MockRenderKit;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class StateManagerWithFaceletsTest extends AbstractFaceletMultipleRequestsTestCase
@@ -55,7 +56,7 @@ protected void setUpServletContextAndSession() throws Exception
}
@Test
- public void testWriteAndRestoreState() throws Exception
+ void writeAndRestoreState() throws Exception
{
String viewId = "/simpleTree.xhtml";
@@ -95,16 +96,16 @@ public void testWriteAndRestoreState() throws Exception
UIViewRoot restoredViewRoot = sms.restoreView(facesContext, viewId, RenderKitFactory.HTML_BASIC_RENDER_KIT);
- Assertions.assertNotNull(restoredViewRoot);
+ assertNotNull(restoredViewRoot);
}
finally
{
tearDownRequest();
}
}
-
+
@Test
- public void testWriteAndRestoreStateWithMyFacesRSM() throws Exception
+ void writeAndRestoreStateWithMyFacesRSM() throws Exception
{
String viewId = "/simpleTree.xhtml";
String viewStateParam = null;
@@ -148,7 +149,7 @@ public void testWriteAndRestoreStateWithMyFacesRSM() throws Exception
UIViewRoot restoredViewRoot = sms.restoreView(facesContext, viewId, RenderKitFactory.HTML_BASIC_RENDER_KIT);
- Assertions.assertNotNull(restoredViewRoot);
+ assertNotNull(restoredViewRoot);
}
finally
{
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/TagTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/TagTestCase.java
index e331b7776b..6c9460de39 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/TagTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/TagTestCase.java
@@ -28,7 +28,7 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.junit.jupiter.api.Test;
-public class TagTestCase extends AbstractFaceletTestCase {
+class TagTestCase extends AbstractFaceletTestCase {
@Override
protected void setupComponents() throws Exception
@@ -51,9 +51,9 @@ protected void setupRenderers() throws Exception
renderKit.addRenderer(UIOutput.COMPONENT_FAMILY,
"jakarta.faces.Text", new HtmlTextRenderer());
}
-
+
@Test
- public void testTagBody() throws Exception {
+ void tagBody() throws Exception {
request.setAttribute("name", "Mr. Hookom");
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"userTag.xhtml");
@@ -65,7 +65,7 @@ public void testTagBody() throws Exception {
}
@Test
- public void testConditionalInsert() throws Exception {
+ void conditionalInsert() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"userTagConditional.xhtml");
FastWriter fw = new FastWriter();
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateClientTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateClientTestCase.java
index 530c8abf13..6bd0043f74 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateClientTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateClientTestCase.java
@@ -24,7 +24,7 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.junit.jupiter.api.Test;
-public class TemplateClientTestCase extends AbstractFaceletTestCase {
+class TemplateClientTestCase extends AbstractFaceletTestCase {
@Override
protected void setupComponents() throws Exception
@@ -42,9 +42,9 @@ protected void setupConvertersAndValidators() throws Exception
protected void setupRenderers() throws Exception
{
}
-
+
@Test
- public void testClientClient() throws Exception {
+ void clientClient() throws Exception {
request.setAttribute("name", "Mr. Hookom");
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"template-client-client.xhtml");
@@ -54,9 +54,9 @@ public void testClientClient() throws Exception {
root.encodeAll(facesContext);
//System.out.println(fw);
}
-
+
@Test
- public void testLayoutClient() throws Exception
+ void layoutClient() throws Exception
{
request.setAttribute("name", "Mr. Hookom");
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateInResourcesDirTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateInResourcesDirTestCase.java
index 707edf9b1c..cc63fac2f8 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateInResourcesDirTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateInResourcesDirTestCase.java
@@ -18,11 +18,12 @@
*/
package org.apache.myfaces.view.facelets;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.el.ExpressionFactory;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.test.core.AbstractMyFacesRequestTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -31,7 +32,7 @@
* @author Jay Sartoris
*/
-public class TemplateInResourcesDirTestCase extends AbstractMyFacesCDIRequestTestCase
+class TemplateInResourcesDirTestCase extends AbstractMyFacesCDIRequestTestCase
{
@Override
protected void setUpWebConfigParams() throws Exception
@@ -43,16 +44,16 @@ protected void setUpWebConfigParams() throws Exception
protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
- }
-
+ }
+
@Test
- public void testFaceletWithTemplateInResourcesDir() throws Exception
+ void faceletWithTemplateInResourcesDir() throws Exception
{
startViewRequest("/templateInResourcesDir.xhtml");
processLifecycleExecuteAndRender();
String text = getRenderedContent(facesContext);
- Assertions.assertTrue(text.contains("This template is working as expected!"));
+ assertTrue(text.contains("This template is working as expected!"));
endRequest();
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/CompressSpacesTextUnitTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/CompressSpacesTextUnitTestCase.java
index f5350b3722..d65b598aed 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/CompressSpacesTextUnitTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/CompressSpacesTextUnitTestCase.java
@@ -18,12 +18,13 @@
*/
package org.apache.myfaces.view.facelets.compiler;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.ArrayList;
import java.util.List;
import jakarta.faces.context.ResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.util.lang.FastWriter;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -32,9 +33,9 @@
*/
public class CompressSpacesTextUnitTestCase extends AbstractFaceletTestCase
{
-
+
@Test
- public void testSimpleCompress1() throws Exception {
+ void simpleCompress1() throws Exception {
List instructions = new ArrayList();
@@ -61,12 +62,12 @@ public void testSimpleCompress1() throws Exception {
{
i.write(facesContext);
}
-
- Assertions.assertEquals(fw.toString(), " hello
|
");
+
+ assertEquals(" hello
|
", fw.toString());
}
@Test
- public void testSimpleCompress2() throws Exception {
+ void simpleCompress2() throws Exception {
List instructions = new ArrayList();
@@ -86,13 +87,13 @@ public void testSimpleCompress2() throws Exception {
{
i.write(facesContext);
}
-
- Assertions.assertEquals(fw.toString(), " hello
");
+
+ assertEquals(" hello
", fw.toString());
}
@Test
- public void testSimpleCompress3() throws Exception {
+ void simpleCompress3() throws Exception {
List instructions = new ArrayList();
@@ -119,12 +120,12 @@ public void testSimpleCompress3() throws Exception {
{
i.write(facesContext);
}
-
- Assertions.assertEquals(fw.toString(), " hello
|
\n");
+
+ assertEquals(" hello
|
\n", fw.toString());
}
-
+
@Test
- public void testSimpleCompress4() throws Exception {
+ void simpleCompress4() throws Exception {
List instructions = new ArrayList();
@@ -142,13 +143,13 @@ public void testSimpleCompress4() throws Exception {
{
i.write(facesContext);
}
-
- Assertions.assertEquals(fw.toString(), "\n");
+
+ assertEquals("\n", fw.toString());
}
@Test
- public void testSimpleCompress4_1() throws Exception {
+ void simpleCompress41() throws Exception {
List instructions = new ArrayList();
@@ -166,13 +167,13 @@ public void testSimpleCompress4_1() throws Exception {
{
i.write(facesContext);
}
-
- Assertions.assertEquals(fw.toString(), "\r\n");
- }
-
+ assertEquals("\r\n", fw.toString());
+
+ }
+
@Test
- public void testSimpleCompress5() throws Exception {
+ void simpleCompress5() throws Exception {
List instructions = new ArrayList();
@@ -190,13 +191,13 @@ public void testSimpleCompress5() throws Exception {
{
i.write(facesContext);
}
-
- Assertions.assertEquals(fw.toString(), " \n");
+
+ assertEquals(" \n", fw.toString());
}
-
+
@Test
- public void testSimpleCompress6() throws Exception {
+ void simpleCompress6() throws Exception {
List instructions = new ArrayList();
@@ -224,20 +225,20 @@ public void testSimpleCompress6() throws Exception {
i.write(facesContext);
}
- Assertions.assertEquals(fw.toString(), "\r\n ");
}
@Test
- public void testCompressOnELExpressions() throws Exception
+ void compressOnELExpressions() throws Exception
{
- Assertions.assertEquals(tryCompress("#{bean.name}"), "#{bean.name}");
- Assertions.assertEquals(tryCompress(" #{bean.name}"), " #{bean.name}");
- Assertions.assertEquals(tryCompress("#{bean.name} "), "#{bean.name} ");
+ assertEquals("#{bean.name}", tryCompress("#{bean.name}"));
+ assertEquals(" #{bean.name}", tryCompress(" #{bean.name}"));
+ assertEquals("#{bean.name} ", tryCompress("#{bean.name} "));
String text = tryCompress(" #{bean.name} ");
- Assertions.assertEquals(tryCompress(" #{bean.name} "), " #{bean.name} ");
- Assertions.assertEquals(tryCompress("\n #{bean.name}\n "), "\n#{bean.name}\n");
- Assertions.assertEquals(tryCompress(" \r\n #{bean.name} \r\n "), "\r\n#{bean.name} ");
+ assertEquals(" #{bean.name} ", tryCompress(" #{bean.name} "));
+ assertEquals("\n#{bean.name}\n", tryCompress("\n #{bean.name}\n "));
+ assertEquals("\r\n#{bean.name} ", tryCompress(" \r\n #{bean.name} \r\n "));
}
public String tryCompress(String value)
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/DynamicComponentFaceletTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/DynamicComponentFaceletTestCase.java
index a3f1f305e2..0bbdf1398d 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/DynamicComponentFaceletTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/DynamicComponentFaceletTestCase.java
@@ -29,11 +29,11 @@
*
* @author lu4242
*/
-public class DynamicComponentFaceletTestCase extends AbstractFaceletTestCase
+class DynamicComponentFaceletTestCase extends AbstractFaceletTestCase
{
-
+
@Test
- public void testCompileComponentHandler() throws Exception
+ void compileComponentHandler() throws Exception
{
Map attributes = new HashMap();
attributes.put("value", "hello");
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/ELParserTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/ELParserTestCase.java
index fef1ba66b8..b1f4f2c592 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/ELParserTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/ELParserTestCase.java
@@ -54,10 +54,10 @@ protected void setupRenderers() throws Exception
{
renderKit.addRenderer(UIOutput.COMPONENT_FAMILY,
"jakarta.faces.Text", new HtmlTextRenderer());
- }
-
+ }
+
@Test
- public void testSelectOneMenu() throws Exception {
+ void selectOneMenu() throws Exception {
request.setAttribute("test", this);
UIViewRoot root = facesContext.getViewRoot();
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/HTML5FaceletsProcessingTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/HTML5FaceletsProcessingTestCase.java
index cce44c4efc..5e5a61e280 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/HTML5FaceletsProcessingTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/HTML5FaceletsProcessingTestCase.java
@@ -19,6 +19,8 @@
package org.apache.myfaces.view.facelets.compiler;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.faces.component.UIForm;
@@ -32,8 +34,6 @@
import jakarta.faces.component.html.HtmlPanelGrid;
import jakarta.faces.component.html.HtmlSelectOneMenu;
-import org.junit.jupiter.api.Assertions;
-
import org.apache.myfaces.renderkit.html.HtmlFormRenderer;
import org.apache.myfaces.renderkit.html.HtmlGridRenderer;
import org.apache.myfaces.renderkit.html.HtmlMenuRenderer;
@@ -42,7 +42,7 @@
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.junit.jupiter.api.Test;
-public class HTML5FaceletsProcessingTestCase extends AbstractFaceletTestCase {
+class HTML5FaceletsProcessingTestCase extends AbstractFaceletTestCase {
@Override
protected void setupComponents() throws Exception
@@ -91,7 +91,7 @@ protected void setUpExternalContext() throws Exception
}
@Test
- public void testXHTMLProcessing1() throws Exception
+ void xhtmlProcessing1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testXHTMLProcessing1.xhtml");
@@ -106,13 +106,13 @@ public void testXHTMLProcessing1() throws Exception
String resp = sw.toString();
- Assertions.assertTrue(resp.contains(""));
- Assertions.assertTrue(resp.contains(""));
+ assertTrue(resp.contains(""));
- Assertions.assertTrue(resp.contains(""));
+ assertTrue(resp.contains(" as HTML5 is default
- Assertions.assertEquals(null, ((AbstractFacelet) f).getDoctype().getPublic());
- Assertions.assertEquals(null, ((AbstractFacelet) f).getDoctype().getSystem());
+ assertNull(((AbstractFacelet) f).getDoctype().getPublic());
+ assertNull(((AbstractFacelet) f).getDoctype().getSystem());
}
-
+
@Test
- public void testHtml5() throws Exception
+ void html5() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "html5.xhtml");
- Assertions.assertNotNull(root.getDoctype());
- Assertions.assertEquals("html", root.getDoctype().getRootElement());
- Assertions.assertEquals(null, root.getDoctype().getPublic());
- Assertions.assertEquals(null, root.getDoctype().getSystem());
+ assertNotNull(root.getDoctype());
+ assertEquals("html", root.getDoctype().getRootElement());
+ assertNull(root.getDoctype().getPublic());
+ assertNull(root.getDoctype().getSystem());
}
-
+
@Test
- public void testXhtml() throws Exception
+ void xhtml() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "xhtml.xhtml");
- Assertions.assertNotNull(root.getDoctype());
- Assertions.assertEquals("html", root.getDoctype().getRootElement());
+ assertNotNull(root.getDoctype());
+ assertEquals("html", root.getDoctype().getRootElement());
// MYFACES-4681 - Simplified to as HTML5 is default
- Assertions.assertEquals(null, root.getDoctype().getPublic());
- Assertions.assertEquals(null, root.getDoctype().getSystem());
+ assertNull(root.getDoctype().getPublic());
+ assertNull(root.getDoctype().getSystem());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/component/UIRepeatResetSaveStateModeTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/component/UIRepeatResetSaveStateModeTest.java
index 2a8f742efe..4ab331eb6d 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/component/UIRepeatResetSaveStateModeTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/component/UIRepeatResetSaveStateModeTest.java
@@ -18,11 +18,13 @@
*/
package org.apache.myfaces.view.facelets.component;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.Map;
import jakarta.faces.event.PhaseId;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.apache.myfaces.view.facelets.ViewPoolProcessor;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -31,7 +33,7 @@
* the delta state, a hard reset clears all state (see {@link ViewPoolProcessor#RESET_MODE_SOFT} and
* {@link ViewPoolProcessor#RESET_MODE_HARD}). UIRepeat must do the same as UIData with its per-row state.
*/
-public class UIRepeatResetSaveStateModeTest extends AbstractFacesTestCase
+class UIRepeatResetSaveStateModeTest extends AbstractFacesTestCase
{
private UIRepeat repeat;
@@ -50,24 +52,24 @@ public void setUp() throws Exception
}
@Test
- public void testSoftResetKeepsDeltaState()
+ void softResetKeepsDeltaState()
{
facesContext.getViewRoot().getAttributes().put(ViewPoolProcessor.RESET_SAVE_STATE_MODE_KEY,
ViewPoolProcessor.RESET_MODE_SOFT);
repeat.saveState(facesContext);
- Assertions.assertEquals(Map.of("repeat:0:in", "delta"), repeat._rowDeltaStates.get("repeat:0"));
- Assertions.assertTrue(repeat._rowTransientStates.isEmpty());
+ assertEquals(Map.of("repeat:0:in", "delta"), repeat._rowDeltaStates.get("repeat:0"));
+ assertTrue(repeat._rowTransientStates.isEmpty());
}
@Test
- public void testHardResetClearsAllState()
+ void hardResetClearsAllState()
{
facesContext.getViewRoot().getAttributes().put(ViewPoolProcessor.RESET_SAVE_STATE_MODE_KEY,
ViewPoolProcessor.RESET_MODE_HARD);
repeat.saveState(facesContext);
- Assertions.assertTrue(repeat._rowDeltaStates.isEmpty());
- Assertions.assertTrue(repeat._rowTransientStates.isEmpty());
+ assertTrue(repeat._rowDeltaStates.isEmpty());
+ assertTrue(repeat._rowTransientStates.isEmpty());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/component/UIRepeatTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/component/UIRepeatTest.java
index 4388644cb1..a4299f5a26 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/component/UIRepeatTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/component/UIRepeatTest.java
@@ -25,11 +25,13 @@
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
+
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -62,7 +64,7 @@ public void setUp() throws Exception
* {@link jakarta.faces.component.UIData#setValueExpression(java.lang.String, jakarta.el.ValueExpression)}.
*/
@Test
- public void testValueExpression()
+ void valueExpression()
{
assertSetValueExpressionException(IllegalArgumentException.class, "rowIndex");
assertSetValueExpressionException(NullPointerException.class, null);
@@ -70,7 +72,7 @@ public void testValueExpression()
private void assertSetValueExpressionException(Class extends Throwable> expected, final String name)
{
- Assertions.assertThrows(expected,
+ assertThrows(expected,
() -> _testImpl.setValueExpression(name, null));
}
@@ -79,7 +81,7 @@ private void assertSetValueExpressionException(Class extends Throwable> expect
* Adapted to use UIRepeat with rowStatePreserved
*/
@Test
- public void testPreserveRowComponentState() throws Exception
+ void preserveRowComponentState() throws Exception
{
List model = new ArrayList();
model.add(new RowData("text1","style1"));
@@ -128,7 +130,7 @@ public void testPreserveRowComponentState() throws Exception
{
RowData rowData = model.get(i);
table.setRowIndex(i);
- Assertions.assertEquals(rowData.getText(), text.getValue());
+ assertEquals(rowData.getText(), text.getValue());
text.getAttributes().put("style", rowData.getStyle());
}
@@ -139,7 +141,7 @@ public void testPreserveRowComponentState() throws Exception
for (int i = 0; i < model.size(); i++)
{
table.setRowIndex(i);
- Assertions.assertEquals(model.get(i).getStyle(), text.getAttributes().get("style"));
+ assertEquals(model.get(i).getStyle(), text.getAttributes().get("style"));
}
}
@@ -156,7 +158,7 @@ public void testPreserveRowComponentState() throws Exception
* @throws Exception
*/
@Test
- public void testSaveAndRestorePortletLifecycleWithoutPss1() throws Exception
+ void saveAndRestorePortletLifecycleWithoutPss1() throws Exception
{
List model = new ArrayList();
model.add(new RowData("text1","style1"));
@@ -180,7 +182,7 @@ public void testSaveAndRestorePortletLifecycleWithoutPss1() throws Exception
{
RowData rowData = model.get(i);
table.setRowIndex(i);
- Assertions.assertEquals(rowData.getText(), text.getValue());
+ assertEquals(rowData.getText(), text.getValue());
text.setSubmittedValue("value"+(i+1));
//text.getAttributes().put("style", rowData.getStyle());
}
@@ -219,11 +221,11 @@ public void testSaveAndRestorePortletLifecycleWithoutPss1() throws Exception
{
RowData rowData = model.get(i);
table.setRowIndex(i);
- Assertions.assertEquals("value"+(i+1), text.getSubmittedValue());
+ assertEquals("value"+(i+1), text.getSubmittedValue());
//assertEquals(model.get(i).getStyle(), text.getAttributes().get("style"));
}
}
-
+
/**
* A UIRepeat nested inside another UIRepeat keeps its per-row state per enclosing row: the inner repeat's row 0
* in outer row 0 is a different cell from the inner repeat's row 0 in outer row 1. Keying the inner repeat's
@@ -231,7 +233,7 @@ public void testSaveAndRestorePortletLifecycleWithoutPss1() throws Exception
* submitted values of every enclosing row but the last.
*/
@Test
- public void testNestedRepeatRowStateIsScopedPerOuterRow()
+ void nestedRepeatRowStateIsScopedPerOuterRow()
{
UIViewRoot root = facesContext.getViewRoot();
root.setId(root.createUniqueId());
@@ -273,7 +275,7 @@ public void testNestedRepeatRowStateIsScopedPerOuterRow()
for (int innerRow = 0; innerRow < 2; innerRow++)
{
inner.setRowIndex(innerRow);
- Assertions.assertEquals("v" + outerRow + innerRow, input.getSubmittedValue(),
+ assertEquals("v" + outerRow + innerRow, input.getSubmittedValue(),
"outer row " + outerRow + ", inner row " + innerRow
+ " must keep the value submitted into it");
}
@@ -331,7 +333,7 @@ private void createSimpleTable(UIViewRoot root)
* This exercises {@code saveChildStates} / {@code restoreChildStates}.
*/
@Test
- public void testStatefulRowStateIsPreservedOnRevisit()
+ void statefulRowStateIsPreservedOnRevisit()
{
UIViewRoot root = facesContext.getViewRoot();
UIRepeat repeat = createRepeat(root, Arrays.asList("a", "b", "c"));
@@ -354,7 +356,7 @@ public void testStatefulRowStateIsPreservedOnRevisit()
for (int i = 0; i < 3; i++)
{
repeat.setRowIndex(i);
- Assertions.assertEquals("submitted_" + i, input.getSubmittedValue(),
+ assertEquals("submitted_" + i, input.getSubmittedValue(),
"Row " + i + ": submitted value should be restored from Integer row-index-keyed _rowStates");
}
repeat.setRowIndex(-1);
@@ -365,7 +367,7 @@ public void testStatefulRowStateIsPreservedOnRevisit()
* components to their initial (empty) state.
*/
@Test
- public void testStatefulResetToInitialStateAtIndexMinusOne()
+ void statefulResetToInitialStateAtIndexMinusOne()
{
UIViewRoot root = facesContext.getViewRoot();
UIRepeat repeat = createRepeat(root, Arrays.asList("a", "b"));
@@ -383,9 +385,9 @@ public void testStatefulResetToInitialStateAtIndexMinusOne()
// Reset to -1: components must be in their clean template state.
repeat.setRowIndex(-1);
- Assertions.assertNull(input.getSubmittedValue(),
+ assertNull(input.getSubmittedValue(),
"After reset to -1, submitted value must be cleared to initial state");
- Assertions.assertTrue(input.isValid(),
+ assertTrue(input.isValid(),
"After reset to -1, valid flag must be restored to true");
}
@@ -393,7 +395,7 @@ public void testStatefulResetToInitialStateAtIndexMinusOne()
* Multiple UIInput siblings must each have independent per-row state.
*/
@Test
- public void testStatefulMultipleEVHSiblingsHaveIndependentState()
+ void statefulMultipleEVHSiblingsHaveIndependentState()
{
UIViewRoot root = facesContext.getViewRoot();
UIRepeat repeat = createRepeat(root, Arrays.asList("x", "y"));
@@ -419,13 +421,13 @@ public void testStatefulMultipleEVHSiblingsHaveIndependentState()
// Revisit row 0 — both inputs must have their row-0 values.
repeat.setRowIndex(0);
- Assertions.assertEquals("a0", inputA.getSubmittedValue());
- Assertions.assertEquals("b0", inputB.getSubmittedValue());
+ assertEquals("a0", inputA.getSubmittedValue());
+ assertEquals("b0", inputB.getSubmittedValue());
// Revisit row 1 — both inputs must have their row-1 values.
repeat.setRowIndex(1);
- Assertions.assertEquals("a1", inputA.getSubmittedValue());
- Assertions.assertEquals("b1", inputB.getSubmittedValue());
+ assertEquals("a1", inputA.getSubmittedValue());
+ assertEquals("b1", inputB.getSubmittedValue());
}
/**
@@ -433,7 +435,7 @@ public void testStatefulMultipleEVHSiblingsHaveIndependentState()
* {@code _iterationEVHList} (depth-first traversal).
*/
@Test
- public void testStatefulNestedEVHStateIsPreserved()
+ void statefulNestedEVHStateIsPreserved()
{
UIViewRoot root = facesContext.getViewRoot();
UIRepeat repeat = createRepeat(root, Arrays.asList("x", "y"));
@@ -456,11 +458,11 @@ public void testStatefulNestedEVHStateIsPreserved()
repeat.setRowIndex(-1);
repeat.setRowIndex(0);
- Assertions.assertEquals("nested_0", input.getSubmittedValue(),
+ assertEquals("nested_0", input.getSubmittedValue(),
"Nested UIInput row-0 state must be restored");
repeat.setRowIndex(1);
- Assertions.assertEquals("nested_1", input.getSubmittedValue(),
+ assertEquals("nested_1", input.getSubmittedValue(),
"Nested UIInput row-1 state must be restored");
}
@@ -473,7 +475,7 @@ public void testStatefulNestedEVHStateIsPreserved()
* reset clientIds correctly so each row produces unique clientIds.
*/
@Test
- public void testReadOnlyClientIdResetPerRow()
+ void readOnlyClientIdResetPerRow()
{
UIViewRoot root = facesContext.getViewRoot();
UIRepeat repeat = createRepeat(root, Arrays.asList("x", "y", "z"));
@@ -492,13 +494,13 @@ public void testReadOnlyClientIdResetPerRow()
repeat.setRowIndex(2);
String clientId2 = out.getClientId(facesContext);
- Assertions.assertNotEquals(clientId0, clientId1, "ClientIds must differ between rows");
- Assertions.assertNotEquals(clientId1, clientId2, "ClientIds must differ between rows");
+ assertNotEquals(clientId0, clientId1, "ClientIds must differ between rows");
+ assertNotEquals(clientId1, clientId2, "ClientIds must differ between rows");
// After resetting, the IDs must match the first pass.
repeat.setRowIndex(-1);
repeat.setRowIndex(0);
- Assertions.assertEquals(clientId0, out.getClientId(facesContext),
+ assertEquals(clientId0, out.getClientId(facesContext),
"ClientId for row 0 must be stable across iteration sequences");
}
@@ -507,7 +509,7 @@ public void testReadOnlyClientIdResetPerRow()
* state is not saved ({@code _iterationResetList} includes them).
*/
@Test
- public void testReadOnlyTransientComponentClientIdIsReset()
+ void readOnlyTransientComponentClientIdIsReset()
{
UIViewRoot root = facesContext.getViewRoot();
UIRepeat repeat = createRepeat(root, Arrays.asList("x", "y"));
@@ -524,7 +526,7 @@ public void testReadOnlyTransientComponentClientIdIsReset()
repeat.setRowIndex(1);
String id1 = transientOut.getClientId(facesContext);
- Assertions.assertNotEquals(id0, id1,
+ assertNotEquals(id0, id1,
"Transient component clientId must be reset per row");
}
@@ -537,7 +539,7 @@ public void testReadOnlyTransientComponentClientIdIsReset()
* iteration sequence (simulating RENDER_RESPONSE) must still work correctly.
*/
@Test
- public void testIterationListsAreRebuiltAfterEncodeBegin() throws Exception
+ void iterationListsAreRebuiltAfterEncodeBegin() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
root.setRenderKitId("HTML_BASIC");
@@ -563,11 +565,11 @@ public void testIterationListsAreRebuiltAfterEncodeBegin() throws Exception
// Second iteration sequence (simulates RENDER_RESPONSE row walk)
// must still reset clientIds without NPE or stale state
repeat.setRowIndex(0);
- Assertions.assertNull(input.getSubmittedValue(),
+ assertNull(input.getSubmittedValue(),
"After encodeBegin, _rowStates is cleared and initial state is clean");
repeat.setRowIndex(1);
- Assertions.assertNull(input.getSubmittedValue());
+ assertNull(input.getSubmittedValue());
repeat.setRowIndex(-1);
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedNestedTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedNestedTest.java
index b8394b6068..67c4218f62 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedNestedTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedNestedTest.java
@@ -18,10 +18,11 @@
*/
package org.apache.myfaces.view.facelets.component.rowstate;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.List;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.test.mock.MockPrintWriter;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -30,7 +31,7 @@
* nested component for the next row must not change that map in place, otherwise the per-row state of the row before
* is lost. This only shows from the second request with validation errors on.
*/
-public class RowStatePreservedNestedTest extends AbstractMyFacesCDIRequestTestCase
+class RowStatePreservedNestedTest extends AbstractMyFacesCDIRequestTestCase
{
private static final List ROWS = List.of(
"outer:0:inner:0:in", "outer:0:inner:1:in", "outer:1:inner:0:in", "outer:1:inner:1:in",
@@ -45,7 +46,7 @@ protected void setUpWebConfigParams() throws Exception
}
@Test
- public void testNestedTypedValuesSurviveRepeatedValidationFailures() throws Exception
+ void nestedTypedValuesSurviveRepeatedValidationFailures() throws Exception
{
startViewRequest("/rowStatePreservedNested.xhtml");
processLifecycleExecuteAndRender();
@@ -59,7 +60,7 @@ public void testNestedTypedValuesSurviveRepeatedValidationFailures() throws Exce
client.getParameters().put("mainForm:required", "");
client.submit("mainForm:submit");
processLifecycleExecuteAndRender();
- Assertions.assertTrue(facesContext.isValidationFailed());
+ assertTrue(facesContext.isValidationFailed());
String content = new String(((MockPrintWriter) response.getWriter()).content());
for (String row : ROWS)
@@ -73,9 +74,9 @@ public void testNestedTypedValuesSurviveRepeatedValidationFailures() throws Exce
private static void assertRenderedValue(String content, String clientId, String expected, int round)
{
int start = content.indexOf("id=\"" + clientId + "\"");
- Assertions.assertTrue(start >= 0, clientId + " not rendered in: " + content);
+ assertTrue(start >= 0, clientId + " not rendered in: " + content);
String input = content.substring(start, content.indexOf('>', start));
- Assertions.assertTrue(input.contains("value=\"" + expected + "\""),
+ assertTrue(input.contains("value=\"" + expected + "\""),
"request " + round + ": " + clientId + " should render " + expected + " but was: " + input);
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedNewRowTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedNewRowTest.java
index 70efc342b1..63f1d8ced3 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedNewRowTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedNewRowTest.java
@@ -20,15 +20,18 @@
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.test.mock.MockPrintWriter;
-import org.junit.jupiter.api.Assertions;
+
import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* MYFACES-4777 (TCK Issue6128IT): with {@code rowStatePreserved="true"}, a row without saved state of its own, such
* as a row added to the model after the last render, must not show the local value of the row before it. The input is
* created in Java with only an id, so that nothing is in its state helper initially.
*/
-public class RowStatePreservedNewRowTest extends AbstractMyFacesCDIRequestTestCase
+class RowStatePreservedNewRowTest extends AbstractMyFacesCDIRequestTestCase
{
@Override
protected void setUpWebConfigParams() throws Exception
@@ -39,7 +42,7 @@ protected void setUpWebConfigParams() throws Exception
}
@Test
- public void testNewRowDoesNotShowLocalValueOfRowBefore() throws Exception
+ void newRowDoesNotShowLocalValueOfRowBefore() throws Exception
{
startViewRequest("/rowStatePreservedNewRow.xhtml");
processLifecycleExecuteAndRender();
@@ -52,20 +55,20 @@ public void testNewRowDoesNotShowLocalValueOfRowBefore() throws Exception
processLifecycleExecuteAndRender();
String content = content();
- Assertions.assertTrue(renderedInput(content, "form:table:1:in").contains("value=\"typed\""), content);
- Assertions.assertTrue(renderedInput(content, "form:repeat:1:in").contains("value=\"typed\""), content);
+ assertTrue(renderedInput(content, "form:table:1:in").contains("value=\"typed\""), content);
+ assertTrue(renderedInput(content, "form:repeat:1:in").contains("value=\"typed\""), content);
client.ajax("form:addRow", "action", "form:addRow", "form", true);
processLifecycleExecuteAndRender();
content = content();
- Assertions.assertTrue(renderedInput(content, "form:table:1:in").contains("value=\"typed\""), content);
- Assertions.assertTrue(renderedInput(content, "form:repeat:1:in").contains("value=\"typed\""), content);
+ assertTrue(renderedInput(content, "form:table:1:in").contains("value=\"typed\""), content);
+ assertTrue(renderedInput(content, "form:repeat:1:in").contains("value=\"typed\""), content);
String tableRow2 = renderedInput(content, "form:table:2:in");
- Assertions.assertFalse(tableRow2.contains("typed"), "new table row shows the value of the row before: "
+ assertFalse(tableRow2.contains("typed"), "new table row shows the value of the row before: "
+ tableRow2);
String repeatRow2 = renderedInput(content, "form:repeat:2:in");
- Assertions.assertFalse(repeatRow2.contains("typed"), "new repeat row shows the value of the row before: "
+ assertFalse(repeatRow2.contains("typed"), "new repeat row shows the value of the row before: "
+ repeatRow2);
endRequest();
}
@@ -78,7 +81,7 @@ private String content() throws Exception
private static String renderedInput(String content, String clientId)
{
int start = content.indexOf("id=\"" + clientId + "\"");
- Assertions.assertTrue(start >= 0, clientId + " not rendered in: " + content);
+ assertTrue(start >= 0, clientId + " not rendered in: " + content);
return content.substring(start, content.indexOf('>', start));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedUpdateModelTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedUpdateModelTest.java
index 7c790c7005..21a0366d6f 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedUpdateModelTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStatePreservedUpdateModelTest.java
@@ -18,10 +18,12 @@
*/
package org.apache.myfaces.view.facelets.component.rowstate;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.List;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.test.mock.MockPrintWriter;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -29,7 +31,7 @@
* {@code rowStatePreserved="true"}, the saved state of a row must not keep the local value of its inputs after Update
* Model Values cleared it, otherwise that stale local value hides every later change of the model in that row.
*/
-public class RowStatePreservedUpdateModelTest extends AbstractMyFacesCDIRequestTestCase
+class RowStatePreservedUpdateModelTest extends AbstractMyFacesCDIRequestTestCase
{
private static final List INPUTS = List.of(
"form:preserved:0:in", "form:preserved:1:in",
@@ -45,7 +47,7 @@ protected void setUpWebConfigParams() throws Exception
}
@Test
- public void testRowStatePreservedDoesNotKeepLocalValueAfterUpdateModel() throws Exception
+ void rowStatePreservedDoesNotKeepLocalValueAfterUpdateModel() throws Exception
{
startViewRequest("/rowStatePreservedUpdateModel.xhtml");
processLifecycleExecuteAndRender();
@@ -57,7 +59,7 @@ public void testRowStatePreservedDoesNotKeepLocalValueAfterUpdateModel() throws
client.submit("form:submit");
processLifecycleExecuteAndRender();
- Assertions.assertFalse(facesContext.isValidationFailed());
+ assertFalse(facesContext.isValidationFailed());
String content = content();
for (String input : INPUTS)
{
@@ -83,9 +85,9 @@ private String content() throws Exception
private static void assertRenderedValue(String content, String clientId, String expected)
{
int start = content.indexOf("id=\"" + clientId + "\"");
- Assertions.assertTrue(start >= 0, clientId + " not rendered in: " + content);
+ assertTrue(start >= 0, clientId + " not rendered in: " + content);
String input = content.substring(start, content.indexOf('>', start));
- Assertions.assertTrue(input.contains("value=\"" + expected + "\""),
+ assertTrue(input.contains("value=\"" + expected + "\""),
clientId + " should render " + expected + " but was: " + input);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStateRerenderTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStateRerenderTest.java
index 8446d9f9c3..5a2206e4d7 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStateRerenderTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStateRerenderTest.java
@@ -18,10 +18,11 @@
*/
package org.apache.myfaces.view.facelets.component.rowstate;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.List;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.test.mock.MockPrintWriter;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -47,7 +48,7 @@ protected void setUpWebConfigParams() throws Exception
}
@Test
- public void testRefreshWithoutMessagesRendersModelValues() throws Exception
+ void refreshWithoutMessagesRendersModelValues() throws Exception
{
submitTypedValuesWithValidationError();
client.ajax("mainForm:refresh", "action", "mainForm:refresh", "mainForm", true);
@@ -57,7 +58,7 @@ public void testRefreshWithoutMessagesRendersModelValues() throws Exception
}
@Test
- public void testRefreshWithInfoRendersModelValues() throws Exception
+ void refreshWithInfoRendersModelValues() throws Exception
{
submitTypedValuesWithValidationError();
client.ajax("mainForm:refreshWithInfo", "action", "mainForm:refreshWithInfo", "mainForm", true);
@@ -67,7 +68,7 @@ public void testRefreshWithInfoRendersModelValues() throws Exception
}
@Test
- public void testRefreshWithErrorsRendersTypedValues() throws Exception
+ void refreshWithErrorsRendersTypedValues() throws Exception
{
submitTypedValuesWithValidationError();
client.getParameters().put("mainForm:required", "");
@@ -78,7 +79,7 @@ public void testRefreshWithErrorsRendersTypedValues() throws Exception
}
@Test
- public void testRefreshWithFatalRendersTypedValues() throws Exception
+ void refreshWithFatalRendersTypedValues() throws Exception
{
submitTypedValuesWithValidationError();
client.ajax("mainForm:refreshWithFatal", "action", "mainForm:refreshWithFatal", "mainForm", true);
@@ -88,7 +89,7 @@ public void testRefreshWithFatalRendersTypedValues() throws Exception
}
@Test
- public void testRefreshWithErrorsTwiceThenWithoutMessages() throws Exception
+ void refreshWithErrorsTwiceThenWithoutMessages() throws Exception
{
submitTypedValuesWithValidationError();
@@ -122,7 +123,7 @@ private void submitTypedValuesWithValidationError() throws Exception
client.submit("mainForm:submit");
processLifecycleExecuteAndRender();
- Assertions.assertTrue(facesContext.isValidationFailed());
+ assertTrue(facesContext.isValidationFailed());
assertRenderedValues(true);
}
@@ -139,7 +140,7 @@ private void assertRenderedValues(boolean typed) throws Exception
String row = ROWS.get(i);
String expected = typed ? typed(row) : model[i];
String input = renderedInput(content, "mainForm:" + row);
- Assertions.assertTrue(input.contains("value=\"" + expected + "\""),
+ assertTrue(input.contains("value=\"" + expected + "\""),
"mainForm:" + row + " should render " + expected + " but was: " + input);
}
}
@@ -147,7 +148,7 @@ private void assertRenderedValues(boolean typed) throws Exception
private static String renderedInput(String content, String clientId)
{
int start = content.indexOf("id=\"" + clientId + "\"");
- Assertions.assertTrue(start >= 0, clientId + " not rendered in: " + content);
+ assertTrue(start >= 0, clientId + " not rendered in: " + content);
return content.substring(start, content.indexOf('>', start));
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStateSharedSavedStateTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStateSharedSavedStateTest.java
index 61510f1573..37bd1ec3b9 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStateSharedSavedStateTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/component/rowstate/RowStateSharedSavedStateTest.java
@@ -18,11 +18,13 @@
*/
package org.apache.myfaces.view.facelets.component.rowstate;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.faces.render.ResponseStateManager;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.test.core.mock.MockMyFacesClient;
import org.apache.myfaces.test.mock.MockPrintWriter;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -62,7 +64,7 @@ protected void applyStateFromPreviousRequest()
}
@Test
- public void testSecondRestoreOfSavedStateDoesNotSeeChangesOfFirstRestore() throws Exception
+ void secondRestoreOfSavedStateDoesNotSeeChangesOfFirstRestore() throws Exception
{
startViewRequest("/rowStateSharedSavedState.xhtml");
processLifecycleExecuteAndRender();
@@ -71,7 +73,7 @@ public void testSecondRestoreOfSavedStateDoesNotSeeChangesOfFirstRestore() throw
putRows("first", "one");
client.submit("form:submit");
processLifecycleExecuteAndRender();
- Assertions.assertFalse(facesContext.getMessageList().isEmpty(), "required input should fail");
+ assertFalse(facesContext.getMessageList().isEmpty(), "required input should fail");
assertRows("first", "one");
String viewStateOfStep1 = renderedViewState();
@@ -79,7 +81,7 @@ public void testSecondRestoreOfSavedStateDoesNotSeeChangesOfFirstRestore() throw
putRows("first", "second");
client.submit("form:submit");
processLifecycleExecuteAndRender();
- Assertions.assertFalse(facesContext.getMessageList().isEmpty(), "required input should fail");
+ assertFalse(facesContext.getMessageList().isEmpty(), "required input should fail");
assertRows("first", "second");
// step 3: restore the view state of step 1 again, as the back button or a second tab would do
@@ -87,7 +89,7 @@ public void testSecondRestoreOfSavedStateDoesNotSeeChangesOfFirstRestore() throw
client.getParameters().put("form:required", "");
client.ajax("form:refresh", "action", "form:required", "form", true);
processLifecycleExecuteAndRender();
- Assertions.assertFalse(facesContext.getMessageList().isEmpty(), "required input should fail");
+ assertFalse(facesContext.getMessageList().isEmpty(), "required input should fail");
assertRows("first", "one");
endRequest();
}
@@ -117,7 +119,7 @@ private String renderedViewState() throws Exception
{
String content = new String(((MockPrintWriter) response.getWriter()).content());
int start = content.indexOf("name=\"" + ResponseStateManager.VIEW_STATE_PARAM + "\"");
- Assertions.assertTrue(start >= 0, "view state not rendered in: " + content);
+ assertTrue(start >= 0, "view state not rendered in: " + content);
String field = content.substring(start, content.indexOf('>', start));
int valueStart = field.indexOf("value=\"") + "value=\"".length();
return field.substring(valueStart, field.indexOf('"', valueStart));
@@ -126,9 +128,9 @@ private String renderedViewState() throws Exception
private static void assertRenderedValue(String content, String clientId, String expected)
{
int start = content.indexOf("id=\"" + clientId + "\"");
- Assertions.assertTrue(start >= 0, clientId + " not rendered in: " + content);
+ assertTrue(start >= 0, clientId + " not rendered in: " + content);
String input = content.substring(start, content.indexOf('>', start));
- Assertions.assertTrue(input.contains("value=\"" + expected + "\""),
+ assertTrue(input.contains("value=\"" + expected + "\""),
clientId + " should render " + expected + " but was: " + input);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/el/CacheELExpressionsAlwaysRecompileTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/el/CacheELExpressionsAlwaysRecompileTestCase.java
index fca0a6a89d..6a64bc4aad 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/el/CacheELExpressionsAlwaysRecompileTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/el/CacheELExpressionsAlwaysRecompileTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.el;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.el.ExpressionFactory;
import jakarta.faces.application.ViewHandler;
@@ -27,14 +29,13 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.ELExpressionCacheMode;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
*
* @author lu4242
*/
-public class CacheELExpressionsAlwaysRecompileTestCase extends AbstractFaceletTestCase
+class CacheELExpressionsAlwaysRecompileTestCase extends AbstractFaceletTestCase
{
@Override
protected void setUpServletObjects() throws Exception
@@ -51,9 +52,9 @@ protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
}
-
+
@Test
- public void testUIParamCaching1() throws Exception
+ void uIParamCaching1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "uiparamcache1.xhtml");
@@ -64,14 +65,14 @@ public void testUIParamCaching1() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
-
+
@Test
- public void testUserTagCaching1() throws Exception
+ void userTagCaching1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "usertagtest1.xhtml");
@@ -82,14 +83,14 @@ public void testUserTagCaching1() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
@Test
- public void testUIParamIncludeCaching1() throws Exception
+ void uIParamIncludeCaching1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "includetagtest1.xhtml");
@@ -100,9 +101,9 @@ public void testUIParamIncludeCaching1() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/el/CacheELExpressionsTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/el/CacheELExpressionsTestCase.java
index 5ce7bb1c98..133720984a 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/el/CacheELExpressionsTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/el/CacheELExpressionsTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.el;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.el.ExpressionFactory;
import jakarta.faces.component.UIViewRoot;
@@ -26,23 +28,22 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.ELExpressionCacheMode;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
*
* @author lu4242
*/
-public class CacheELExpressionsTestCase extends AbstractFaceletTestCase
+class CacheELExpressionsTestCase extends AbstractFaceletTestCase
{
@Override
protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
}
-
+
@Test
- public void testUIParamCaching1() throws Exception
+ void uIParamCaching1() throws Exception
{
// Works in "none", "allowCset", and "strict" but it does not in always.
servletContext.addInitParameter(MyfacesConfig.CACHE_EL_EXPRESSIONS,
@@ -57,14 +58,14 @@ public void testUIParamCaching1() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
-
+
@Test
- public void testUIParamCaching2() throws Exception
+ void uIParamCaching2() throws Exception
{
// Works in "none", "allowCset", and "strict" but it does not in always.
servletContext.addInitParameter(MyfacesConfig.CACHE_EL_EXPRESSIONS,
@@ -79,10 +80,10 @@ public void testUIParamCaching2() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtilsTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtilsTestCase.java
index 05d87254d0..fd1bbfe4ec 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtilsTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtilsTestCase.java
@@ -18,16 +18,18 @@
*/
package org.apache.myfaces.view.facelets.el;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.el.ExpressionFactory;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
*
* @author Leonardo Uribe
*/
-public class CompositeComponentELUtilsTestCase extends AbstractFaceletTestCase
+class CompositeComponentELUtilsTestCase extends AbstractFaceletTestCase
{
@Override
@@ -35,35 +37,35 @@ protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
}
-
+
@Test
- public void test_cc_attrs_method_expression1() throws Exception
+ void cc_attrs_method_expression1() throws Exception
{
- Assertions.assertTrue(
+ assertTrue(
CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(
"#{cc.attrs.someProp}"));
- Assertions.assertTrue(
+ assertTrue(
CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(
"#{ cc.attrs.someProp}"));
- Assertions.assertFalse(
+ assertFalse(
CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(
"#{cc.attrs.someProp.someKey}"));
- Assertions.assertFalse(
+ assertFalse(
CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(
"#{xy:call(cc.attrs.someProp)}"));
- Assertions.assertFalse(
+ assertFalse(
CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(
"#{xy:call( cc.attrs.someProp)}"));
- Assertions.assertFalse(
+ assertFalse(
CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(
"#{xy:call(zz, cc.attrs.someProp)}"));
- Assertions.assertFalse(
+ assertFalse(
CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(
"#{xy:call(zz,cc.attrs.someProp)}"));
- Assertions.assertTrue(
+ assertTrue(
CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(
"#{cc.attrs.method(someProp)}"));
- Assertions.assertTrue(
+ assertTrue(
CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(
"#{cc.attrs.method( someProp, someAttr )}"));
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/el/ELTextTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/el/ELTextTest.java
index c4b0473dd5..e298e6523f 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/el/ELTextTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/el/ELTextTest.java
@@ -18,64 +18,65 @@
*/
package org.apache.myfaces.view.facelets.el;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.el.ExpressionFactory;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class ELTextTest {
-
+class ELTextTest {
+
@Test
- public void parseLiteral()
+ void parseLiteral()
{
ExpressionFactory expressionFactory = new org.apache.el.ExpressionFactoryImpl();
ELText elText = ELText.parse(expressionFactory, null, "blub", null);
- Assertions.assertEquals("blub", elText.toString());
+ assertEquals("blub", elText.toString());
elText = ELText.parse(expressionFactory, null, "", null);
- Assertions.assertEquals(null, elText);
+ assertNull(elText);
}
@Test
- public void parseValueExpressionAndLiteral()
+ void parseValueExpressionAndLiteral()
{
ExpressionFactory expressionFactory = new org.apache.el.ExpressionFactoryImpl();
ELText elText = ELText.parse(expressionFactory, null, "#{myblub.blub} blub", null);
- Assertions.assertTrue(elText instanceof ELText.ELTextComposite);
- Assertions.assertEquals(2, ((ELText.ELTextComposite) elText).getElements().length);
- Assertions.assertEquals(" blub", ((ELText.ELTextComposite) elText).getElements()[1].toString());
+ assertInstanceOf(ELText.ELTextComposite.class, elText);
+ assertEquals(2, ((ELText.ELTextComposite) elText).getElements().length);
+ assertEquals(" blub", ((ELText.ELTextComposite) elText).getElements()[1].toString());
elText = ELText.parse(expressionFactory, null, "#{myblub.blub} blub #{myblub.blub}", null);
- Assertions.assertTrue(elText instanceof ELText.ELTextComposite);
- Assertions.assertEquals(3, ((ELText.ELTextComposite) elText).getElements().length);
- Assertions.assertEquals(" blub ", ((ELText.ELTextComposite) elText).getElements()[1].toString());
+ assertInstanceOf(ELText.ELTextComposite.class, elText);
+ assertEquals(3, ((ELText.ELTextComposite) elText).getElements().length);
+ assertEquals(" blub ", ((ELText.ELTextComposite) elText).getElements()[1].toString());
}
@Test
- public void parseAsArrayLiteral()
+ void parseAsArrayLiteral()
{
ExpressionFactory expressionFactory = new org.apache.el.ExpressionFactoryImpl();
ELText[] elText = ELText.parseAsArray(expressionFactory, null, "blub", null);
- Assertions.assertEquals("blub", elText[0].toString());
+ assertEquals("blub", elText[0].toString());
elText = ELText.parseAsArray(expressionFactory, null, "", null);
- Assertions.assertTrue(elText == null);
+ assertNull(elText);
}
@Test
- public void parseAsArrayValueExpressionAndLiteral()
+ void parseAsArrayValueExpressionAndLiteral()
{
ExpressionFactory expressionFactory = new org.apache.el.ExpressionFactoryImpl();
ELText[] elText = ELText.parseAsArray(expressionFactory, null, "#{myblub.blub} blub", null);
- Assertions.assertEquals(2, elText.length);
- Assertions.assertEquals(" blub", elText[1].toString());
+ assertEquals(2, elText.length);
+ assertEquals(" blub", elText[1].toString());
elText = ELText.parseAsArray(expressionFactory, null, "#{myblub.blub} blub #{myblub.blub}", null);
- Assertions.assertEquals(3, elText.length);
- Assertions.assertEquals(" blub ", elText[1].toString());
+ assertEquals(3, elText.length);
+ assertEquals(" blub ", elText[1].toString());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/el/SerializableELExpressionsTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/el/SerializableELExpressionsTestCase.java
index fcfe167f3a..1566045897 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/el/SerializableELExpressionsTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/el/SerializableELExpressionsTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.el;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
@@ -29,10 +31,9 @@
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.view.facelets.tag.TagAttributeImpl;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class SerializableELExpressionsTestCase extends AbstractFaceletTestCase
+class SerializableELExpressionsTestCase extends AbstractFaceletTestCase
{
@Override
@@ -40,9 +41,9 @@ protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
}
-
+
@Test
- public void testSerializeLocationValueExpressionWrapper() throws Exception
+ void serializeLocationValueExpressionWrapper() throws Exception
{
ValueExpression ve = facesContext.getApplication().getExpressionFactory().createValueExpression(
facesContext.getELContext(), "#{cc.attrs.value}", Object.class);
@@ -61,16 +62,16 @@ public void testSerializeLocationValueExpressionWrapper() throws Exception
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bais);
LocationValueExpression lve2 = (LocationValueExpression) ois.readObject();
- Assertions.assertEquals(lve.getExpressionString(), lve2.getExpressionString());
- Assertions.assertEquals(lve.getLocation().getPath(), lve2.getLocation().getPath());
- Assertions.assertEquals(lve.getLocation().getLine(), lve2.getLocation().getLine());
- Assertions.assertEquals(lve.getLocation().getColumn(), lve2.getLocation().getColumn());
+ assertEquals(lve.getExpressionString(), lve2.getExpressionString());
+ assertEquals(lve.getLocation().getPath(), lve2.getLocation().getPath());
+ assertEquals(lve.getLocation().getLine(), lve2.getLocation().getLine());
+ assertEquals(lve.getLocation().getColumn(), lve2.getLocation().getColumn());
oos.close();
ois.close();
}
-
+
@Test
- public void testSerializeLocationValueExpressionUELWrapper() throws Exception
+ void serializeLocationValueExpressionUELWrapper() throws Exception
{
ValueExpression ve = facesContext.getApplication().getExpressionFactory().createValueExpression(
facesContext.getELContext(), "#{cc.attrs.value}", Object.class);
@@ -89,10 +90,10 @@ public void testSerializeLocationValueExpressionUELWrapper() throws Exception
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bais);
LocationValueExpression lve2 = (LocationValueExpression) ois.readObject();
- Assertions.assertEquals(lve.getExpressionString(), lve2.getExpressionString());
- Assertions.assertEquals(lve.getLocation().getPath(), lve2.getLocation().getPath());
- Assertions.assertEquals(lve.getLocation().getLine(), lve2.getLocation().getLine());
- Assertions.assertEquals(lve.getLocation().getColumn(), lve2.getLocation().getColumn());
+ assertEquals(lve.getExpressionString(), lve2.getExpressionString());
+ assertEquals(lve.getLocation().getPath(), lve2.getLocation().getPath());
+ assertEquals(lve.getLocation().getLine(), lve2.getLocation().getLine());
+ assertEquals(lve.getLocation().getColumn(), lve2.getLocation().getColumn());
oos.close();
ois.close();
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactoryPathValidationTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactoryPathValidationTest.java
index 99d584ba1b..ef76999ca9 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactoryPathValidationTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactoryPathValidationTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.impl;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.net.URL;
import jakarta.faces.application.ViewHandler;
@@ -26,7 +28,6 @@
import org.apache.myfaces.context.InvalidFileException;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -36,7 +37,7 @@
* The suite runs under {@code Development} stage (overriding the default
* {@code UnitTest} set by the base class) so the validation code-path is always active.
*/
-public class DefaultFaceletFactoryPathValidationTest extends AbstractMyFacesCDIRequestTestCase
+class DefaultFaceletFactoryPathValidationTest extends AbstractMyFacesCDIRequestTestCase
{
@Override
protected void setUpWebConfigParams() throws Exception
@@ -67,20 +68,20 @@ private DefaultFaceletFactory getFactory()
* {@link InvalidFileException.Reason#DISALLOWED_SCHEME}.
*/
@Test
- public void testExternalHttpUrlIsRejected() throws Exception
+ void externalHttpUrlIsRejected() throws Exception
{
// Only a live facesContext is needed — no view rendering required
startViewRequest(null);
DefaultFaceletFactory factory = getFactory();
- InvalidFileException ex = Assertions.assertThrows(
+ InvalidFileException ex = assertThrows(
InvalidFileException.class,
() -> factory.resolveURL(facesContext, null,
"http://someverybadmaliciouswebsite.com/attack.xhtml"),
"Expected InvalidFileException for external http: URL");
- Assertions.assertEquals(InvalidFileException.Reason.DISALLOWED_SCHEME, ex.getReason());
+ assertEquals(InvalidFileException.Reason.DISALLOWED_SCHEME, ex.getReason());
endRequest();
}
@@ -96,7 +97,7 @@ public void testExternalHttpUrlIsRejected() throws Exception
* the {@code mappingAllowed} check.
*/
@Test
- public void testNonFaceletExtensionIsRejected() throws Exception
+ void nonFaceletExtensionIsRejected() throws Exception
{
servletContext.addInitParameter(ViewHandler.FACELETS_SUFFIX_PARAM_NAME, ".xhtml");
startViewRequest(null);
@@ -106,12 +107,12 @@ public void testNonFaceletExtensionIsRejected() throws Exception
URL webappRoot = getWebappContextURI().toURL();
URL source = new URL(webappRoot, "views/index.xhtml");
- InvalidFileException ex = Assertions.assertThrows(
+ InvalidFileException ex = assertThrows(
InvalidFileException.class,
() -> factory.resolveURL(facesContext, source, "template.properties"),
"Expected InvalidFileException for a .properties path");
- Assertions.assertEquals(InvalidFileException.Reason.INVALID_EXTENSION, ex.getReason());
+ assertEquals(InvalidFileException.Reason.INVALID_EXTENSION, ex.getReason());
endRequest();
}
@@ -121,11 +122,11 @@ public void testNonFaceletExtensionIsRejected() throws Exception
* fail open when {@code source == null}).
*/
@Test
- public void testRelativeTraversalWithNullSourceIsRejected() throws Exception
+ void relativeTraversalWithNullSourceIsRejected() throws Exception
{
startViewRequest(null);
- Assertions.assertThrows(
+ assertThrows(
java.io.IOException.class,
() -> getFactory().resolveURL(facesContext, null, "../../etc/passwd.xhtml"));
}
@@ -136,7 +137,7 @@ public void testRelativeTraversalWithNullSourceIsRejected() throws Exception
* must not be rejected as {@code PATH_TRAVERSAL}.
*/
@Test
- public void testRelativeIncludeBetweenSiblingsInJarIsAllowed() throws Exception
+ void relativeIncludeBetweenSiblingsInJarIsAllowed() throws Exception
{
startViewRequest(null);
@@ -144,7 +145,7 @@ public void testRelativeIncludeBetweenSiblingsInJarIsAllowed() throws Exception
java.net.URL resolved = getFactory().resolveURL(facesContext, source, "breadcrumbs.xhtml");
- Assertions.assertTrue(resolved.toExternalForm().endsWith("!/META-INF/resources/breadcrumbs.xhtml"),
+ assertTrue(resolved.toExternalForm().endsWith("!/META-INF/resources/breadcrumbs.xhtml"),
"Unexpected URL: " + resolved);
}
@@ -152,17 +153,17 @@ public void testRelativeIncludeBetweenSiblingsInJarIsAllowed() throws Exception
* A relative path that climbs out of the jar's {@code META-INF/resources} root must still be rejected.
*/
@Test
- public void testRelativePathEscapingJarResourceRootIsRejected() throws Exception
+ void relativePathEscapingJarResourceRootIsRejected() throws Exception
{
startViewRequest(null);
java.net.URL source = createTemplatesJar("includeOnly.xhtml");
- InvalidFileException ex = Assertions.assertThrows(
+ InvalidFileException ex = assertThrows(
InvalidFileException.class,
() -> getFactory().resolveURL(facesContext, source, "../../escaped.xhtml"));
- Assertions.assertEquals(InvalidFileException.Reason.PATH_TRAVERSAL, ex.getReason());
+ assertEquals(InvalidFileException.Reason.PATH_TRAVERSAL, ex.getReason());
}
/** Creates templates.jar with META-INF/resources/{includeOnly,breadcrumbs}.xhtml; returns URL of 'entry'. */
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactoryTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactoryTest.java
index 5cc1bac8d0..28be47430b 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactoryTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactoryTest.java
@@ -18,64 +18,63 @@
*/
package org.apache.myfaces.view.facelets.impl;
-import java.io.IOException;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.view.facelets.compiler.SAXCompiler;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* Unit tests for {@link DefaultFaceletFactory#_removeFirst(String, String)} (same-package access to protected).
*/
-public class DefaultFaceletFactoryTest extends AbstractFaceletTestCase
+class DefaultFaceletFactoryTest extends AbstractFaceletTestCase
{
@Test
- public void testRemoveFirstPrefix() throws IOException
+ void removeFirstPrefix() throws Exception
{
DefaultFaceletFactory factory = new DefaultFaceletFactory(new SAXCompiler());
- Assertions.assertEquals("/y/z", factory._removeFirst("/x/y/z", "/x"));
+ assertEquals("/y/z", factory._removeFirst("/x/y/z", "/x"));
}
@Test
- public void testRemoveFirstOnlyFirstOccurrence() throws IOException
+ void removeFirstOnlyFirstOccurrence() throws Exception
{
DefaultFaceletFactory factory = new DefaultFaceletFactory(new SAXCompiler());
- Assertions.assertEquals("/a/b/a", factory._removeFirst("/a/b/a/b/a", "/a/b"));
+ assertEquals("/a/b/a", factory._removeFirst("/a/b/a/b/a", "/a/b"));
}
@Test
- public void testRemoveFirstNotFound() throws IOException
+ void removeFirstNotFound() throws Exception
{
DefaultFaceletFactory factory = new DefaultFaceletFactory(new SAXCompiler());
- Assertions.assertEquals("/unchanged", factory._removeFirst("/unchanged", "/missing"));
+ assertEquals("/unchanged", factory._removeFirst("/unchanged", "/missing"));
}
@Test
- public void testRemoveFirstEmptyToRemove() throws IOException
+ void removeFirstEmptyToRemove() throws Exception
{
DefaultFaceletFactory factory = new DefaultFaceletFactory(new SAXCompiler());
- Assertions.assertEquals("/same", factory._removeFirst("/same", ""));
+ assertEquals("/same", factory._removeFirst("/same", ""));
}
@Test
- public void testRemoveFirstNullToRemove() throws IOException
+ void removeFirstNullToRemove() throws Exception
{
DefaultFaceletFactory factory = new DefaultFaceletFactory(new SAXCompiler());
- Assertions.assertEquals("/same", factory._removeFirst("/same", null));
+ assertEquals("/same", factory._removeFirst("/same", null));
}
@Test
- public void testRemoveFirstRegexMetacharactersAreLiteral() throws IOException
+ void removeFirstRegexMetacharactersAreLiteral() throws Exception
{
DefaultFaceletFactory factory = new DefaultFaceletFactory(new SAXCompiler());
- Assertions.assertEquals("prefixsuffix", factory._removeFirst("prefix.+suffix", ".+"));
+ assertEquals("prefixsuffix", factory._removeFirst("prefix.+suffix", ".+"));
}
@Test
- public void testRemoveFirstWholeString() throws IOException
+ void removeFirstWholeString() throws Exception
{
DefaultFaceletFactory factory = new DefaultFaceletFactory(new SAXCompiler());
- Assertions.assertEquals("", factory._removeFirst("/only", "/only"));
+ assertEquals("", factory._removeFirst("/only", "/only"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/impl/ProgrammaticViewTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/impl/ProgrammaticViewTest.java
index d19a036935..7d375ef469 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/impl/ProgrammaticViewTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/impl/ProgrammaticViewTest.java
@@ -18,20 +18,20 @@
*/
package org.apache.myfaces.view.facelets.impl;
-import java.io.IOException;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.faces.component.UIOutput;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/*
- Basic test that verifies programmmatic facelets work. See spec issue: https://github.com/jakartaee/faces/issues/1581
- Facelet code is generated by ProgrammaticViewBean.
- */
-public class ProgrammaticViewTest extends org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase //extends FaceletTestCase
+ Basic test that verifies programmmatic facelets work. See spec issue: https://github.com/jakartaee/faces/issues/1581
+ Facelet code is generated by ProgrammaticViewBean.
+*/
+class ProgrammaticViewTest extends org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase //extends FaceletTestCase
{
@Test
- public void testProgrammaticView() throws IOException
+ void programmaticView() throws Exception
{
startViewRequest("/test.xhtml");
processLifecycleExecuteAndRender();
@@ -40,13 +40,13 @@ public void testProgrammaticView() throws IOException
UIOutput out = (UIOutput) facesContext.getViewRoot().findComponent("messageId");
String result1 = out.getValue().toString();
- Assertions.assertTrue(result1.contains("Success!"));
+ assertTrue(result1.contains("Success!"));
//Grab by ID
UIOutput cdiOut = (UIOutput) facesContext.getViewRoot().findComponent("cdiId");
String result2 = cdiOut.getValue().toString();
- Assertions.assertTrue(result2.contains("CDI Bean Name: Test1581Bean"));
+ assertTrue(result2.contains("CDI Bean Name: Test1581Bean"));
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/impl/ResourceMarkDeleteTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/impl/ResourceMarkDeleteTest.java
index f427e9b4a2..c86052cb87 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/impl/ResourceMarkDeleteTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/impl/ResourceMarkDeleteTest.java
@@ -18,19 +18,19 @@
*/
package org.apache.myfaces.view.facelets.impl;
-import java.io.IOException;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.List;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.event.PhaseId;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class ResourceMarkDeleteTest extends AbstractFaceletTestCase
+class ResourceMarkDeleteTest extends AbstractFaceletTestCase
{
@Test
- public void test_only_ajs_is_included() throws IOException
+ void only_ajs_is_included() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
@@ -40,12 +40,12 @@ public void test_only_ajs_is_included() throws IOException
List resources = root.getComponentResources(facesContext, "head");
- Assertions.assertEquals(1, resources.size());
- Assertions.assertTrue(resources.get(0).getAttributes().get("name").equals("a.js"));
+ assertEquals(1, resources.size());
+ assertEquals("a.js", resources.get(0).getAttributes().get("name"));
}
@Test
- public void test_ajs_and_xjs_are_included() throws IOException
+ void ajs_and_xjs_are_included() throws Exception
{
facesContext.getAttributes().put("includeResource", Boolean.TRUE);
UIViewRoot root = facesContext.getViewRoot();
@@ -56,11 +56,11 @@ public void test_ajs_and_xjs_are_included() throws IOException
List resources = root.getComponentResources(facesContext, "head");
- Assertions.assertEquals(2, resources.size());
+ assertEquals(2, resources.size());
}
@Test
- public void test_only_ajs_after_refresh_view_is_included() throws IOException
+ void only_ajs_after_refresh_view_is_included() throws Exception
{
UIViewRoot view = facesContext.getViewRoot();
@@ -71,7 +71,7 @@ public void test_only_ajs_after_refresh_view_is_included() throws IOException
{
List resources = view.getComponentResources(facesContext, "head");
- Assertions.assertEquals(1, resources.size());
+ assertEquals(1, resources.size());
}
// reset 'isFilledView'
@@ -89,7 +89,7 @@ public void test_only_ajs_after_refresh_view_is_included() throws IOException
{
List resources = view.getComponentResources(facesContext, "head");
- Assertions.assertEquals(2, resources.size());
+ assertEquals(2, resources.size());
}
// reset 'isFilledView'
@@ -103,7 +103,7 @@ public void test_only_ajs_after_refresh_view_is_included() throws IOException
{
List resources = view.getComponentResources(facesContext, "head");
- Assertions.assertEquals(1, resources.size());
+ assertEquals(1, resources.size());
}
}
}
\ No newline at end of file
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/impl/SectionUniqueIdCounterTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/impl/SectionUniqueIdCounterTest.java
index 08831d5f05..ccfe16bfca 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/impl/SectionUniqueIdCounterTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/impl/SectionUniqueIdCounterTest.java
@@ -18,42 +18,44 @@
*/
package org.apache.myfaces.view.facelets.impl;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.Set;
import java.util.TreeSet;
import org.apache.myfaces.test.base.junit.AbstractFacesTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class SectionUniqueIdCounterTest extends AbstractFacesTestCase
+class SectionUniqueIdCounterTest extends AbstractFacesTestCase
{
@Test
- public void testSimpleCounter()
+ void simpleCounter()
{
Set idSet = new TreeSet();
SectionUniqueIdCounter counter = new SectionUniqueIdCounter();
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.startUniqueIdSection()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.startUniqueIdSection()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- counter.endUniqueIdSection();
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- counter.endUniqueIdSection();
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
- Assertions.assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.startUniqueIdSection()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.startUniqueIdSection()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ counter.endUniqueIdSection();
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ counter.endUniqueIdSection();
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
+ assertTrue(idSet.add(counter.generateUniqueId()));
/*
SectionUniqueIdCounter counter = new SectionUniqueIdCounter("_");
@@ -126,123 +128,123 @@ public void testSimpleCounter()
System.out.println(UIViewRoot.UNIQUE_ID_PREFIX+counter.generateUniqueId());
*/
}
-
+
@Test
- public void testCachedCounter()
+ void cachedCounter()
{
String[] cache = SectionUniqueIdCounter.generateUniqueIdCache("_", 10);
SectionUniqueIdCounter counter = new SectionUniqueIdCounter("_", cache);
SectionUniqueIdCounter counterOrig = new SectionUniqueIdCounter("_");
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
counterOrig.startUniqueIdSection();
counter.startUniqueIdSection();
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
counterOrig.endUniqueIdSection();
counter.endUniqueIdSection();
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
- Assertions.assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
+ assertEquals(counterOrig.generateUniqueId(), counter.generateUniqueId());
}
-
+
@Test
- public void testCounterExpansion()
+ void counterExpansion()
{
SectionUniqueIdCounter counter = new SectionUniqueIdCounter();
- Assertions.assertEquals("1", counter.generateUniqueId());
- Assertions.assertEquals("2", counter.generateUniqueId());
- Assertions.assertEquals("2_X", counter.startUniqueIdSection("X"));
- Assertions.assertEquals("2_X_1", counter.generateUniqueId());
- Assertions.assertEquals("2_X_2",counter.generateUniqueId());
- Assertions.assertEquals("2_X_3",counter.startUniqueIdSection());
- Assertions.assertEquals("2_X_3_1",counter.generateUniqueId());
- Assertions.assertEquals("2_X_3_2",counter.generateUniqueId());
- counter.endUniqueIdSection();
- Assertions.assertEquals("2_X_4",counter.generateUniqueId());
+ assertEquals("1", counter.generateUniqueId());
+ assertEquals("2", counter.generateUniqueId());
+ assertEquals("2_X", counter.startUniqueIdSection("X"));
+ assertEquals("2_X_1", counter.generateUniqueId());
+ assertEquals("2_X_2",counter.generateUniqueId());
+ assertEquals("2_X_3",counter.startUniqueIdSection());
+ assertEquals("2_X_3_1",counter.generateUniqueId());
+ assertEquals("2_X_3_2",counter.generateUniqueId());
+ counter.endUniqueIdSection();
+ assertEquals("2_X_4",counter.generateUniqueId());
counter.endUniqueIdSection("X");
- Assertions.assertEquals("2_Y", counter.startUniqueIdSection("Y"));
- Assertions.assertEquals("2_Y_1", counter.generateUniqueId());
+ assertEquals("2_Y", counter.startUniqueIdSection("Y"));
+ assertEquals("2_Y_1", counter.generateUniqueId());
counter.endUniqueIdSection("Y");
- Assertions.assertEquals("3", counter.generateUniqueId());
- Assertions.assertEquals("4", counter.generateUniqueId());
+ assertEquals("3", counter.generateUniqueId());
+ assertEquals("4", counter.generateUniqueId());
}
-
+
@Test
- public void testCounterExpansion2()
+ void counterExpansion2()
{
SectionUniqueIdCounter counter = new SectionUniqueIdCounter();
- Assertions.assertEquals("1", counter.generateUniqueId());
- Assertions.assertEquals("2",counter.startUniqueIdSection());
- Assertions.assertEquals("2_1",counter.startUniqueIdSection());
- Assertions.assertEquals("2_1_1", counter.generateUniqueId());
+ assertEquals("1", counter.generateUniqueId());
+ assertEquals("2",counter.startUniqueIdSection());
+ assertEquals("2_1",counter.startUniqueIdSection());
+ assertEquals("2_1_1", counter.generateUniqueId());
counter.endUniqueIdSection();
- Assertions.assertEquals("2_2", counter.generateUniqueId());
+ assertEquals("2_2", counter.generateUniqueId());
counter.endUniqueIdSection();
- Assertions.assertEquals("3", counter.generateUniqueId());
+ assertEquals("3", counter.generateUniqueId());
- Assertions.assertEquals("3_X", counter.startUniqueIdSection("X"));
- Assertions.assertEquals("3_X_1", counter.generateUniqueId());
- Assertions.assertEquals("3_X_2",counter.generateUniqueId());
- Assertions.assertEquals("3_X_3",counter.startUniqueIdSection());
- Assertions.assertEquals("3_X_3_1",counter.generateUniqueId());
- Assertions.assertEquals("3_X_3_2",counter.generateUniqueId());
- counter.endUniqueIdSection();
- Assertions.assertEquals("3_X_4",counter.generateUniqueId());
+ assertEquals("3_X", counter.startUniqueIdSection("X"));
+ assertEquals("3_X_1", counter.generateUniqueId());
+ assertEquals("3_X_2",counter.generateUniqueId());
+ assertEquals("3_X_3",counter.startUniqueIdSection());
+ assertEquals("3_X_3_1",counter.generateUniqueId());
+ assertEquals("3_X_3_2",counter.generateUniqueId());
+ counter.endUniqueIdSection();
+ assertEquals("3_X_4",counter.generateUniqueId());
counter.endUniqueIdSection("X");
- Assertions.assertEquals("3_Y", counter.startUniqueIdSection("Y"));
- Assertions.assertEquals("3_Y_1", counter.generateUniqueId());
+ assertEquals("3_Y", counter.startUniqueIdSection("Y"));
+ assertEquals("3_Y_1", counter.generateUniqueId());
counter.endUniqueIdSection("Y");
- Assertions.assertEquals("4",counter.startUniqueIdSection());
+ assertEquals("4",counter.startUniqueIdSection());
counter.endUniqueIdSection();
- Assertions.assertEquals("5", counter.generateUniqueId());
- Assertions.assertEquals("6", counter.generateUniqueId());
+ assertEquals("5", counter.generateUniqueId());
+ assertEquals("6", counter.generateUniqueId());
}
-
+
@Test
- public void testCounterExpansion3()
+ void counterExpansion3()
{
SectionUniqueIdCounter counter = new SectionUniqueIdCounter();
- Assertions.assertEquals("1",counter.startUniqueIdSection());
- Assertions.assertEquals("1_1", counter.generateUniqueId());
- Assertions.assertEquals("1_2",counter.startUniqueIdSection());
- Assertions.assertEquals("1_2_1",counter.startUniqueIdSection());
- Assertions.assertEquals("1_2_1_1", counter.generateUniqueId());
+ assertEquals("1",counter.startUniqueIdSection());
+ assertEquals("1_1", counter.generateUniqueId());
+ assertEquals("1_2",counter.startUniqueIdSection());
+ assertEquals("1_2_1",counter.startUniqueIdSection());
+ assertEquals("1_2_1_1", counter.generateUniqueId());
counter.endUniqueIdSection();
- Assertions.assertEquals("1_2_2", counter.generateUniqueId());
+ assertEquals("1_2_2", counter.generateUniqueId());
counter.endUniqueIdSection();
- Assertions.assertEquals("1_3", counter.generateUniqueId());
+ assertEquals("1_3", counter.generateUniqueId());
- Assertions.assertEquals("1_3_X", counter.startUniqueIdSection("X"));
- Assertions.assertEquals("1_3_X_1", counter.generateUniqueId());
- Assertions.assertEquals("1_3_X_2",counter.generateUniqueId());
- Assertions.assertEquals("1_3_X_3",counter.startUniqueIdSection());
- Assertions.assertEquals("1_3_X_3_1",counter.generateUniqueId());
- Assertions.assertEquals("1_3_X_3_2",counter.generateUniqueId());
- counter.endUniqueIdSection();
- Assertions.assertEquals("1_3_X_4",counter.generateUniqueId());
+ assertEquals("1_3_X", counter.startUniqueIdSection("X"));
+ assertEquals("1_3_X_1", counter.generateUniqueId());
+ assertEquals("1_3_X_2",counter.generateUniqueId());
+ assertEquals("1_3_X_3",counter.startUniqueIdSection());
+ assertEquals("1_3_X_3_1",counter.generateUniqueId());
+ assertEquals("1_3_X_3_2",counter.generateUniqueId());
+ counter.endUniqueIdSection();
+ assertEquals("1_3_X_4",counter.generateUniqueId());
counter.endUniqueIdSection("X");
- Assertions.assertEquals("1_3_Y", counter.startUniqueIdSection("Y"));
- Assertions.assertEquals("1_3_Y_1", counter.generateUniqueId());
+ assertEquals("1_3_Y", counter.startUniqueIdSection("Y"));
+ assertEquals("1_3_Y_1", counter.generateUniqueId());
counter.endUniqueIdSection("Y");
- Assertions.assertEquals("1_4",counter.startUniqueIdSection());
+ assertEquals("1_4",counter.startUniqueIdSection());
counter.endUniqueIdSection();
- Assertions.assertEquals("1_5", counter.generateUniqueId());
- Assertions.assertEquals("1_6", counter.generateUniqueId());
+ assertEquals("1_5", counter.generateUniqueId());
+ assertEquals("1_6", counter.generateUniqueId());
counter.endUniqueIdSection();
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/pool/ViewPoolFaceletsTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/pool/ViewPoolFaceletsTestCase.java
index 241fb90862..1771973eea 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/pool/ViewPoolFaceletsTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/pool/ViewPoolFaceletsTestCase.java
@@ -18,12 +18,14 @@
*/
package org.apache.myfaces.view.facelets.pool;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import jakarta.faces.application.ProjectStage;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.event.PhaseId;
import jakarta.faces.render.RenderKitFactory;
-import org.junit.jupiter.api.Assertions;
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.view.facelets.ViewPoolProcessor;
@@ -34,7 +36,7 @@
*
* @author lu4242
*/
-public class ViewPoolFaceletsTestCase extends AbstractFaceletTestCase
+class ViewPoolFaceletsTestCase extends AbstractFaceletTestCase
{
@Override
@@ -69,7 +71,7 @@ protected void setupComponents() throws Exception
* @throws Exception
*/
@Test
- public void testDynPageResourceCleanup1() throws Exception
+ void dynPageResourceCleanup1() throws Exception
{
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
@@ -100,24 +102,24 @@ public void testDynPageResourceCleanup1() throws Exception
// the resource should still be there
//Assertions.assertEquals(1, oldCount);
// The code in MYFACES-3659 reset the component after refresh
- Assertions.assertEquals(0, oldCount);
+ assertEquals(0, oldCount);
// Clear the view and synchronize resources
ViewStructureMetadata metadata = processor.retrieveViewStructureMetadata(facesContext, root);
- Assertions.assertNotNull(metadata);
+ assertNotNull(metadata);
processor.clearTransientAndNonFaceletComponentsForDynamicView(facesContext, root, metadata);
// the resource added by state checkA=true should not be there
- Assertions.assertEquals(0, headerFacet.getChildCount());
+ assertEquals(0, headerFacet.getChildCount());
}
-
+
/**
* Check remove component resource added using @ResourceDependency
*
* @throws Exception
*/
@Test
- public void testDynPageResourceCleanup2() throws Exception
+ void dynPageResourceCleanup2() throws Exception
{
facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
@@ -146,15 +148,15 @@ public void testDynPageResourceCleanup2() throws Exception
// the resource should still be there
UIComponent headerFacet = root.getFacet("head");
int oldCount = headerFacet.getChildCount();
- Assertions.assertEquals(1, oldCount);
+ assertEquals(1, oldCount);
// Clear the view and synchronize resources
ViewStructureMetadata metadata = processor.retrieveViewStructureMetadata(facesContext, root);
- Assertions.assertNotNull(metadata);
+ assertNotNull(metadata);
processor.clearTransientAndNonFaceletComponentsForDynamicView(facesContext, root, metadata);
// the resource added by state checkA=true should not be there
- Assertions.assertEquals(0, headerFacet.getChildCount());
+ assertEquals(0, headerFacet.getChildCount());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/pool/ViewPoolMyFacesRequestTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/pool/ViewPoolMyFacesRequestTestCase.java
index 5a9776ea15..ea1f25f222 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/pool/ViewPoolMyFacesRequestTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/pool/ViewPoolMyFacesRequestTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.pool;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@@ -39,10 +41,9 @@
import org.apache.myfaces.view.facelets.pool.impl.ViewPoolImpl;
import org.apache.myfaces.view.facelets.tag.faces.ComponentSupport;
import org.apache.myfaces.view.facelets.tag.faces.FaceletState;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class ViewPoolMyFacesRequestTestCase extends AbstractMyFacesCDIRequestTestCase
+class ViewPoolMyFacesRequestTestCase extends AbstractMyFacesCDIRequestTestCase
{
protected ExpressionFactory createExpressionFactory()
{
@@ -72,7 +73,7 @@ protected void setUpWebConfigParams() throws Exception
* @throws Exception
*/
@Test
- public void testStaticPageNoForm1() throws Exception
+ void staticPageNoForm1() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageNoForm.xhtml");
@@ -88,8 +89,8 @@ public void testStaticPageNoForm1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
}
@@ -100,7 +101,7 @@ public void testStaticPageNoForm1() throws Exception
* @throws Exception
*/
@Test
- public void testStaticPageNoForm1_1() throws Exception
+ void staticPageNoForm11() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageNoForm.xhtml");
@@ -120,7 +121,7 @@ public void testStaticPageNoForm1_1() throws Exception
executeBeforeRender();
executeBuildViewCycle();
- Assertions.assertTrue(facesContext.getViewRoot().getChildCount() > 0);
+ assertTrue(facesContext.getViewRoot().getChildCount() > 0);
UIViewRoot root = new UIViewRoot();
root.setLocale(locale);
@@ -131,11 +132,11 @@ public void testStaticPageNoForm1_1() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
// Check it was used.
- Assertions.assertNull(entry);
+ assertNull(entry);
}
-
+
@Test
- public void testStaticPageNoForm2() throws Exception
+ void staticPageNoForm2() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageNoForm2.xhtml");
@@ -146,11 +147,11 @@ public void testStaticPageNoForm2() throws Exception
executeBuildViewCycle();
UIOutput testjs1_1 = (UIOutput) facesContext.getViewRoot().findComponent("testjs");
- Assertions.assertNotNull(testjs1_1);
+ assertNotNull(testjs1_1);
testjs1_1.getAttributes().put("param1", "value1");
List crlist = facesContext.getViewRoot().getComponentResources(facesContext, "head");
- Assertions.assertEquals(2, crlist.size());
+ assertEquals(2, crlist.size());
for(UIComponent comp : crlist)
{
comp.getAttributes().put("param2", "value2");
@@ -167,18 +168,18 @@ public void testStaticPageNoForm2() throws Exception
executeBeforeRender();
executeBuildViewCycle();
- Assertions.assertTrue(facesContext.getViewRoot().getChildCount() > 0);
+ assertTrue(facesContext.getViewRoot().getChildCount() > 0);
UIOutput testjs2_1 = (UIOutput) facesContext.getViewRoot().findComponent("testjs");
- Assertions.assertNotNull(testjs2_1);
+ assertNotNull(testjs2_1);
// The state of the component should not be transferred.
- Assertions.assertNull(testjs2_1.getAttributes().get("param1"));
+ assertNull(testjs2_1.getAttributes().get("param1"));
List crlist2 = facesContext.getViewRoot().getComponentResources(facesContext, "head");
- Assertions.assertEquals(2, crlist2.size());
+ assertEquals(2, crlist2.size());
for(UIComponent comp : crlist)
{
- Assertions.assertNull(comp.getAttributes().get("param2"));
+ assertNull(comp.getAttributes().get("param2"));
}
UIViewRoot root = new UIViewRoot();
@@ -190,11 +191,11 @@ public void testStaticPageNoForm2() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
// Check it was used.
- Assertions.assertNull(entry);
- }
+ assertNull(entry);
+ }
@Test
- public void testStaticPage1() throws Exception
+ void staticPage1() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage.xhtml");
@@ -210,13 +211,13 @@ public void testStaticPage1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPage1_1() throws Exception
+ void staticPage11() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage.xhtml");
@@ -243,20 +244,20 @@ public void testStaticPage1_1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
//Check the component was removed
UIForm form2 = (UIForm) entry.getViewRoot().findComponent("mainForm");
- Assertions.assertNotNull(form2);
+ assertNotNull(form2);
UIOutput testComponent2 = (UIOutput) form2.findComponent("testId");
- Assertions.assertNull(testComponent2);
+ assertNull(testComponent2);
endRequest();
}
-
+
@Test
- public void testStaticPage1_2() throws Exception
+ void staticPage12() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage.xhtml");
@@ -283,20 +284,20 @@ public void testStaticPage1_2() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
//Check the component was removed
UIForm form2 = (UIForm) entry.getViewRoot().findComponent("mainForm");
- Assertions.assertNotNull(form2);
+ assertNotNull(form2);
UIOutput testComponent2 = (UIOutput) form2.findComponent("testId");
- Assertions.assertNull(testComponent2);
+ assertNull(testComponent2);
endRequest();
}
-
+
@Test
- public void testStaticPage1_3() throws Exception
+ void staticPage13() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage.xhtml");
@@ -323,13 +324,13 @@ public void testStaticPage1_3() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPage1_4() throws Exception
+ void staticPage14() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage.xhtml");
@@ -358,13 +359,13 @@ public void testStaticPage1_4() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPage1_5() throws Exception
+ void staticPage15() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage.xhtml");
@@ -389,7 +390,7 @@ public void testStaticPage1_5() throws Exception
executeBuildViewCycle();
//Check if the view scope value is preserved
- Assertions.assertEquals("someValue", facesContext.getViewRoot().getViewMap().get("someKey"));
+ assertEquals("someValue", facesContext.getViewRoot().getViewMap().get("someKey"));
facesContext.getViewRoot().getViewMap().put("someKey", "someValue2");
@@ -406,9 +407,9 @@ public void testStaticPage1_5() throws Exception
executeBuildViewCycle();
//Check if the view scope value is preserved
- Assertions.assertEquals("someValue2", facesContext.getViewRoot().getViewMap().get("someKey"));
+ assertEquals("someValue2", facesContext.getViewRoot().getViewMap().get("someKey"));
- Assertions.assertTrue(facesContext.getViewRoot().getChildCount() > 0);
+ assertTrue(facesContext.getViewRoot().getChildCount() > 0);
executeViewHandlerRender();
executeAfterRender();
@@ -421,14 +422,14 @@ public void testStaticPage1_5() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
- }
-
+ }
+
@Test
- public void testStaticPage1_6() throws Exception
+ void staticPage16() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage3.xhtml");
@@ -440,7 +441,7 @@ public void testStaticPage1_6() throws Exception
executeBuildViewCycle();
// Use view scope
- Assertions.assertEquals("someBeforeValue", facesContext.getViewRoot().getViewMap().get("keyBeforeView"));
+ assertEquals("someBeforeValue", facesContext.getViewRoot().getViewMap().get("keyBeforeView"));
facesContext.getViewRoot().getViewMap().put("someKey", "someValue");
UICommand submitButton = (UICommand) facesContext.getViewRoot().findComponent("mainForm:submit");
@@ -456,7 +457,7 @@ public void testStaticPage1_6() throws Exception
executeBuildViewCycle();
//Check if the view scope value is preserved
- Assertions.assertEquals("someValue", facesContext.getViewRoot().getViewMap().get("someKey"));
+ assertEquals("someValue", facesContext.getViewRoot().getViewMap().get("someKey"));
facesContext.getViewRoot().getViewMap().put("someKey", "someValue2");
@@ -473,9 +474,9 @@ public void testStaticPage1_6() throws Exception
executeBuildViewCycle();
//Check if the view scope value is preserved
- Assertions.assertEquals("someValue2", facesContext.getViewRoot().getViewMap().get("someKey"));
+ assertEquals("someValue2", facesContext.getViewRoot().getViewMap().get("someKey"));
- Assertions.assertTrue(facesContext.getViewRoot().getChildCount() > 0);
+ assertTrue(facesContext.getViewRoot().getChildCount() > 0);
executeViewHandlerRender();
executeAfterRender();
@@ -488,14 +489,14 @@ public void testStaticPage1_6() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
- }
-
+ }
+
@Test
- public void testStaticPage1_7() throws Exception
+ void staticPage17() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage3.xhtml");
@@ -519,18 +520,18 @@ public void testStaticPage1_7() throws Exception
facesContext.getViewRoot().getViewMap().put("keyBeforeView", "someBeforeValue");
UIViewParameter paramComponent = ViewMetadata.getViewParameters(facesContext.getViewRoot()).iterator().next();
- Assertions.assertNotNull(paramComponent);
- Assertions.assertEquals("someId", paramComponent.getValue());
+ assertNotNull(paramComponent);
+ assertEquals("someId", paramComponent.getValue());
executeBeforeRender();
executeBuildViewCycle();
paramComponent = ViewMetadata.getViewParameters(facesContext.getViewRoot()).iterator().next();
- Assertions.assertNotNull(paramComponent);
- Assertions.assertEquals("someId", paramComponent.getValue());
+ assertNotNull(paramComponent);
+ assertEquals("someId", paramComponent.getValue());
// Use view scope
- Assertions.assertEquals("someBeforeValue", facesContext.getViewRoot().getViewMap().get("keyBeforeView"));
+ assertEquals("someBeforeValue", facesContext.getViewRoot().getViewMap().get("keyBeforeView"));
facesContext.getViewRoot().getViewMap().put("someKey", "someValue");
//Assertions.assertEquals("viewValue", facesContext.getViewRoot().getViewMap().get("viewKey"));
@@ -540,10 +541,10 @@ public void testStaticPage1_7() throws Exception
executeAfterRender();
endRequest();
- }
-
+ }
+
@Test
- public void testStaticPage2() throws Exception
+ void staticPage2() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage2.xhtml");
@@ -554,11 +555,11 @@ public void testStaticPage2() throws Exception
executeBuildViewCycle();
UIOutput testjs1_1 = (UIOutput) facesContext.getViewRoot().findComponent("testjs");
- Assertions.assertNotNull(testjs1_1);
+ assertNotNull(testjs1_1);
testjs1_1.getAttributes().put("param1", "value1");
List crlist = facesContext.getViewRoot().getComponentResources(facesContext, "head");
- Assertions.assertEquals(2, crlist.size());
+ assertEquals(2, crlist.size());
for(UIComponent comp : crlist)
{
comp.getAttributes().put("param2", "value2");
@@ -576,18 +577,18 @@ public void testStaticPage2() throws Exception
executeBeforeRender();
executeBuildViewCycle();
- Assertions.assertTrue(facesContext.getViewRoot().getChildCount() > 0);
+ assertTrue(facesContext.getViewRoot().getChildCount() > 0);
UIOutput testjs2_1 = (UIOutput) facesContext.getViewRoot().findComponent("testjs");
- Assertions.assertNotNull(testjs2_1);
+ assertNotNull(testjs2_1);
// The state of the component should not be transferred.
- Assertions.assertEquals("value1",testjs2_1.getAttributes().get("param1"));
+ assertEquals("value1",testjs2_1.getAttributes().get("param1"));
List crlist2 = facesContext.getViewRoot().getComponentResources(facesContext, "head");
- Assertions.assertEquals(2, crlist2.size());
+ assertEquals(2, crlist2.size());
for(UIComponent comp : crlist)
{
- Assertions.assertEquals("value2", comp.getAttributes().get("param2"));
+ assertEquals("value2", comp.getAttributes().get("param2"));
}
UIViewRoot root = new UIViewRoot();
@@ -599,11 +600,11 @@ public void testStaticPage2() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
// Check it was used.
- Assertions.assertNull(entry);
+ assertNull(entry);
}
-
+
@Test
- public void testStaticPageWithViewScope1() throws Exception
+ void staticPageWithViewScope1() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage.xhtml");
@@ -623,7 +624,7 @@ public void testStaticPageWithViewScope1() throws Exception
executeBuildViewCycle();
// Check the ViewMap value is not passed to the view
- Assertions.assertNull(facesContext.getViewRoot().getViewMap(false));
+ assertNull(facesContext.getViewRoot().getViewMap(false));
// Check the view was used
UIViewRoot root = new UIViewRoot();
@@ -633,11 +634,11 @@ public void testStaticPageWithViewScope1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
}
-
+
@Test
- public void testStaticPageWithViewScope1_1() throws Exception
+ void staticPageWithViewScope11() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage.xhtml");
@@ -657,13 +658,13 @@ public void testStaticPageWithViewScope1_1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPageWithViewScope2() throws Exception
+ void staticPageWithViewScope2() throws Exception
{
Locale locale = null;
startViewRequest("/staticPage.xhtml");
@@ -687,18 +688,18 @@ public void testStaticPageWithViewScope2() throws Exception
processLifecycleExecute();
// Check the ViewMap is passed to the view
- Assertions.assertNotNull(facesContext.getViewRoot().getViewMap(false));
- Assertions.assertEquals("someValue", facesContext.getViewRoot().getViewMap(false).get("viewItem"));
+ assertNotNull(facesContext.getViewRoot().getViewMap(false));
+ assertEquals("someValue", facesContext.getViewRoot().getViewMap(false).get("viewItem"));
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
// Check the view was used
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
}
@Test
- public void testStaticUIParamPage1() throws Exception
+ void staticUIParamPage1() throws Exception
{
Locale locale = null;
startViewRequest("/staticUIParamPage1.xhtml");
@@ -714,13 +715,13 @@ public void testStaticUIParamPage1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticUIParamPage1_1() throws Exception
+ void staticUIParamPage11() throws Exception
{
Locale locale = null;
startViewRequest("/staticUIParamPage1.xhtml");
@@ -730,12 +731,12 @@ public void testStaticUIParamPage1_1() throws Exception
executeBuildViewCycle();
UIOutput outParam1_1 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:paramOut_1");
- Assertions.assertNotNull(outParam1_1);
- Assertions.assertEquals("hello_1", outParam1_1.getValue());
+ assertNotNull(outParam1_1);
+ assertEquals("hello_1", outParam1_1.getValue());
UIOutput outParam1_2 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:paramOut_2");
- Assertions.assertNotNull(outParam1_2);
- Assertions.assertEquals("hello_2", outParam1_2.getValue());
+ assertNotNull(outParam1_2);
+ assertEquals("hello_2", outParam1_2.getValue());
executeViewHandlerRender();
@@ -752,12 +753,12 @@ public void testStaticUIParamPage1_1() throws Exception
executeBuildViewCycle();
UIOutput outParam2_1 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:paramOut_1");
- Assertions.assertNotNull(outParam2_1);
- Assertions.assertEquals("hello_1", outParam2_1.getValue());
+ assertNotNull(outParam2_1);
+ assertEquals("hello_1", outParam2_1.getValue());
UIOutput outParam2_2 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:paramOut_2");
- Assertions.assertNotNull(outParam2_2);
- Assertions.assertEquals("hello_2", outParam2_2.getValue());
+ assertNotNull(outParam2_2);
+ assertEquals("hello_2", outParam2_2.getValue());
// Check the view was used
UIViewRoot root = new UIViewRoot();
@@ -767,7 +768,7 @@ public void testStaticUIParamPage1_1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
executeViewHandlerRender();
@@ -776,9 +777,9 @@ public void testStaticUIParamPage1_1() throws Exception
executeAfterRender();
}
-
+
@Test
- public void testStaticViewParamPage1() throws Exception
+ void staticViewParamPage1() throws Exception
{
Locale locale = null;
startViewRequest("/staticViewParamPage1.xhtml");
@@ -794,13 +795,13 @@ public void testStaticViewParamPage1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticViewParamPage1_1() throws Exception
+ void staticViewParamPage11() throws Exception
{
Locale locale = null;
startViewRequest("/staticViewParamPage1.xhtml");
@@ -810,7 +811,7 @@ public void testStaticViewParamPage1_1() throws Exception
executeBuildViewCycle();
UIOutput testId1_1 = (UIOutput) facesContext.getViewRoot().findComponent("testId");
- Assertions.assertNotNull(testId1_1);
+ assertNotNull(testId1_1);
testId1_1.getAttributes().put("param1", "value1");
executeViewHandlerRender();
@@ -825,8 +826,8 @@ public void testStaticViewParamPage1_1() throws Exception
executeBuildViewCycle();
UIOutput testId2_1 = (UIOutput) facesContext.getViewRoot().findComponent("testId");
- Assertions.assertNotNull(testId2_1);
- Assertions.assertNull(testId2_1.getAttributes().get("param1"));
+ assertNotNull(testId2_1);
+ assertNull(testId2_1.getAttributes().get("param1"));
// Check the view was used
UIViewRoot root = new UIViewRoot();
@@ -836,7 +837,7 @@ public void testStaticViewParamPage1_1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
executeViewHandlerRender();
@@ -844,7 +845,7 @@ public void testStaticViewParamPage1_1() throws Exception
}
@Test
- public void testStaticViewParamPage1_2() throws Exception
+ void staticViewParamPage12() throws Exception
{
Locale locale = null;
startViewRequest("/staticViewParamPage1.xhtml");
@@ -854,7 +855,7 @@ public void testStaticViewParamPage1_2() throws Exception
executeBuildViewCycle();
UIOutput testId1_1 = (UIOutput) facesContext.getViewRoot().findComponent("testId");
- Assertions.assertNotNull(testId1_1);
+ assertNotNull(testId1_1);
// With the line below, we put something into the state. The idea is everything inside
// metadata facet should not be taken into account by the view pool
testId1_1.getAttributes().put("param1", "value1");
@@ -870,16 +871,16 @@ public void testStaticViewParamPage1_2() throws Exception
processLifecycleExecute();
UIOutput testId2_1 = (UIOutput) facesContext.getViewRoot().findComponent("testId");
- Assertions.assertNotNull(testId2_1);
+ assertNotNull(testId2_1);
// Check the state is correctly restored.
- Assertions.assertEquals("value1", testId2_1.getAttributes().get("param1"));
+ assertEquals("value1", testId2_1.getAttributes().get("param1"));
executeBuildViewCycle();
UIOutput testId3_1 = (UIOutput) facesContext.getViewRoot().findComponent("testId");
- Assertions.assertNotNull(testId3_1);
+ assertNotNull(testId3_1);
// Check the state is correctly restored.
- Assertions.assertEquals("value1", testId3_1.getAttributes().get("param1"));
+ assertEquals("value1", testId3_1.getAttributes().get("param1"));
// Check the view was used
UIViewRoot root = new UIViewRoot();
@@ -889,15 +890,15 @@ public void testStaticViewParamPage1_2() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
executeViewHandlerRender();
executeAfterRender();
}
-
+
@Test
- public void testDynamicPage1() throws Exception
+ void dynamicPage1() throws Exception
{
Locale locale = null;
startViewRequest("/dynPage1.xhtml");
@@ -921,13 +922,13 @@ public void testDynamicPage1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
}
-
+
@Test
- public void testDynamicPage1_1() throws Exception
+ void dynamicPage11() throws Exception
{
Locale locale = null;
startViewRequest("/dynPage1.xhtml");
@@ -957,20 +958,20 @@ public void testDynamicPage1_1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
//Check the component was removed
UIForm form2 = (UIForm) entry.getViewRoot().findComponent("mainForm");
- Assertions.assertNotNull(form2);
+ assertNotNull(form2);
UIOutput testComponent2 = (UIOutput) form2.findComponent("testId");
- Assertions.assertNull(testComponent2);
+ assertNull(testComponent2);
endRequest();
}
@Test
- public void testDynamicPage1_2() throws Exception
+ void dynamicPage12() throws Exception
{
Locale locale = null;
startViewRequest("/dynPage1.xhtml");
@@ -989,8 +990,8 @@ public void testDynamicPage1_2() throws Exception
processLifecycleExecute();
// Check the ViewMap is passed to the view
- Assertions.assertNotNull(facesContext.getViewRoot().getViewMap(false));
- Assertions.assertEquals("someValue", facesContext.getViewRoot().getViewMap(false).get("viewItem"));
+ assertNotNull(facesContext.getViewRoot().getViewMap(false));
+ assertEquals("someValue", facesContext.getViewRoot().getViewMap(false).get("viewItem"));
FaceletState faceletState = (FaceletState) facesContext.getViewRoot().getAttributes().get(
ComponentSupport.FACELET_STATE_INSTANCE);
@@ -1004,13 +1005,13 @@ public void testDynamicPage1_2() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
// Check the view was used
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
ViewEntry entry3 = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNull(entry3);
+ assertNull(entry3);
}
-
+
@Test
- public void testStaticPageLocale1() throws Exception
+ void staticPageLocale1() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageLocale1.xhtml");
@@ -1018,7 +1019,7 @@ public void testStaticPageLocale1() throws Exception
executeBeforeRender();
executeBuildViewCycle();
locale = facesContext.getViewRoot().getLocale();
- Assertions.assertEquals(Locale.US, locale);
+ assertEquals(Locale.US, locale);
executeViewHandlerRender();
@@ -1032,19 +1033,19 @@ public void testStaticPageLocale1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPageLocale1_1() throws Exception
+ void staticPageLocale11() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageLocale1.xhtml");
processLifecycleExecute();
locale = facesContext.getViewRoot().getLocale();
- Assertions.assertEquals(Locale.US, locale);
+ assertEquals(Locale.US, locale);
executeBuildViewCycle();
executeViewHandlerRender();
@@ -1065,22 +1066,22 @@ public void testStaticPageLocale1_1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
}
-
+
/**
* Check if the locale changes, the view IS NOT reused.
*
* @throws Exception
*/
@Test
- public void testStaticPageLocale1_2() throws Exception
+ void staticPageLocale12() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageLocale1.xhtml");
processLifecycleExecute();
locale = facesContext.getViewRoot().getLocale();
- Assertions.assertEquals(Locale.US, locale);
+ assertEquals(Locale.US, locale);
executeBuildViewCycle();
executeViewHandlerRender();
@@ -1095,7 +1096,7 @@ public void testStaticPageLocale1_2() throws Exception
startViewRequest("/staticPageLocale1.xhtml");
processLifecycleExecute();
locale = facesContext.getViewRoot().getLocale();
- Assertions.assertEquals(Locale.UK, locale);
+ assertEquals(Locale.UK, locale);
executeBuildViewCycle();
// Check the view with Locale.US was not used
@@ -1106,11 +1107,11 @@ public void testStaticPageLocale1_2() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry2);
+ assertNotNull(entry2);
}
@Test
- public void testStaticPageContract1() throws Exception
+ void staticPageContract1() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageContract1.xhtml");
@@ -1130,13 +1131,13 @@ public void testStaticPageContract1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPageContract1_1() throws Exception
+ void staticPageContract11() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageContract1.xhtml");
@@ -1162,16 +1163,16 @@ public void testStaticPageContract1_1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
}
-
+
/**
* Check if the locale changes, the view IS NOT reused.
*
* @throws Exception
*/
@Test
- public void testStaticPageContract1_2() throws Exception
+ void staticPageContract12() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageContract1.xhtml");
@@ -1204,11 +1205,11 @@ public void testStaticPageContract1_2() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry2);
+ assertNotNull(entry2);
}
-
+
@Test
- public void testDynPageResource1() throws Exception
+ void dynPageResource1() throws Exception
{
Locale locale = null;
startViewRequest("/dynPageResource.xhtml");
@@ -1231,11 +1232,11 @@ public void testDynPageResource1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry1 = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNotNull(entry1);
+ assertNotNull(entry1);
}
-
+
@Test
- public void testDynPageResource1_1() throws Exception
+ void dynPageResource11() throws Exception
{
Locale locale = null;
startViewRequest("/dynPageResource.xhtml");
@@ -1246,11 +1247,11 @@ public void testDynPageResource1_1() throws Exception
executeBuildViewCycle();
UIOutput testjs1_1 = (UIOutput) facesContext.getViewRoot().findComponent("testjs");
- Assertions.assertNotNull(testjs1_1);
+ assertNotNull(testjs1_1);
testjs1_1.getAttributes().put("param1", "value1");
List crlist = facesContext.getViewRoot().getComponentResources(facesContext, "head");
- Assertions.assertEquals(2, crlist.size());
+ assertEquals(2, crlist.size());
for(UIComponent comp : crlist)
{
comp.getAttributes().put("param2", "value2");
@@ -1268,18 +1269,18 @@ public void testDynPageResource1_1() throws Exception
executeBeforeRender();
executeBuildViewCycle();
- Assertions.assertTrue(facesContext.getViewRoot().getChildCount() > 0);
+ assertTrue(facesContext.getViewRoot().getChildCount() > 0);
UIOutput testjs2_1 = (UIOutput) facesContext.getViewRoot().findComponent("testjs");
- Assertions.assertNotNull(testjs2_1);
+ assertNotNull(testjs2_1);
// The state of the component should not be transferred.
- Assertions.assertEquals("value1",testjs2_1.getAttributes().get("param1"));
+ assertEquals("value1",testjs2_1.getAttributes().get("param1"));
List crlist2 = facesContext.getViewRoot().getComponentResources(facesContext, "head");
- Assertions.assertEquals(2, crlist2.size());
+ assertEquals(2, crlist2.size());
for(UIComponent comp : crlist)
{
- Assertions.assertEquals("value2", comp.getAttributes().get("param2"));
+ assertEquals("value2", comp.getAttributes().get("param2"));
}
UIViewRoot root = new UIViewRoot();
@@ -1291,11 +1292,11 @@ public void testDynPageResource1_1() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
// Check it was used.
- Assertions.assertNull(entry);
+ assertNull(entry);
}
-
+
@Test
- public void testDynPageResource2() throws Exception
+ void dynPageResource2() throws Exception
{
Locale locale = null;
@@ -1323,11 +1324,11 @@ public void testDynPageResource2() throws Exception
executeBuildViewCycle();
UIOutput testjs1_1 = (UIOutput) facesContext.getViewRoot().findComponent("testjs");
- Assertions.assertNotNull(testjs1_1);
+ assertNotNull(testjs1_1);
testjs1_1.getAttributes().put("param1", "value1");
List crlist = facesContext.getViewRoot().getComponentResources(facesContext, "head");
- Assertions.assertEquals(2, crlist.size());
+ assertEquals(2, crlist.size());
for(UIComponent comp : crlist)
{
comp.getAttributes().put("param2", "value2");
@@ -1345,12 +1346,12 @@ public void testDynPageResource2() throws Exception
processLifecycleExecute();
UIOutput testjs2_1 = (UIOutput) facesContext.getViewRoot().findComponent("testjs");
- Assertions.assertNotNull(testjs2_1);
+ assertNotNull(testjs2_1);
// The state of the component should not be transferred.
- Assertions.assertEquals("value1",testjs2_1.getAttributes().get("param1"));
+ assertEquals("value1",testjs2_1.getAttributes().get("param1"));
List crlist2 = facesContext.getViewRoot().getComponentResources(facesContext, "head");
- Assertions.assertEquals(2, crlist2.size());
+ assertEquals(2, crlist2.size());
/* Resource dependency components do not preserve state
for(UIComponent comp : crlist)
@@ -1370,11 +1371,11 @@ public void testDynPageResource2() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
// Check it was used.
- Assertions.assertNull(entry);
+ assertNull(entry);
}
-
+
@Test
- public void testStaticPageBinding1() throws Exception
+ void staticPageBinding1() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageBinding1.xhtml");
@@ -1384,7 +1385,7 @@ public void testStaticPageBinding1() throws Exception
executeBuildViewCycle();
UIPanel panel1 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel1");
- Assertions.assertNotNull(panel1);
+ assertNotNull(panel1);
executeViewHandlerRender();
executeAfterRender();
@@ -1397,13 +1398,13 @@ public void testStaticPageBinding1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPageBinding1_1() throws Exception
+ void staticPageBinding11() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageBinding1.xhtml");
@@ -1414,7 +1415,7 @@ public void testStaticPageBinding1_1() throws Exception
UICommand submitButton = (UICommand) facesContext.getViewRoot().findComponent("mainForm:submit");
UIPanel panel1 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel1");
- Assertions.assertNotNull(panel1);
+ assertNotNull(panel1);
executeViewHandlerRender();
executeAfterRender();
@@ -1424,7 +1425,7 @@ public void testStaticPageBinding1_1() throws Exception
processLifecycleExecute();
UIPanel panel2_1 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel1");
- Assertions.assertNotNull(panel2_1);
+ assertNotNull(panel2_1);
FaceletState faceletState = (FaceletState) facesContext.getViewRoot().getAttributes().get(
ComponentSupport.FACELET_STATE_INSTANCE);
@@ -1438,14 +1439,14 @@ public void testStaticPageBinding1_1() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
// Check the view was used
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
ViewEntry entry3 = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNull(entry3);
+ assertNull(entry3);
}
-
+
@Test
- public void testStaticPageBinding2() throws Exception
+ void staticPageBinding2() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageBinding2.xhtml");
@@ -1456,9 +1457,9 @@ public void testStaticPageBinding2() throws Exception
executeBuildViewCycle();
UIPanel panel1_2 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel2");
- Assertions.assertNotNull(panel1_2);
- Assertions.assertEquals(1, panel1_2.getChildCount());
- Assertions.assertEquals("added component through binding",
+ assertNotNull(panel1_2);
+ assertEquals(1, panel1_2.getChildCount());
+ assertEquals("added component through binding",
panel1_2.getChildren().get(0).getAttributes().get("value"));
executeViewHandlerRender();
@@ -1472,13 +1473,13 @@ public void testStaticPageBinding2() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPageBinding2_1() throws Exception
+ void staticPageBinding21() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageBinding2.xhtml");
@@ -1488,9 +1489,9 @@ public void testStaticPageBinding2_1() throws Exception
executeBuildViewCycle();
UIPanel panel1_2 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel2");
- Assertions.assertNotNull(panel1_2);
- Assertions.assertEquals(1, panel1_2.getChildCount());
- Assertions.assertEquals("added component through binding",
+ assertNotNull(panel1_2);
+ assertEquals(1, panel1_2.getChildCount());
+ assertEquals("added component through binding",
panel1_2.getChildren().get(0).getAttributes().get("value"));
UICommand submitButton = (UICommand) facesContext.getViewRoot().findComponent("mainForm:submit");
@@ -1503,9 +1504,9 @@ public void testStaticPageBinding2_1() throws Exception
processLifecycleExecute();
UIPanel panel2_2 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel2");
- Assertions.assertNotNull(panel2_2);
- Assertions.assertEquals(1, panel2_2.getChildCount());
- Assertions.assertEquals("added component through binding",
+ assertNotNull(panel2_2);
+ assertEquals(1, panel2_2.getChildCount());
+ assertEquals("added component through binding",
panel2_2.getChildren().get(0).getAttributes().get("value"));
FaceletState faceletState = (FaceletState) facesContext.getViewRoot().getAttributes().get(
@@ -1520,13 +1521,13 @@ public void testStaticPageBinding2_1() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
// Check the view was used
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
ViewEntry entry3 = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNull(entry3);
+ assertNull(entry3);
}
-
+
@Test
- public void testStaticPageBinding3() throws Exception
+ void staticPageBinding3() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageBinding3.xhtml");
@@ -1537,9 +1538,9 @@ public void testStaticPageBinding3() throws Exception
executeBuildViewCycle();
UIPanel panel1_3 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel3");
- Assertions.assertNotNull(panel1_3);
- Assertions.assertEquals(1, panel1_3.getChildCount());
- Assertions.assertEquals("added component through binding",
+ assertNotNull(panel1_3);
+ assertEquals(1, panel1_3.getChildCount());
+ assertEquals("added component through binding",
panel1_3.getChildren().get(0).getAttributes().get("value"));
executeViewHandlerRender();
@@ -1553,13 +1554,13 @@ public void testStaticPageBinding3() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
endRequest();
}
@Test
- public void testStaticPageBinding3_1() throws Exception
+ void staticPageBinding31() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageBinding3.xhtml");
@@ -1569,9 +1570,9 @@ public void testStaticPageBinding3_1() throws Exception
executeBuildViewCycle();
UIPanel panel1_3 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel3");
- Assertions.assertNotNull(panel1_3);
- Assertions.assertEquals(1, panel1_3.getChildCount());
- Assertions.assertEquals("added component through binding",
+ assertNotNull(panel1_3);
+ assertEquals(1, panel1_3.getChildCount());
+ assertEquals("added component through binding",
panel1_3.getChildren().get(0).getAttributes().get("value"));
UICommand submitButton = (UICommand) facesContext.getViewRoot().findComponent("mainForm:submit");
@@ -1584,9 +1585,9 @@ public void testStaticPageBinding3_1() throws Exception
processLifecycleExecute();
UIPanel panel2_3 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel3");
- Assertions.assertNotNull(panel2_3);
- Assertions.assertEquals(1, panel2_3.getChildCount());
- Assertions.assertEquals("added component through binding",
+ assertNotNull(panel2_3);
+ assertEquals(1, panel2_3.getChildCount());
+ assertEquals("added component through binding",
panel2_3.getChildren().get(0).getAttributes().get("value"));
FaceletState faceletState = (FaceletState) facesContext.getViewRoot().getAttributes().get(
@@ -1601,13 +1602,13 @@ public void testStaticPageBinding3_1() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
// Check the view was used
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
ViewEntry entry3 = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNull(entry3);
+ assertNull(entry3);
}
-
+
@Test
- public void testStaticPageBinding4() throws Exception
+ void staticPageBinding4() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageBinding4.xhtml");
@@ -1618,8 +1619,8 @@ public void testStaticPageBinding4() throws Exception
executeBuildViewCycle();
UIPanel panel1_4 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel4");
- Assertions.assertNotNull(panel1_4);
- Assertions.assertEquals(1, panel1_4.getChildCount());
+ assertNotNull(panel1_4);
+ assertEquals(1, panel1_4.getChildCount());
executeViewHandlerRender();
executeAfterRender();
@@ -1632,13 +1633,13 @@ public void testStaticPageBinding4() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPageBinding4_1() throws Exception
+ void staticPageBinding41() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageBinding4.xhtml");
@@ -1648,8 +1649,8 @@ public void testStaticPageBinding4_1() throws Exception
executeBuildViewCycle();
UIPanel panel1_4 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel4");
- Assertions.assertNotNull(panel1_4);
- Assertions.assertEquals(1, panel1_4.getChildCount());
+ assertNotNull(panel1_4);
+ assertEquals(1, panel1_4.getChildCount());
UICommand submitButton = (UICommand) facesContext.getViewRoot().findComponent("mainForm:submit");
@@ -1661,8 +1662,8 @@ public void testStaticPageBinding4_1() throws Exception
processLifecycleExecute();
UIPanel panel2_4 = (UIPanel) facesContext.getViewRoot().findComponent("mainForm:panel4");
- Assertions.assertNotNull(panel2_4);
- Assertions.assertEquals(1, panel2_4.getChildCount());
+ assertNotNull(panel2_4);
+ assertEquals(1, panel2_4.getChildCount());
FaceletState faceletState = (FaceletState) facesContext.getViewRoot().getAttributes().get(
ComponentSupport.FACELET_STATE_INSTANCE);
@@ -1676,13 +1677,13 @@ public void testStaticPageBinding4_1() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
// Check the view was used
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
ViewEntry entry3 = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNull(entry3);
+ assertNull(entry3);
}
-
+
@Test
- public void testStaticPageBindingValidator1() throws Exception
+ void staticPageBindingValidator1() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageBindingValidator1.xhtml");
@@ -1702,13 +1703,13 @@ public void testStaticPageBindingValidator1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPageBindingValidator1_1() throws Exception
+ void staticPageBindingValidator11() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageBindingValidator1.xhtml");
@@ -1737,12 +1738,12 @@ public void testStaticPageBindingValidator1_1() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
// Check the view was used
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
ViewEntry entry3 = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNull(entry3);
+ assertNull(entry3);
}
-
+
/**
* The existence of a converter that implements StateHolder makes the view
* not reseteable. This means the view is considered partial and force
@@ -1751,7 +1752,7 @@ public void testStaticPageBindingValidator1_1() throws Exception
* @throws Exception T
*/
@Test
- public void testStaticPageStateHolderConverter1() throws Exception
+ void staticPageStateHolderConverter1() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageStateHolderConverter1.xhtml");
@@ -1771,13 +1772,13 @@ public void testStaticPageStateHolderConverter1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPageStateHolderConverter1_1() throws Exception
+ void staticPageStateHolderConverter11() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageStateHolderConverter1.xhtml");
@@ -1806,12 +1807,12 @@ public void testStaticPageStateHolderConverter1_1() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
// Check the view was used
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
ViewEntry entry3 = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNull(entry3);
+ assertNull(entry3);
}
-
+
/**
* The existence of a converter that implements StateHolder makes the view
* not reseteable. This means the view is considered partial and force
@@ -1820,7 +1821,7 @@ public void testStaticPageStateHolderConverter1_1() throws Exception
* @throws Exception T
*/
@Test
- public void testStaticPageStateHolderConverter2() throws Exception
+ void staticPageStateHolderConverter2() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageStateHolderConverter2.xhtml");
@@ -1840,13 +1841,13 @@ public void testStaticPageStateHolderConverter2() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
endRequest();
}
-
+
@Test
- public void testStaticPageStateHolderConverter2_1() throws Exception
+ void staticPageStateHolderConverter21() throws Exception
{
Locale locale = null;
startViewRequest("/staticPageStateHolderConverter2.xhtml");
@@ -1875,14 +1876,14 @@ public void testStaticPageStateHolderConverter2_1() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
// Check the view was used
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
ViewEntry entry3 = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNull(entry3);
+ assertNull(entry3);
}
-
+
@Test
- public void testPartialPage1() throws Exception
+ void partialPage1() throws Exception
{
Locale locale = null;
startViewRequest("/partialPage1.xhtml");
@@ -1910,13 +1911,13 @@ public void testPartialPage1() throws Exception
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool viewPool = processor.getViewPool(facesContext, root);
ViewEntry entry = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNotNull(entry);
- Assertions.assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
+ assertNotNull(entry);
+ assertEquals(RestoreViewFromPoolResult.REFRESH_REQUIRED, entry.getResult());
endRequest();
}
-
+
@Test
- public void testPartialPage1_1() throws Exception
+ void partialPage11() throws Exception
{
Locale locale = null;
startViewRequest("/partialPage1.xhtml");
@@ -1952,14 +1953,14 @@ public void testPartialPage1_1() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
// Check the view was used
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
ViewEntry entry3 = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNull(entry3);
+ assertNull(entry3);
}
-
+
@Test
- public void testPartialPage1_2() throws Exception
+ void partialPage12() throws Exception
{
Locale locale = null;
startViewRequest("/partialPage1.xhtml");
@@ -1985,7 +1986,7 @@ public void testPartialPage1_2() throws Exception
processLifecycleExecute();
- Assertions.assertEquals("someValue", facesContext.getViewRoot().getViewMap().get("someKey"));
+ assertEquals("someValue", facesContext.getViewRoot().getViewMap().get("someKey"));
FaceletState faceletState = (FaceletState) facesContext.getViewRoot().getAttributes().get(
ComponentSupport.FACELET_STATE_INSTANCE);
@@ -1999,9 +2000,9 @@ public void testPartialPage1_2() throws Exception
ViewPool viewPool = processor.getViewPool(facesContext, root);
// Check the view was used
ViewEntry entry2 = viewPool.popStaticOrPartialStructureView(facesContext, root);
- Assertions.assertNull(entry2);
+ assertNull(entry2);
ViewEntry entry3 = viewPool.popDynamicStructureView(facesContext, root, faceletState);
- Assertions.assertNull(entry3);
+ assertNull(entry3);
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java
index b1b55f215f..b4699d4aec 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.pss.acid;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -49,7 +51,6 @@
import org.apache.myfaces.view.facelets.pss.acid.managed.ForEachInputSessionBean;
import org.apache.myfaces.view.facelets.pss.acid.managed.ResourceDependencyBean;
import org.apache.myfaces.view.facelets.pss.acid.managed.AcidTestBean;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class AcidMyFacesRequestTestCase extends AbstractMyFacesCDIRequestTestCase
@@ -67,17 +68,17 @@ protected void setUpWebConfigParams() throws Exception
protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
- }
-
+ }
+
@Test
- public void testIndex() throws Exception
+ void index() throws Exception
{
startViewRequest("/index.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
- Assertions.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals(1, comp.getChildCount());
+ assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
/*
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
@@ -95,8 +96,8 @@ public void testIndex() throws Exception
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
- Assertions.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals(1, comp.getChildCount());
+ assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
/*
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
Assertions.assertTrue(new String(writer2.content()).contains(
@@ -110,17 +111,17 @@ public void testIndex() throws Exception
//System.out.println(writer2.content());
endRequest();
}
-
+
@Test
- public void testInput() throws Exception
+ void input() throws Exception
{
startViewRequest("/input.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
- Assertions.assertEquals(1, comp.getChildren().get(0).getChildCount());
- Assertions.assertEquals("mainForm:input", comp.getChildren().get(0).getChildren().get(0).getClientId(facesContext));
+ assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildren().get(0).getChildCount());
+ assertEquals("mainForm:input", comp.getChildren().get(0).getChildren().get(0).getClientId(facesContext));
/*
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
Assertions.assertTrue(new String(writer1.content()).contains(
@@ -139,9 +140,9 @@ public void testInput() throws Exception
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
- Assertions.assertEquals(1, comp.getChildren().get(0).getChildCount());
- Assertions.assertEquals("mainForm:input", comp.getChildren().get(0).getChildren().get(0).getClientId(facesContext));
+ assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildren().get(0).getChildCount());
+ assertEquals("mainForm:input", comp.getChildren().get(0).getChildren().get(0).getClientId(facesContext));
/*
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
@@ -157,61 +158,61 @@ public void testInput() throws Exception
"TestComponent::encodeEnd
"));
*/
}
-
+
@Test
- public void testRecursive() throws Exception
+ void recursive() throws Exception
{
startViewRequest("/recursive.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(2, comp.getChildCount());
- Assertions.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
- Assertions.assertEquals(1, comp.getChildren().get(1).getChildCount());
- Assertions.assertEquals("Dynamically added child", comp.getChildren().get(1).getChildren().get(0).getAttributes().get("value"));
+ assertEquals(2, comp.getChildCount());
+ assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals(1, comp.getChildren().get(1).getChildCount());
+ assertEquals("Dynamically added child", comp.getChildren().get(1).getChildren().get(0).getAttributes().get("value"));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(2, comp.getChildCount());
- Assertions.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
- Assertions.assertEquals(1, comp.getChildren().get(1).getChildCount());
- Assertions.assertEquals("Dynamically added child", comp.getChildren().get(1).getChildren().get(0).getAttributes().get("value"));
+ assertEquals(2, comp.getChildCount());
+ assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals(1, comp.getChildren().get(1).getChildCount());
+ assertEquals("Dynamically added child", comp.getChildren().get(1).getChildren().get(0).getAttributes().get("value"));
endRequest();
}
-
+
@Test
- public void testStable() throws Exception
+ void stable() throws Exception
{
startViewRequest("/stable.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(3, comp.getChildCount());
- Assertions.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
- Assertions.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
- Assertions.assertEquals("text3", comp.getChildren().get(2).getId());
+ assertEquals(3, comp.getChildCount());
+ assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
+ assertEquals("text3", comp.getChildren().get(2).getId());
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(3, comp.getChildCount());
- Assertions.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
- Assertions.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
- Assertions.assertEquals("text3", comp.getChildren().get(2).getId());
+ assertEquals(3, comp.getChildCount());
+ assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
+ assertEquals("text3", comp.getChildren().get(2).getId());
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(3, comp.getChildCount());
- Assertions.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
- Assertions.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
- Assertions.assertEquals("text3", comp.getChildren().get(2).getId());
+ assertEquals(3, comp.getChildCount());
+ assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
+ assertEquals("text3", comp.getChildren().get(2).getId());
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
UIInput input = (UIInput) facesContext.getViewRoot().findComponent("mainForm:text3");
@@ -220,76 +221,76 @@ public void testStable() throws Exception
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(3, comp.getChildCount());
- Assertions.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
- Assertions.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
- Assertions.assertEquals("text3", comp.getChildren().get(2).getId());
+ assertEquals(3, comp.getChildCount());
+ assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
+ assertEquals("text3", comp.getChildren().get(2).getId());
}
-
+
@Test
- public void testTable() throws Exception
+ void table() throws Exception
{
startViewRequest("/table.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
HtmlDataTable dataTable = (HtmlDataTable) comp.getChildren().get(0);
- Assertions.assertEquals(1, dataTable.getChildCount());
+ assertEquals(1, dataTable.getChildCount());
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
dataTable = (HtmlDataTable) comp.getChildren().get(0);
- Assertions.assertEquals(1, dataTable.getChildCount());
+ assertEquals(1, dataTable.getChildCount());
}
-
+
@Test
- public void testToggle() throws Exception
+ void toggle() throws Exception
{
startViewRequest("/toggle.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(2, comp.getChildCount());
- Assertions.assertEquals("Manually added child 2
", comp.getChildren().get(0).getAttributes().get("value"));
- Assertions.assertEquals("Manually added child 1
", comp.getChildren().get(1).getAttributes().get("value"));
+ assertEquals(2, comp.getChildCount());
+ assertEquals("Manually added child 2
", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals("Manually added child 1
", comp.getChildren().get(1).getAttributes().get("value"));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(2, comp.getChildCount());
- Assertions.assertEquals("Manually added child 1
", comp.getChildren().get(0).getAttributes().get("value"));
- Assertions.assertEquals("Manually added child 2
", comp.getChildren().get(1).getAttributes().get("value"));
+ assertEquals(2, comp.getChildCount());
+ assertEquals("Manually added child 1
", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals("Manually added child 2
", comp.getChildren().get(1).getAttributes().get("value"));
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(2, comp.getChildCount());
- Assertions.assertEquals("Manually added child 2
", comp.getChildren().get(0).getAttributes().get("value"));
- Assertions.assertEquals("Manually added child 1
", comp.getChildren().get(1).getAttributes().get("value"));
+ assertEquals(2, comp.getChildCount());
+ assertEquals("Manually added child 2
", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals("Manually added child 1
", comp.getChildren().get(1).getAttributes().get("value"));
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(2, comp.getChildCount());
- Assertions.assertEquals("Manually added child 1
", comp.getChildren().get(0).getAttributes().get("value"));
- Assertions.assertEquals("Manually added child 2
", comp.getChildren().get(1).getAttributes().get("value"));
+ assertEquals(2, comp.getChildCount());
+ assertEquals("Manually added child 1
", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals("Manually added child 2
", comp.getChildren().get(1).getAttributes().get("value"));
}
-
+
@Test
- public void testInclude() throws Exception
+ void include() throws Exception
{
startViewRequest("/include.xhtml");
processLifecycleExecute();
@@ -306,11 +307,11 @@ public void testInclude() throws Exception
processLifecycleExecute();
//Check it is restored
component = facesContext.getViewRoot().findComponent("mainForm:component1");
- Assertions.assertEquals("test1", component.getAttributes().get("test"));
+ assertEquals("test1", component.getAttributes().get("test"));
renderResponse();
//Check buildView does not destroy the state
component = facesContext.getViewRoot().findComponent("mainForm:component1");
- Assertions.assertEquals("test1", component.getAttributes().get("test"));
+ assertEquals("test1", component.getAttributes().get("test"));
//Go to page2
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
@@ -319,7 +320,7 @@ public void testInclude() throws Exception
processLifecycleExecute();
component = facesContext.getViewRoot().findComponent("mainForm:component1");
//Check it is restored
- Assertions.assertEquals("test1", component.getAttributes().get("test"));
+ assertEquals("test1", component.getAttributes().get("test"));
//Build the view
facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
@@ -327,13 +328,13 @@ public void testInclude() throws Exception
//Check the page was changed and the state discarded, because it is a different component.
component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assertions.assertNull(component.getAttributes().get("test"));
+ assertNull(component.getAttributes().get("test"));
//Set a token to save on the state as delta
component.getAttributes().put("test", "test2");
renderResponse();
component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assertions.assertEquals("test2", component.getAttributes().get("test"));
+ assertEquals("test2", component.getAttributes().get("test"));
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
client.submit(button);
@@ -341,8 +342,8 @@ public void testInclude() throws Exception
processLifecycleExecute();
component = facesContext.getViewRoot().findComponent("mainForm:component2");
//Check it is restored
- Assertions.assertNotNull(component);
- Assertions.assertEquals("test2", component.getAttributes().get("test"));
+ assertNotNull(component);
+ assertEquals("test2", component.getAttributes().get("test"));
//Build the view
facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
@@ -350,7 +351,7 @@ public void testInclude() throws Exception
//Check buildView does not destroy the state
component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assertions.assertEquals("test2", component.getAttributes().get("test"));
+ assertEquals("test2", component.getAttributes().get("test"));
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
client.submit(button);
@@ -358,7 +359,7 @@ public void testInclude() throws Exception
processLifecycleExecute();
component = facesContext.getViewRoot().findComponent("mainForm:component2");
//Check it is restored
- Assertions.assertEquals("test2", component.getAttributes().get("test"));
+ assertEquals("test2", component.getAttributes().get("test"));
}
/**
@@ -368,7 +369,7 @@ public void testInclude() throws Exception
* @throws Exception
*/
@Test
- public void testInclude2() throws Exception
+ void include2() throws Exception
{
startViewRequest("/include.xhtml");
processLifecycleExecute();
@@ -377,7 +378,7 @@ public void testInclude2() throws Exception
facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
//Set a token to save on the state as delta
UIComponent component = facesContext.getViewRoot().findComponent("mainForm:component1");
- Assertions.assertNotNull(component);
+ assertNotNull(component);
renderResponse();
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page1");
@@ -386,11 +387,11 @@ public void testInclude2() throws Exception
processLifecycleExecute();
//Check it is restored
component = facesContext.getViewRoot().findComponent("mainForm:component1");
- Assertions.assertNotNull(component);
+ assertNotNull(component);
renderResponse();
//Check buildView does not destroy the state
component = facesContext.getViewRoot().findComponent("mainForm:component1");
- Assertions.assertNotNull(component);
+ assertNotNull(component);
//Go to page2
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
@@ -399,7 +400,7 @@ public void testInclude2() throws Exception
processLifecycleExecute();
component = facesContext.getViewRoot().findComponent("mainForm:component1");
//Check it is restored
- Assertions.assertNotNull(component);
+ assertNotNull(component);
//Build the view
facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
@@ -407,11 +408,11 @@ public void testInclude2() throws Exception
//Check the page was changed and the state discarded, because it is a different component.
component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assertions.assertNotNull(component);
+ assertNotNull(component);
renderResponse();
component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assertions.assertNotNull(component);
+ assertNotNull(component);
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
client.submit(button);
@@ -419,7 +420,7 @@ public void testInclude2() throws Exception
processLifecycleExecute();
component = facesContext.getViewRoot().findComponent("mainForm:component2");
//Check it is restored
- Assertions.assertNotNull(component);
+ assertNotNull(component);
//Build the view
facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
@@ -427,7 +428,7 @@ public void testInclude2() throws Exception
//Check buildView does not destroy the state
component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assertions.assertNotNull(component);
+ assertNotNull(component);
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
client.submit(button);
@@ -435,9 +436,9 @@ public void testInclude2() throws Exception
processLifecycleExecute();
component = facesContext.getViewRoot().findComponent("mainForm:component2");
//Check it is restored
- Assertions.assertNotNull(component);
+ assertNotNull(component);
}
-
+
/**
* Check if a dynamic subtree can be created from a binding property, and if it
* will be preserved across request.
@@ -456,52 +457,52 @@ public void testInclude2() throws Exception
* @throws Exception
*/
@Test
- public void testComponentBinding() throws Exception
+ void componentBinding() throws Exception
{
startViewRequest("/componentBinding1.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("panel");
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(1, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(1, comp.getChildCount());
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
// Even if in the postback two components were added, pss algorithm must replace the
// component with the one saved.
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("panel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
// Even if in the postback two components were added, pss algorithm must replace the
// component with the one saved.
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
endRequest();
}
-
+
@Test
- public void testComponentBinding2() throws Exception
+ void componentBinding2() throws Exception
{
startViewRequest("/componentBinding2.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
int fieldCount = comp.getChildCount();
Set clientIds = new TreeSet();
for (UIComponent c : comp.getChildren())
@@ -514,15 +515,15 @@ public void testComponentBinding2() throws Exception
processLifecycleExecute();
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
// Check the components are restored.
- Assertions.assertEquals(fieldCount, comp.getChildCount());
+ assertEquals(fieldCount, comp.getChildCount());
Set clientIds2 = new TreeSet();
for (UIComponent c : comp.getChildren())
{
clientIds2.add(c.getClientId(facesContext));
}
- Assertions.assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
+ assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
ComponentBindingFormBean formBean = facesContext.getApplication().evaluateExpressionGet(
facesContext, "#{componentBindingFormBean}", ComponentBindingFormBean.class);
@@ -531,7 +532,7 @@ public void testComponentBinding2() throws Exception
processLifecycleRender();
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
fieldCount = comp.getChildCount();
clientIds.clear();
for (UIComponent c : comp.getChildren())
@@ -545,14 +546,14 @@ public void testComponentBinding2() throws Exception
processLifecycleExecute();
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(fieldCount, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(fieldCount, comp.getChildCount());
clientIds2.clear();
for (UIComponent c : comp.getChildren())
{
clientIds2.add(c.getClientId(facesContext));
}
- Assertions.assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
+ assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
formBean = facesContext.getApplication().evaluateExpressionGet(
facesContext, "#{componentBindingFormBean}", ComponentBindingFormBean.class);
@@ -561,7 +562,7 @@ public void testComponentBinding2() throws Exception
processLifecycleRender();
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
fieldCount = comp.getChildCount();
clientIds.clear();
for (UIComponent c : comp.getChildren())
@@ -575,14 +576,14 @@ public void testComponentBinding2() throws Exception
processLifecycleExecute();
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(fieldCount, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(fieldCount, comp.getChildCount());
clientIds2.clear();
for (UIComponent c : comp.getChildren())
{
clientIds2.add(c.getClientId(facesContext));
}
- Assertions.assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
+ assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
formBean = facesContext.getApplication().evaluateExpressionGet(
facesContext, "#{componentBindingFormBean}", ComponentBindingFormBean.class);
@@ -591,66 +592,66 @@ public void testComponentBinding2() throws Exception
processLifecycleRender();
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
endRequest();
- }
-
+ }
+
@Test
- public void testViewParamBinding() throws Exception
+ void viewParamBinding() throws Exception
{
startViewRequest("/viewParamBinding1.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("panel");
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(1, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(1, comp.getChildCount());
UIViewParameter viewParam = (UIViewParameter) facesContext.getExternalContext().getRequestMap().get("foo");
- Assertions.assertNotNull(viewParam);
- Assertions.assertEquals("foo", viewParam.getName());
+ assertNotNull(viewParam);
+ assertEquals("foo", viewParam.getName());
UIViewParameter viewParam2 = facesContext.getApplication().evaluateExpressionGet(
facesContext, "#{componentBindingBean}", ComponentBindingBean.class).getViewParam();
- Assertions.assertNotNull(viewParam2);
- Assertions.assertEquals("foo2", viewParam2.getName());
+ assertNotNull(viewParam2);
+ assertEquals("foo2", viewParam2.getName());
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
// Even if in the postback two components were added, pss algorithm must replace the
// component with the one saved.
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("panel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
// Even if in the postback two components were added, pss algorithm must replace the
// component with the one saved.
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
endRequest();
- }
-
+ }
+
@Test
- public void testDynamicForm() throws Exception
+ void dynamicForm() throws Exception
{
startViewRequest("/dynamicForm.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:dynPanel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
int fieldCount = comp.getChildCount();
Set clientIds = new TreeSet();
for (UIComponent c : comp.getChildren())
@@ -662,19 +663,19 @@ public void testDynamicForm() throws Exception
client.submit(button);
processLifecycleExecute();
comp = facesContext.getViewRoot().findComponent("mainForm:dynPanel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
// Check the components are restored.
- Assertions.assertEquals(fieldCount, comp.getChildCount());
+ assertEquals(fieldCount, comp.getChildCount());
Set clientIds2 = new TreeSet();
for (UIComponent c : comp.getChildren())
{
clientIds2.add(c.getClientId(facesContext));
}
- Assertions.assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
+ assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
processLifecycleRender();
comp = facesContext.getViewRoot().findComponent("mainForm:dynPanel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
fieldCount = comp.getChildCount();
clientIds.clear();
for (UIComponent c : comp.getChildren())
@@ -686,20 +687,20 @@ public void testDynamicForm() throws Exception
client.submit(button);
processLifecycleExecute();
comp = facesContext.getViewRoot().findComponent("mainForm:dynPanel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
// Check the components are restored.
- Assertions.assertEquals(fieldCount, comp.getChildCount());
+ assertEquals(fieldCount, comp.getChildCount());
clientIds2.clear();
for (UIComponent c : comp.getChildren())
{
clientIds2.add(c.getClientId(facesContext));
}
- Assertions.assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
+ assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
// Check the components are restored.
processLifecycleRender();
comp = facesContext.getViewRoot().findComponent("mainForm:dynPanel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
fieldCount = comp.getChildCount();
clientIds.clear();
for (UIComponent c : comp.getChildren())
@@ -711,19 +712,19 @@ public void testDynamicForm() throws Exception
client.submit(button);
processLifecycleExecute();
comp = facesContext.getViewRoot().findComponent("mainForm:dynPanel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
// Check the components are restored.
- Assertions.assertEquals(fieldCount, comp.getChildCount());
+ assertEquals(fieldCount, comp.getChildCount());
clientIds2.clear();
for (UIComponent c : comp.getChildren())
{
clientIds2.add(c.getClientId(facesContext));
}
- Assertions.assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
+ assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
processLifecycleRender();
comp = facesContext.getViewRoot().findComponent("mainForm:dynPanel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
fieldCount = comp.getChildCount();
clientIds.clear();
for (UIComponent c : comp.getChildren())
@@ -735,19 +736,19 @@ public void testDynamicForm() throws Exception
client.submit(button);
processLifecycleExecute();
comp = facesContext.getViewRoot().findComponent("mainForm:dynPanel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
// Check the components are restored.
- Assertions.assertEquals(fieldCount, comp.getChildCount());
+ assertEquals(fieldCount, comp.getChildCount());
clientIds2.clear();
for (UIComponent c : comp.getChildren())
{
clientIds2.add(c.getClientId(facesContext));
}
- Assertions.assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
+ assertArrayEquals(clientIds.toArray(), clientIds2.toArray());
processLifecycleRender();
comp = facesContext.getViewRoot().findComponent("mainForm:dynPanel");
- Assertions.assertNotNull(comp);
+ assertNotNull(comp);
fieldCount = comp.getChildCount();
clientIds.clear();
for (UIComponent c : comp.getChildren())
@@ -757,9 +758,9 @@ public void testDynamicForm() throws Exception
endRequest();
}
-
+
@Test
- public void testResourceDependency() throws Exception
+ void resourceDependency() throws Exception
{
startViewRequest("/resourceDependency1.xhtml");
processLifecycleExecute();
@@ -768,8 +769,8 @@ public void testResourceDependency() throws Exception
executeBuildViewCycle();
UIPanel headPanel = (UIPanel) facesContext.getViewRoot().getFacet("head");
- Assertions.assertNotNull(headPanel);
- Assertions.assertEquals(1, headPanel.getChildCount());
+ assertNotNull(headPanel);
+ assertEquals(1, headPanel.getChildCount());
String nextUniqueId = facesContext.getViewRoot().createUniqueId(facesContext, null);
@@ -789,16 +790,16 @@ public void testResourceDependency() throws Exception
executeBuildViewCycle();
headPanel = (UIPanel) facesContext.getViewRoot().getFacet("head");
- Assertions.assertNotNull(headPanel);
- Assertions.assertEquals(1, headPanel.getChildCount());
- Assertions.assertNotSame(nextUniqueId, headPanel.getChildren().get(0).getId());
+ assertNotNull(headPanel);
+ assertEquals(1, headPanel.getChildCount());
+ assertNotSame(nextUniqueId, headPanel.getChildren().get(0).getId());
executeViewHandlerRender();
executeAfterRender();
}
@Test
- public void testResourceDependency2() throws Exception
+ void resourceDependency2() throws Exception
{
startViewRequest("/resourceDependency2.xhtml");
processLifecycleExecute();
@@ -807,7 +808,7 @@ public void testResourceDependency2() throws Exception
executeBuildViewCycle();
UIPanel headPanel = (UIPanel) facesContext.getViewRoot().getFacet("head");
- Assertions.assertNull(headPanel);
+ assertNull(headPanel);
String nextUniqueId = facesContext.getViewRoot().createUniqueId(facesContext, null);
@@ -827,9 +828,9 @@ public void testResourceDependency2() throws Exception
executeBuildViewCycle();
headPanel = (UIPanel) facesContext.getViewRoot().getFacet("head");
- Assertions.assertNotNull(headPanel);
- Assertions.assertTrue(1 >= headPanel.getChildCount());
- Assertions.assertNotSame(nextUniqueId, headPanel.getChildren().get(0).getId());
+ assertNotNull(headPanel);
+ assertTrue(1 >= headPanel.getChildCount());
+ assertNotSame(nextUniqueId, headPanel.getChildren().get(0).getId());
executeViewHandlerRender();
executeAfterRender();
@@ -847,8 +848,8 @@ public void testResourceDependency2() throws Exception
executeBuildViewCycle();
headPanel = (UIPanel) facesContext.getViewRoot().getFacet("head");
- Assertions.assertNotNull(headPanel);
- Assertions.assertTrue(1 >= headPanel.getChildCount());
+ assertNotNull(headPanel);
+ assertTrue(1 >= headPanel.getChildCount());
//Assertions.assertNotSame(nextUniqueId, headPanel.getChildren().get(0).getId());
executeViewHandlerRender();
@@ -867,8 +868,8 @@ public void testResourceDependency2() throws Exception
executeBuildViewCycle();
headPanel = (UIPanel) facesContext.getViewRoot().getFacet("head");
- Assertions.assertNotNull(headPanel);
- Assertions.assertTrue(1 >= headPanel.getChildCount());
+ assertNotNull(headPanel);
+ assertTrue(1 >= headPanel.getChildCount());
//Assertions.assertNotSame(nextUniqueId, headPanel.getChildren().get(0).getId());
executeViewHandlerRender();
@@ -887,8 +888,8 @@ public void testResourceDependency2() throws Exception
executeBuildViewCycle();
headPanel = (UIPanel) facesContext.getViewRoot().getFacet("head");
- Assertions.assertNotNull(headPanel);
- Assertions.assertTrue(1 >= headPanel.getChildCount());
+ assertNotNull(headPanel);
+ assertTrue(1 >= headPanel.getChildCount());
//Assertions.assertNotSame(nextUniqueId, headPanel.getChildren().get(0).getId());
executeViewHandlerRender();
@@ -896,71 +897,71 @@ public void testResourceDependency2() throws Exception
}
@Test
- public void testAddSimpleComponentVDL() throws Exception
+ void addSimpleComponentVDL() throws Exception
{
startViewRequest("/addSimpleComponentVDL.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
- Assertions.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals(1, comp.getChildCount());
+ assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
- Assertions.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
+ assertEquals(1, comp.getChildCount());
+ assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
endRequest();
}
-
+
@Test
- public void testAddSimpleIncludeVDL_1() throws Exception
+ void addSimpleIncludeVDL1() throws Exception
{
startViewRequest("/addSimpleIncludeVDL_1.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(0);
- Assertions.assertEquals(2, wrapper.getChildCount());
- Assertions.assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
+ assertEquals(2, wrapper.getChildCount());
+ assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
- Assertions.assertTrue(new String(writer1.content()).contains("Dynamically added markup"));
+ assertTrue(new String(writer1.content()).contains("Dynamically added markup"));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
wrapper = comp.getChildren().get(0);
- Assertions.assertEquals(2, wrapper.getChildCount());
- Assertions.assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
+ assertEquals(2, wrapper.getChildCount());
+ assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
- Assertions.assertTrue(new String(writer2.content()).contains("Dynamically added markup"));
+ assertTrue(new String(writer2.content()).contains("Dynamically added markup"));
endRequest();
}
-
+
@Test
- public void testAddSimpleIncludeVDL_2() throws Exception
+ void addSimpleIncludeVDL2() throws Exception
{
startViewRequest("/addSimpleIncludeVDL_2.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(0);
- Assertions.assertEquals(3, wrapper.getChildCount());
- Assertions.assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
+ assertEquals(3, wrapper.getChildCount());
+ assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content = new String(writer1.content());
- Assertions.assertTrue(content.contains("Dynamically added markup"));
- Assertions.assertTrue(content.contains("Value in param1: value1"));
- Assertions.assertTrue(content.contains("Value in param2: value2"));
+ assertTrue(content.contains("Dynamically added markup"));
+ assertTrue(content.contains("Value in param1: value1"));
+ assertTrue(content.contains("Value in param2: value2"));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
@@ -972,342 +973,342 @@ public void testAddSimpleIncludeVDL_2() throws Exception
processLifecycleRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
wrapper = comp.getChildren().get(0);
- Assertions.assertEquals(3, wrapper.getChildCount());
- Assertions.assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
+ assertEquals(3, wrapper.getChildCount());
+ assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
- Assertions.assertTrue(content2.contains("Value in param1: value1"));
- Assertions.assertTrue(content2.contains("Value in param2: otherValue2"));
+ assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Value in param1: value1"));
+ assertTrue(content2.contains("Value in param2: otherValue2"));
endRequest();
}
-
+
@Test
- public void testAddSimpleCCVDL() throws Exception
+ void addSimpleCCVDL() throws Exception
{
startViewRequest("/addSimpleCCVDL.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added header",
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added header",
ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
- Assertions.assertTrue(new String(writer1.content()).contains("Dynamically added markup"));
+ assertTrue(new String(writer1.content()).contains("Dynamically added markup"));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added header",
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added header",
ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
- Assertions.assertTrue(new String(writer2.content()).contains("Dynamically added markup"));
+ assertTrue(new String(writer2.content()).contains("Dynamically added markup"));
endRequest();
}
@Test
- public void testAddSimpleCCVDL2() throws Exception
+ void addSimpleCCVDL2() throws Exception
{
startViewRequest("/addSimpleCCVDL2.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added header"));
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added header"));
+ assertTrue(content1.contains("Dynamically added markup"));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added header"));
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added header"));
+ assertTrue(content2.contains("Dynamically added markup"));
endRequest();
}
@Test
- public void testAddSimpleCCVDL3() throws Exception
+ void addSimpleCCVDL3() throws Exception
{
startViewRequest("/addSimpleCCVDL3.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added markup"));
int indexDynHeader1_1 = content1.indexOf("Start Dynamic Header");
int indexDynHeader1_2 = content1.indexOf("Dynamically added header", indexDynHeader1_1);
int indexDynHeader1_3 = content1.indexOf("End Dynamic Header", indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_1);
- Assertions.assertNotSame(-1, indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_3);
+ assertNotSame(-1, indexDynHeader1_1);
+ assertNotSame(-1, indexDynHeader1_2);
+ assertNotSame(-1, indexDynHeader1_3);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added markup"));
int indexDynHeader1 = content2.indexOf("Start Dynamic Header");
int indexDynHeader2 = content2.indexOf("Dynamically added header", indexDynHeader1);
int indexDynHeader3 = content2.indexOf("End Dynamic Header", indexDynHeader2);
- Assertions.assertNotSame(-1, indexDynHeader1);
- Assertions.assertNotSame(-1, indexDynHeader2);
- Assertions.assertNotSame(-1, indexDynHeader3);
+ assertNotSame(-1, indexDynHeader1);
+ assertNotSame(-1, indexDynHeader2);
+ assertNotSame(-1, indexDynHeader3);
endRequest();
}
@Test
- public void testAddSimpleCCVDL4() throws Exception
+ void addSimpleCCVDL4() throws Exception
{
startViewRequest("/addSimpleCCVDL4.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added markup"));
int indexDynHeader1_1 = content1.indexOf("Start Dynamic Header");
int indexDynHeader1_2 = content1.indexOf("Dynamically added header", indexDynHeader1_1);
int indexDynHeader1_3 = content1.indexOf("End Dynamic Header", indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_1);
- Assertions.assertNotSame(-1, indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_3);
+ assertNotSame(-1, indexDynHeader1_1);
+ assertNotSame(-1, indexDynHeader1_2);
+ assertNotSame(-1, indexDynHeader1_3);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added markup"));
int indexDynHeader1 = content2.indexOf("Start Dynamic Header");
int indexDynHeader2 = content2.indexOf("Dynamically added header", indexDynHeader1);
int indexDynHeader3 = content2.indexOf("End Dynamic Header", indexDynHeader2);
- Assertions.assertNotSame(-1, indexDynHeader1);
- Assertions.assertNotSame(-1, indexDynHeader2);
- Assertions.assertNotSame(-1, indexDynHeader3);
+ assertNotSame(-1, indexDynHeader1);
+ assertNotSame(-1, indexDynHeader2);
+ assertNotSame(-1, indexDynHeader3);
endRequest();
}
-
+
@Test
- public void testAddSimpleCCVDL5() throws Exception
+ void addSimpleCCVDL5() throws Exception
{
startViewRequest("/addSimpleCCVDL5.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added markup"));
int indexDynHeader1_1 = content1.indexOf("Start Dynamic Header");
int indexDynHeader1_2 = content1.indexOf("Dynamically added header", indexDynHeader1_1);
int indexDynHeader1_3 = content1.indexOf("End Dynamic Header", indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_1);
- Assertions.assertNotSame(-1, indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_3);
+ assertNotSame(-1, indexDynHeader1_1);
+ assertNotSame(-1, indexDynHeader1_2);
+ assertNotSame(-1, indexDynHeader1_3);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added markup"));
int indexDynHeader2_1 = content2.indexOf("Start Dynamic Header");
int indexDynHeader2_2 = content2.indexOf("Dynamically added header", indexDynHeader2_1);
int indexDynHeader2_3 = content2.indexOf("End Dynamic Header", indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_1);
- Assertions.assertNotSame(-1, indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_3);
+ assertNotSame(-1, indexDynHeader2_1);
+ assertNotSame(-1, indexDynHeader2_2);
+ assertNotSame(-1, indexDynHeader2_3);
endRequest();
}
-
+
@Test
- public void testAddSimpleCCVDL6() throws Exception
+ void addSimpleCCVDL6() throws Exception
{
startViewRequest("/addSimpleCCVDL6.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added markup"));
int indexDynHeader1_1 = content1.indexOf("Start Dynamic Header");
int indexDynHeader1_2 = content1.indexOf("Dynamically added header", indexDynHeader1_1);
int indexDynHeader1_3 = content1.indexOf("End Dynamic Header", indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_1);
- Assertions.assertNotSame(-1, indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_3);
+ assertNotSame(-1, indexDynHeader1_1);
+ assertNotSame(-1, indexDynHeader1_2);
+ assertNotSame(-1, indexDynHeader1_3);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added markup"));
int indexDynHeader2_1 = content2.indexOf("Start Dynamic Header");
int indexDynHeader2_2 = content2.indexOf("Dynamically added header", indexDynHeader2_1);
int indexDynHeader2_3 = content2.indexOf("End Dynamic Header", indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_1);
- Assertions.assertNotSame(-1, indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_3);
+ assertNotSame(-1, indexDynHeader2_1);
+ assertNotSame(-1, indexDynHeader2_2);
+ assertNotSame(-1, indexDynHeader2_3);
endRequest();
}
-
+
@Test
- public void testAddSimpleCCVDL7() throws Exception
+ void addSimpleCCVDL7() throws Exception
{
startViewRequest("/addSimpleCCVDL7.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added markup"));
int indexDynHeader1_1 = content1.indexOf("Start Dynamic Header");
int indexDynHeader1_2 = content1.indexOf("Dynamically added header", indexDynHeader1_1);
int indexDynHeader1_3 = content1.indexOf("End Dynamic Header", indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_1);
- Assertions.assertNotSame(-1, indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_3);
+ assertNotSame(-1, indexDynHeader1_1);
+ assertNotSame(-1, indexDynHeader1_2);
+ assertNotSame(-1, indexDynHeader1_3);
- Assertions.assertFalse(content1.contains("This is section 1"));
+ assertFalse(content1.contains("This is section 1"));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
@@ -1322,137 +1323,137 @@ public void testAddSimpleCCVDL7() throws Exception
renderResponse();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertEquals(1, comp.getChildCount());
+ assertEquals(1, comp.getChildCount());
wrapper = comp.getChildren().get(0);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added markup"));
int indexDynHeader1 = content2.indexOf("Start Dynamic Header");
int indexDynHeader2 = content2.indexOf("Dynamically added header", indexDynHeader1);
int indexDynHeader3 = content2.indexOf("End Dynamic Header", indexDynHeader2);
- Assertions.assertNotSame(-1, indexDynHeader1);
- Assertions.assertNotSame(-1, indexDynHeader2);
- Assertions.assertNotSame(-1, indexDynHeader3);
+ assertNotSame(-1, indexDynHeader1);
+ assertNotSame(-1, indexDynHeader2);
+ assertNotSame(-1, indexDynHeader3);
- Assertions.assertTrue(content2.contains("This is section 1"));
+ assertTrue(content2.contains("This is section 1"));
endRequest();
}
@Test
- public void testComponentBindingVDL_1() throws Exception
+ void componentBindingVDL1() throws Exception
{
startViewRequest("/componentBindingVDL_1.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("panel");
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added header",
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added header",
ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added markup"));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecute();
UIComponent comp2 = facesContext.getViewRoot().findComponent("panel");
- Assertions.assertNotNull(comp2);
- Assertions.assertEquals(2, comp2.getChildCount());
+ assertNotNull(comp2);
+ assertEquals(2, comp2.getChildCount());
- Assertions.assertEquals("value1", comp2.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp2.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp2.getAttributes().get("attr1"));
+ assertEquals("value2", comp2.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp2.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added header",
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added header",
ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
renderResponse();
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added markup"));
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
UIComponent comp3 = facesContext.getViewRoot().findComponent("panel");
- Assertions.assertNotNull(comp3);
- Assertions.assertEquals(2, comp3.getChildCount());
+ assertNotNull(comp3);
+ assertEquals(2, comp3.getChildCount());
- Assertions.assertEquals("value1", comp3.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp3.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp3.getAttributes().get("attr1"));
+ assertEquals("value2", comp3.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp3.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added header",
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added header",
ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer3 = (MockPrintWriter) response.getWriter();
String content3 = new String(writer3.content());
- Assertions.assertTrue(content3.contains("Dynamically added markup"));
+ assertTrue(content3.contains("Dynamically added markup"));
endRequest();
}
-
+
@Test
- public void testComponentBindingVDL_2() throws Exception
+ void componentBindingVDL2() throws Exception
{
startViewRequest("/componentBindingVDL_2.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added header"));
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added header"));
+ assertTrue(content1.contains("Dynamically added markup"));
UIComponent ccpanel = facesContext.getViewRoot().findComponent("mainForm:ccpanel");
- Assertions.assertNotNull(ccpanel);
+ assertNotNull(ccpanel);
UIComponent ccinnerpanel = facesContext.getViewRoot().findComponent("mainForm:ccpanel:component");
- Assertions.assertNotNull(ccinnerpanel);
+ assertNotNull(ccinnerpanel);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:ccpanel:component:increment");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
CheckActionEventBean checkBean = facesContext.getApplication().evaluateExpressionGet(facesContext,
"#{checkActionEventBean}", CheckActionEventBean.class);
@@ -1461,279 +1462,279 @@ public void testComponentBindingVDL_2() throws Exception
client.submit(button);
processLifecycleExecute();
- Assertions.assertEquals(oldcount1+1, checkBean.getActionListenerCount());
+ assertEquals(oldcount1+1, checkBean.getActionListenerCount());
renderResponse();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added header"));
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added header"));
+ assertTrue(content2.contains("Dynamically added markup"));
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:ccpanel:component:increment");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
int oldcount2 = checkBean.getActionListenerCount();
client.submit(button);
processLifecycleExecute();
- Assertions.assertEquals(oldcount2+1, checkBean.getActionListenerCount());
+ assertEquals(oldcount2+1, checkBean.getActionListenerCount());
renderResponse();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer3 = (MockPrintWriter) response.getWriter();
String content3 = new String(writer3.content());
- Assertions.assertTrue(content3.contains("Dynamically added header"));
- Assertions.assertTrue(content3.contains("Dynamically added markup"));
+ assertTrue(content3.contains("Dynamically added header"));
+ assertTrue(content3.contains("Dynamically added markup"));
endRequest();
}
-
+
@Test
- public void testComponentBindingVDL_3() throws Exception
+ void componentBindingVDL3() throws Exception
{
startViewRequest("/componentBindingVDL_3.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added markup"));
int indexDynHeader1_1 = content1.indexOf("Start Dynamic Header");
int indexDynHeader1_2 = content1.indexOf("Dynamically added header", indexDynHeader1_1);
int indexDynHeader1_3 = content1.indexOf("End Dynamic Header", indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_1);
- Assertions.assertNotSame(-1, indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_3);
+ assertNotSame(-1, indexDynHeader1_1);
+ assertNotSame(-1, indexDynHeader1_2);
+ assertNotSame(-1, indexDynHeader1_3);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added markup"));
int indexDynHeader2_1 = content2.indexOf("Start Dynamic Header");
int indexDynHeader2_2 = content2.indexOf("Dynamically added header", indexDynHeader2_1);
int indexDynHeader2_3 = content2.indexOf("End Dynamic Header", indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_1);
- Assertions.assertNotSame(-1, indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_3);
+ assertNotSame(-1, indexDynHeader2_1);
+ assertNotSame(-1, indexDynHeader2_2);
+ assertNotSame(-1, indexDynHeader2_3);
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer3 = (MockPrintWriter) response.getWriter();
String content3 = new String(writer3.content());
- Assertions.assertTrue(content3.contains("Dynamically added markup"));
+ assertTrue(content3.contains("Dynamically added markup"));
int indexDynHeader3_1 = content3.indexOf("Start Dynamic Header");
int indexDynHeader3_2 = content3.indexOf("Dynamically added header", indexDynHeader3_1);
int indexDynHeader3_3 = content3.indexOf("End Dynamic Header", indexDynHeader3_2);
- Assertions.assertNotSame(-1, indexDynHeader3_1);
- Assertions.assertNotSame(-1, indexDynHeader3_2);
- Assertions.assertNotSame(-1, indexDynHeader3_3);
+ assertNotSame(-1, indexDynHeader3_1);
+ assertNotSame(-1, indexDynHeader3_2);
+ assertNotSame(-1, indexDynHeader3_3);
endRequest();
}
-
+
@Test
- public void testComponentBindingVDL_4() throws Exception
+ void componentBindingVDL4() throws Exception
{
startViewRequest("/componentBindingVDL_4.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added markup"));
int indexDynHeader1_1 = content1.indexOf("Start Dynamic Header");
int indexDynHeader1_2 = content1.indexOf("Dynamically added header", indexDynHeader1_1);
int indexDynHeader1_3 = content1.indexOf("End Dynamic Header", indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_1);
- Assertions.assertNotSame(-1, indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_3);
+ assertNotSame(-1, indexDynHeader1_1);
+ assertNotSame(-1, indexDynHeader1_2);
+ assertNotSame(-1, indexDynHeader1_3);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added markup"));
int indexDynHeader2_1 = content2.indexOf("Start Dynamic Header");
int indexDynHeader2_2 = content2.indexOf("Dynamically added header", indexDynHeader2_1);
int indexDynHeader2_3 = content2.indexOf("End Dynamic Header", indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_1);
- Assertions.assertNotSame(-1, indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_3);
+ assertNotSame(-1, indexDynHeader2_1);
+ assertNotSame(-1, indexDynHeader2_2);
+ assertNotSame(-1, indexDynHeader2_3);
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer3 = (MockPrintWriter) response.getWriter();
String content3 = new String(writer3.content());
- Assertions.assertTrue(content3.contains("Dynamically added markup"));
+ assertTrue(content3.contains("Dynamically added markup"));
int indexDynHeader3_1 = content3.indexOf("Start Dynamic Header");
int indexDynHeader3_2 = content3.indexOf("Dynamically added header", indexDynHeader3_1);
int indexDynHeader3_3 = content3.indexOf("End Dynamic Header", indexDynHeader3_2);
- Assertions.assertNotSame(-1, indexDynHeader3_1);
- Assertions.assertNotSame(-1, indexDynHeader3_2);
- Assertions.assertNotSame(-1, indexDynHeader3_3);
+ assertNotSame(-1, indexDynHeader3_1);
+ assertNotSame(-1, indexDynHeader3_2);
+ assertNotSame(-1, indexDynHeader3_3);
endRequest();
}
-
+
@Test
- public void testComponentBindingVDL_5() throws Exception
+ void componentBindingVDL5() throws Exception
{
startViewRequest("/componentBindingVDL_5.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added markup"));
int indexDynHeader1_1 = content1.indexOf("Start Dynamic Header");
int indexDynHeader1_2 = content1.indexOf("Dynamically added header", indexDynHeader1_1);
int indexDynHeader1_3 = content1.indexOf("End Dynamic Header", indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_1);
- Assertions.assertNotSame(-1, indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_3);
+ assertNotSame(-1, indexDynHeader1_1);
+ assertNotSame(-1, indexDynHeader1_2);
+ assertNotSame(-1, indexDynHeader1_3);
UIComponent ccpanel = facesContext.getViewRoot().findComponent("mainForm:ccpanel");
- Assertions.assertNotNull(ccpanel);
+ assertNotNull(ccpanel);
UIComponent ccinnerpanel = facesContext.getViewRoot().findComponent("mainForm:ccpanel:component");
- Assertions.assertNotNull(ccinnerpanel);
+ assertNotNull(ccinnerpanel);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:ccpanel:component:increment");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
CheckActionEventBean checkBean = facesContext.getApplication().evaluateExpressionGet(facesContext,
"#{checkActionEventBean}", CheckActionEventBean.class);
@@ -1742,105 +1743,105 @@ public void testComponentBindingVDL_5() throws Exception
client.submit(button);
processLifecycleExecute();
- Assertions.assertEquals(oldcount1+1, checkBean.getActionListenerCount());
+ assertEquals(oldcount1+1, checkBean.getActionListenerCount());
renderResponse();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added markup"));
int indexDynHeader2_1 = content2.indexOf("Start Dynamic Header");
int indexDynHeader2_2 = content2.indexOf("Dynamically added header", indexDynHeader2_1);
int indexDynHeader2_3 = content2.indexOf("End Dynamic Header", indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_1);
- Assertions.assertNotSame(-1, indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_3);
+ assertNotSame(-1, indexDynHeader2_1);
+ assertNotSame(-1, indexDynHeader2_2);
+ assertNotSame(-1, indexDynHeader2_3);
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:ccpanel:component:increment");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
int oldcount2 = checkBean.getActionListenerCount();
client.submit(button);
processLifecycleExecute();
- Assertions.assertEquals(oldcount2+1, checkBean.getActionListenerCount());
+ assertEquals(oldcount2+1, checkBean.getActionListenerCount());
renderResponse();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer3 = (MockPrintWriter) response.getWriter();
String content3 = new String(writer3.content());
- Assertions.assertTrue(content3.contains("Dynamically added markup"));
+ assertTrue(content3.contains("Dynamically added markup"));
int indexDynHeader3_1 = content3.indexOf("Start Dynamic Header");
int indexDynHeader3_2 = content3.indexOf("Dynamically added header", indexDynHeader3_1);
int indexDynHeader3_3 = content3.indexOf("End Dynamic Header", indexDynHeader3_2);
- Assertions.assertNotSame(-1, indexDynHeader3_1);
- Assertions.assertNotSame(-1, indexDynHeader3_2);
- Assertions.assertNotSame(-1, indexDynHeader3_3);
+ assertNotSame(-1, indexDynHeader3_1);
+ assertNotSame(-1, indexDynHeader3_2);
+ assertNotSame(-1, indexDynHeader3_3);
endRequest();
}
@Test
- public void testComponentBindingVDL_6() throws Exception
+ void componentBindingVDL6() throws Exception
{
startViewRequest("/componentBindingVDL_6.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added markup"));
int indexDynHeader1_1 = content1.indexOf("Start Dynamic Header");
int indexDynHeader1_2 = content1.indexOf("Dynamically added header", indexDynHeader1_1);
int indexDynHeader1_3 = content1.indexOf("End Dynamic Header", indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_1);
- Assertions.assertNotSame(-1, indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_3);
+ assertNotSame(-1, indexDynHeader1_1);
+ assertNotSame(-1, indexDynHeader1_2);
+ assertNotSame(-1, indexDynHeader1_3);
UIComponent ccpanel = facesContext.getViewRoot().findComponent("mainForm:ccpanel");
- Assertions.assertNotNull(ccpanel);
+ assertNotNull(ccpanel);
UIComponent ccinnerpanel = facesContext.getViewRoot().findComponent("mainForm:ccpanel:component");
- Assertions.assertNotNull(ccinnerpanel);
+ assertNotNull(ccinnerpanel);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:ccpanel:component:increment");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
CheckActionEventBean checkBean = facesContext.getApplication().evaluateExpressionGet(facesContext,
"#{checkActionEventBean}", CheckActionEventBean.class);
@@ -1849,102 +1850,102 @@ public void testComponentBindingVDL_6() throws Exception
client.submit(button);
processLifecycleExecute();
- Assertions.assertEquals(oldcount1+1, checkBean.getActionListenerCount());
+ assertEquals(oldcount1+1, checkBean.getActionListenerCount());
renderResponse();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added markup"));
int indexDynHeader2_1 = content2.indexOf("Start Dynamic Header");
int indexDynHeader2_2 = content2.indexOf("Dynamically added header", indexDynHeader2_1);
int indexDynHeader2_3 = content2.indexOf("End Dynamic Header", indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_1);
- Assertions.assertNotSame(-1, indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_3);
+ assertNotSame(-1, indexDynHeader2_1);
+ assertNotSame(-1, indexDynHeader2_2);
+ assertNotSame(-1, indexDynHeader2_3);
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:ccpanel:component:increment");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
int oldcount2 = checkBean.getActionListenerCount();
client.submit(button);
processLifecycleExecute();
- Assertions.assertEquals(oldcount2+1, checkBean.getActionListenerCount());
+ assertEquals(oldcount2+1, checkBean.getActionListenerCount());
renderResponse();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer3 = (MockPrintWriter) response.getWriter();
String content3 = new String(writer3.content());
- Assertions.assertTrue(content3.contains("Dynamically added markup"));
+ assertTrue(content3.contains("Dynamically added markup"));
int indexDynHeader3_1 = content3.indexOf("Start Dynamic Header");
int indexDynHeader3_2 = content3.indexOf("Dynamically added header", indexDynHeader3_1);
int indexDynHeader3_3 = content3.indexOf("End Dynamic Header", indexDynHeader3_2);
- Assertions.assertNotSame(-1, indexDynHeader3_1);
- Assertions.assertNotSame(-1, indexDynHeader3_2);
- Assertions.assertNotSame(-1, indexDynHeader3_3);
+ assertNotSame(-1, indexDynHeader3_1);
+ assertNotSame(-1, indexDynHeader3_2);
+ assertNotSame(-1, indexDynHeader3_3);
endRequest();
}
-
+
@Test
- public void testComponentBindingVDL_7() throws Exception
+ void componentBindingVDL7() throws Exception
{
startViewRequest("/componentBindingVDL_7.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
UIComponent wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("Dynamically added markup"));
+ assertTrue(content1.contains("Dynamically added markup"));
int indexDynHeader1_1 = content1.indexOf("Start Dynamic Header");
int indexDynHeader1_2 = content1.indexOf("Dynamically added header", indexDynHeader1_1);
int indexDynHeader1_3 = content1.indexOf("End Dynamic Header", indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_1);
- Assertions.assertNotSame(-1, indexDynHeader1_2);
- Assertions.assertNotSame(-1, indexDynHeader1_3);
+ assertNotSame(-1, indexDynHeader1_1);
+ assertNotSame(-1, indexDynHeader1_2);
+ assertNotSame(-1, indexDynHeader1_3);
- Assertions.assertFalse(content1.contains("This is section 1"));
+ assertFalse(content1.contains("This is section 1"));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
@@ -1957,34 +1958,34 @@ public void testComponentBindingVDL_7() throws Exception
sessionBean.setShowSection1(true);
renderResponse();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("Dynamically added markup"));
+ assertTrue(content2.contains("Dynamically added markup"));
int indexDynHeader2_1 = content2.indexOf("Start Dynamic Header");
int indexDynHeader2_2 = content2.indexOf("Dynamically added header", indexDynHeader2_1);
int indexDynHeader2_3 = content2.indexOf("End Dynamic Header", indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_1);
- Assertions.assertNotSame(-1, indexDynHeader2_2);
- Assertions.assertNotSame(-1, indexDynHeader2_3);
+ assertNotSame(-1, indexDynHeader2_1);
+ assertNotSame(-1, indexDynHeader2_2);
+ assertNotSame(-1, indexDynHeader2_3);
- Assertions.assertTrue(content2.contains("This is section 1"));
+ assertTrue(content2.contains("This is section 1"));
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
@@ -1993,40 +1994,40 @@ public void testComponentBindingVDL_7() throws Exception
sessionBean.setShowSection1(false);
renderResponse();
- Assertions.assertNotNull(comp);
- Assertions.assertEquals(2, comp.getChildCount());
+ assertNotNull(comp);
+ assertEquals(2, comp.getChildCount());
comp = facesContext.getViewRoot().findComponent("mainForm:panel");
- Assertions.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assertions.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
+ assertEquals("value1", comp.getAttributes().get("attr1"));
+ assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp.getChildren().get(1);
- Assertions.assertNotNull(wrapper);
- Assertions.assertTrue(UIComponent.isCompositeComponent(wrapper));
+ assertNotNull(wrapper);
+ assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(ccContent);
- Assertions.assertEquals(3, ccContent.getChildCount());
+ assertNotNull(ccContent);
+ assertEquals(3, ccContent.getChildCount());
//Assertions.assertEquals("Dynamically added header",
// ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assertions.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
+ assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer3 = (MockPrintWriter) response.getWriter();
String content3 = new String(writer3.content());
- Assertions.assertTrue(content3.contains("Dynamically added markup"));
+ assertTrue(content3.contains("Dynamically added markup"));
int indexDynHeader3_1 = content3.indexOf("Start Dynamic Header");
int indexDynHeader3_2 = content3.indexOf("Dynamically added header", indexDynHeader3_1);
int indexDynHeader3_3 = content3.indexOf("End Dynamic Header", indexDynHeader3_2);
- Assertions.assertNotSame(-1, indexDynHeader3_1);
- Assertions.assertNotSame(-1, indexDynHeader3_2);
- Assertions.assertNotSame(-1, indexDynHeader3_3);
+ assertNotSame(-1, indexDynHeader3_1);
+ assertNotSame(-1, indexDynHeader3_2);
+ assertNotSame(-1, indexDynHeader3_3);
- Assertions.assertFalse(content3.contains("This is section 1"));
+ assertFalse(content3.contains("This is section 1"));
endRequest();
}
@Test
- public void testCForEach1() throws Exception
+ void cForEach1() throws Exception
{
startViewRequest("/forEach1.xhtml");
processLifecycleExecute();
@@ -2035,16 +2036,16 @@ public void testCForEach1() throws Exception
executeBuildViewCycle();
UIOutput itemA_1 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_a");
- Assertions.assertNotNull(itemA_1);
- Assertions.assertEquals("a", itemA_1.getValue());
+ assertNotNull(itemA_1);
+ assertEquals("a", itemA_1.getValue());
itemA_1.getAttributes().put("prop", "a");
UIOutput itemB_1 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_b");
- Assertions.assertNotNull(itemB_1);
- Assertions.assertEquals("b", itemB_1.getValue());
+ assertNotNull(itemB_1);
+ assertEquals("b", itemB_1.getValue());
itemB_1.getAttributes().put("prop", "b");
UIOutput itemC_1 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_c");
- Assertions.assertNotNull(itemC_1);
- Assertions.assertEquals("c", itemC_1.getValue());
+ assertNotNull(itemC_1);
+ assertEquals("c", itemC_1.getValue());
itemC_1.getAttributes().put("prop", "c");
executeViewHandlerRender();
@@ -2055,17 +2056,17 @@ public void testCForEach1() throws Exception
processLifecycleExecute();
UIOutput itemA_2 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_a");
- Assertions.assertNotNull(itemA_2);
- Assertions.assertEquals("a", itemA_2.getValue());
- Assertions.assertEquals("a", itemA_2.getAttributes().get("prop"));
+ assertNotNull(itemA_2);
+ assertEquals("a", itemA_2.getValue());
+ assertEquals("a", itemA_2.getAttributes().get("prop"));
UIOutput itemB_2 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_b");
- Assertions.assertNotNull(itemB_2);
- Assertions.assertEquals("b", itemB_2.getValue());
- Assertions.assertEquals("b", itemB_2.getAttributes().get("prop"));
+ assertNotNull(itemB_2);
+ assertEquals("b", itemB_2.getValue());
+ assertEquals("b", itemB_2.getAttributes().get("prop"));
UIOutput itemC_2 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_c");
- Assertions.assertNotNull(itemC_2);
- Assertions.assertEquals("c", itemC_2.getValue());
- Assertions.assertEquals("c", itemC_2.getAttributes().get("prop"));
+ assertNotNull(itemC_2);
+ assertEquals("c", itemC_2.getValue());
+ assertEquals("c", itemC_2.getAttributes().get("prop"));
ForEachBean bean = facesContext.getApplication().evaluateExpressionGet(facesContext, "#{forEachBean}",
ForEachBean.class);
@@ -2077,23 +2078,23 @@ public void testCForEach1() throws Exception
executeBuildViewCycle();
UIOutput itemA_3 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_a");
- Assertions.assertNotNull(itemA_3);
- Assertions.assertEquals("a", itemA_3.getValue());
- Assertions.assertEquals("a", itemA_3.getAttributes().get("prop"));
+ assertNotNull(itemA_3);
+ assertEquals("a", itemA_3.getValue());
+ assertEquals("a", itemA_3.getAttributes().get("prop"));
UIOutput itemB_3 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_b");
- Assertions.assertNotNull(itemB_3);
- Assertions.assertEquals("b", itemB_3.getValue());
- Assertions.assertEquals("b", itemB_3.getAttributes().get("prop"));
+ assertNotNull(itemB_3);
+ assertEquals("b", itemB_3.getValue());
+ assertEquals("b", itemB_3.getAttributes().get("prop"));
UIOutput itemC_3 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_c");
- Assertions.assertNull(itemC_3);
+ assertNull(itemC_3);
UIOutput itemZ_3 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_z");
- Assertions.assertNotNull(itemZ_3);
- Assertions.assertEquals("z", itemZ_3.getValue());
- Assertions.assertNull(itemZ_3.getAttributes().get("prop"));
+ assertNotNull(itemZ_3);
+ assertEquals("z", itemZ_3.getValue());
+ assertNull(itemZ_3.getAttributes().get("prop"));
UIOutput itemX_3 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_x");
- Assertions.assertNotNull(itemX_3);
- Assertions.assertEquals("x", itemX_3.getValue());
- Assertions.assertNull(itemX_3.getAttributes().get("prop"));
+ assertNotNull(itemX_3);
+ assertEquals("x", itemX_3.getValue());
+ assertNull(itemX_3.getAttributes().get("prop"));
executeViewHandlerRender();
@@ -2103,19 +2104,19 @@ public void testCForEach1() throws Exception
processLifecycleExecute();
UIOutput itemA_4 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_a");
- Assertions.assertNotNull(itemA_4);
- Assertions.assertEquals("a", itemA_4.getValue());
+ assertNotNull(itemA_4);
+ assertEquals("a", itemA_4.getValue());
UIOutput itemB_4 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_b");
- Assertions.assertNotNull(itemB_4);
- Assertions.assertEquals("b", itemB_4.getValue());
+ assertNotNull(itemB_4);
+ assertEquals("b", itemB_4.getValue());
UIOutput itemC_4 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_c");
- Assertions.assertNull(itemC_4);
+ assertNull(itemC_4);
UIOutput itemZ_4 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_z");
- Assertions.assertNotNull(itemZ_4);
- Assertions.assertEquals("z", itemZ_4.getValue());
+ assertNotNull(itemZ_4);
+ assertEquals("z", itemZ_4.getValue());
UIOutput itemX_4 = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:item_x");
- Assertions.assertNotNull(itemX_4);
- Assertions.assertEquals("x", itemX_4.getValue());
+ assertNotNull(itemX_4);
+ assertEquals("x", itemX_4.getValue());
endRequest();
}
@@ -2125,7 +2126,7 @@ public void testCForEach1() throws Exception
* not a copy of the element saved with the view state.
*/
@Test
- public void testCForEachInputUpdatesLiveItem() throws Exception
+ void cForEachInputUpdatesLiveItem() throws Exception
{
startViewRequest("/forEachInput.xhtml");
processLifecycleExecuteAndRender();
@@ -2138,25 +2139,25 @@ public void testCForEachInputUpdatesLiveItem() throws Exception
processLifecycleExecute();
- Assertions.assertFalse(facesContext.getMessages().hasNext());
+ assertFalse(facesContext.getMessages().hasNext());
ForEachInputSessionBean sessionBean = facesContext.getApplication().evaluateExpressionGet(
facesContext, "#{forEachInputSessionBean}", ForEachInputSessionBean.class);
- Assertions.assertEquals("edited session a", sessionBean.getItems().get(0).getName());
- Assertions.assertEquals("edited session b", sessionBean.getItems().get(1).getName());
+ assertEquals("edited session a", sessionBean.getItems().get(0).getName());
+ assertEquals("edited session b", sessionBean.getItems().get(1).getName());
ForEachInputRequestBean requestBean = facesContext.getApplication().evaluateExpressionGet(
facesContext, "#{forEachInputRequestBean}", ForEachInputRequestBean.class);
- Assertions.assertEquals("edited request a", requestBean.getItems().get(0).getName());
- Assertions.assertEquals("edited request b", requestBean.getItems().get(1).getName());
+ assertEquals("edited request a", requestBean.getItems().get(0).getName());
+ assertEquals("edited request b", requestBean.getItems().get(1).getName());
executeBeforeRender();
executeBuildViewCycle();
executeViewHandlerRender();
String content = new String(((MockPrintWriter) response.getWriter()).content());
- Assertions.assertTrue(content.contains("edited session a"));
- Assertions.assertTrue(content.contains("edited request b"));
+ assertTrue(content.contains("edited session a"));
+ assertTrue(content.contains("edited request b"));
endRequest();
}
@@ -2166,18 +2167,18 @@ public void testCForEachInputUpdatesLiveItem() throws Exception
* remaining item follows its item, the value of the vanished item goes nowhere.
*/
@Test
- public void testCForEachInputItemRemovedBeforePostback() throws Exception
+ void cForEachInputItemRemovedBeforePostback() throws Exception
{
ForEachInputSessionBean bean = renderForEachInputAndEdit(items -> items.remove(0));
- Assertions.assertFalse(facesContext.getMessages().hasNext());
- Assertions.assertEquals(1, bean.getItems().size());
- Assertions.assertEquals("b", bean.getItems().get(0).getId());
- Assertions.assertEquals("edited session b", bean.getItems().get(0).getName());
+ assertFalse(facesContext.getMessages().hasNext());
+ assertEquals(1, bean.getItems().size());
+ assertEquals("b", bean.getItems().get(0).getId());
+ assertEquals("edited session b", bean.getItems().get(0).getName());
// the restored rows keep the ids of their rendered items, also while the view is built
- Assertions.assertNotNull(facesContext.getViewRoot().findComponent("mainForm:session_a"));
- Assertions.assertNotNull(facesContext.getViewRoot().findComponent("mainForm:session_b"));
+ assertNotNull(facesContext.getViewRoot().findComponent("mainForm:session_a"));
+ assertNotNull(facesContext.getViewRoot().findComponent("mainForm:session_b"));
renderAndEndRequest();
}
@@ -2187,21 +2188,21 @@ public void testCForEachInputItemRemovedBeforePostback() throws Exception
* item, the new item stays untouched.
*/
@Test
- public void testCForEachInputItemAddedBeforePostback() throws Exception
+ void cForEachInputItemAddedBeforePostback() throws Exception
{
ForEachInputSessionBean bean = renderForEachInputAndEdit(
items -> items.add(0, new ForEachInputKeyedItem("z", "original z")));
- Assertions.assertFalse(facesContext.getMessages().hasNext());
- Assertions.assertEquals(3, bean.getItems().size());
- Assertions.assertEquals("original z", bean.getItems().get(0).getName());
- Assertions.assertEquals("edited session a", bean.getItems().get(1).getName());
- Assertions.assertEquals("edited session b", bean.getItems().get(2).getName());
+ assertFalse(facesContext.getMessages().hasNext());
+ assertEquals(3, bean.getItems().size());
+ assertEquals("original z", bean.getItems().get(0).getName());
+ assertEquals("edited session a", bean.getItems().get(1).getName());
+ assertEquals("edited session b", bean.getItems().get(2).getName());
// the restored rows keep the ids of their rendered items, the new item gets no row yet
- Assertions.assertNotNull(facesContext.getViewRoot().findComponent("mainForm:session_a"));
- Assertions.assertNotNull(facesContext.getViewRoot().findComponent("mainForm:session_b"));
- Assertions.assertNull(facesContext.getViewRoot().findComponent("mainForm:session_z"));
+ assertNotNull(facesContext.getViewRoot().findComponent("mainForm:session_a"));
+ assertNotNull(facesContext.getViewRoot().findComponent("mainForm:session_b"));
+ assertNull(facesContext.getViewRoot().findComponent("mainForm:session_z"));
renderAndEndRequest();
}
@@ -2211,13 +2212,13 @@ public void testCForEachInputItemAddedBeforePostback() throws Exception
* item must neither fail nor write anything.
*/
@Test
- public void testCForEachInputLastItemRemovedBeforePostback() throws Exception
+ void cForEachInputLastItemRemovedBeforePostback() throws Exception
{
ForEachInputSessionBean bean = renderForEachInputAndEdit(items -> items.remove(1));
- Assertions.assertFalse(facesContext.getMessages().hasNext());
- Assertions.assertEquals(1, bean.getItems().size());
- Assertions.assertEquals("edited session a", bean.getItems().get(0).getName());
+ assertFalse(facesContext.getMessages().hasNext());
+ assertEquals(1, bean.getItems().size());
+ assertEquals("edited session a", bean.getItems().get(0).getName());
renderAndEndRequest();
}
@@ -2227,12 +2228,12 @@ public void testCForEachInputLastItemRemovedBeforePostback() throws Exception
* fail nor write anything.
*/
@Test
- public void testCForEachInputItemsClearedBeforePostback() throws Exception
+ void cForEachInputItemsClearedBeforePostback() throws Exception
{
ForEachInputSessionBean bean = renderForEachInputAndEdit(List::clear);
- Assertions.assertFalse(facesContext.getMessages().hasNext());
- Assertions.assertTrue(bean.getItems().isEmpty());
+ assertFalse(facesContext.getMessages().hasNext());
+ assertTrue(bean.getItems().isEmpty());
renderAndEndRequest();
}
@@ -2241,7 +2242,7 @@ public void testCForEachInputItemsClearedBeforePostback() throws Exception
* MYFACES-4775: a Set and nested c:forEach loops must update the live items as well.
*/
@Test
- public void testCForEachInputSetAndNestedUpdateLiveItems() throws Exception
+ void cForEachInputSetAndNestedUpdateLiveItems() throws Exception
{
startViewRequest("/forEachInput.xhtml");
processLifecycleExecuteAndRender();
@@ -2254,15 +2255,15 @@ public void testCForEachInputSetAndNestedUpdateLiveItems() throws Exception
processLifecycleExecute();
- Assertions.assertFalse(facesContext.getMessages().hasNext());
+ assertFalse(facesContext.getMessages().hasNext());
ForEachInputSessionBean bean = facesContext.getApplication().evaluateExpressionGet(
facesContext, "#{forEachInputSessionBean}", ForEachInputSessionBean.class);
List setItems = List.copyOf(bean.getItemSet());
- Assertions.assertEquals("edited s1", setItems.get(0).getName());
- Assertions.assertEquals("edited s2", setItems.get(1).getName());
- Assertions.assertEquals("edited g1", bean.getGroups().get(0).get(0).getName());
- Assertions.assertEquals("edited g2", bean.getGroups().get(1).get(0).getName());
+ assertEquals("edited s1", setItems.get(0).getName());
+ assertEquals("edited s2", setItems.get(1).getName());
+ assertEquals("edited g1", bean.getGroups().get(0).get(0).getName());
+ assertEquals("edited g2", bean.getGroups().get(1).get(0).getName());
renderAndEndRequest();
}
@@ -2273,14 +2274,14 @@ public void testCForEachInputSetAndNestedUpdateLiveItems() throws Exception
* first item writes nowhere, the row of the second item still updates it.
*/
@Test
- public void testCForEachGeneratedIdsItemRemovedBeforePostback() throws Exception
+ void cForEachGeneratedIdsItemRemovedBeforePostback() throws Exception
{
ForEachInputSessionBean bean = renderGeneratedIdsAndEdit("keyed", items -> items.remove(0));
- Assertions.assertFalse(facesContext.getMessages().hasNext());
- Assertions.assertEquals(1, bean.getItems().size());
- Assertions.assertEquals("b", bean.getItems().get(0).getId());
- Assertions.assertEquals("edited 2", bean.getItems().get(0).getName());
+ assertFalse(facesContext.getMessages().hasNext());
+ assertEquals(1, bean.getItems().size());
+ assertEquals("b", bean.getItems().get(0).getId());
+ assertEquals("edited 2", bean.getItems().get(0).getName());
renderAndEndRequest();
}
@@ -2290,16 +2291,16 @@ public void testCForEachGeneratedIdsItemRemovedBeforePostback() throws Exception
* row follows its item, the new item stays untouched.
*/
@Test
- public void testCForEachGeneratedIdsItemAddedBeforePostback() throws Exception
+ void cForEachGeneratedIdsItemAddedBeforePostback() throws Exception
{
ForEachInputSessionBean bean = renderGeneratedIdsAndEdit("keyed",
items -> items.add(0, new ForEachInputKeyedItem("z", "original z")));
- Assertions.assertFalse(facesContext.getMessages().hasNext());
- Assertions.assertEquals(3, bean.getItems().size());
- Assertions.assertEquals("original z", bean.getItems().get(0).getName());
- Assertions.assertEquals("edited 1", bean.getItems().get(1).getName());
- Assertions.assertEquals("edited 2", bean.getItems().get(2).getName());
+ assertFalse(facesContext.getMessages().hasNext());
+ assertEquals(3, bean.getItems().size());
+ assertEquals("original z", bean.getItems().get(0).getName());
+ assertEquals("edited 1", bean.getItems().get(1).getName());
+ assertEquals("edited 2", bean.getItems().get(2).getName());
renderAndEndRequest();
}
@@ -2309,13 +2310,13 @@ public void testCForEachGeneratedIdsItemAddedBeforePostback() throws Exception
* rendered items saved with the view state are copies, the rows update the live items by position.
*/
@Test
- public void testCForEachIdentityItemsUpdateLiveItems() throws Exception
+ void cForEachIdentityItemsUpdateLiveItems() throws Exception
{
ForEachInputSessionBean bean = renderGeneratedIdsAndEdit("identity", items -> { });
- Assertions.assertFalse(facesContext.getMessages().hasNext());
- Assertions.assertEquals("edited 1", bean.getIdentityItems().get(0).getName());
- Assertions.assertEquals("edited 2", bean.getIdentityItems().get(1).getName());
+ assertFalse(facesContext.getMessages().hasNext());
+ assertEquals("edited 1", bean.getIdentityItems().get(0).getName());
+ assertEquals("edited 2", bean.getIdentityItems().get(1).getName());
renderAndEndRequest();
}
@@ -2327,14 +2328,14 @@ public void testCForEachIdentityItemsUpdateLiveItems() throws Exception
* the row of the vanished position writes nowhere.
*/
@Test
- public void testCForEachIdentityItemsFallBackToPosition() throws Exception
+ void cForEachIdentityItemsFallBackToPosition() throws Exception
{
ForEachInputSessionBean bean = renderGeneratedIdsAndEdit("identity", items -> items.remove(0));
- Assertions.assertFalse(facesContext.getMessages().hasNext());
- Assertions.assertEquals(1, bean.getIdentityItems().size());
- Assertions.assertEquals("b", bean.getIdentityItems().get(0).getId());
- Assertions.assertEquals("edited 1", bean.getIdentityItems().get(0).getName());
+ assertFalse(facesContext.getMessages().hasNext());
+ assertEquals(1, bean.getIdentityItems().size());
+ assertEquals("b", bean.getIdentityItems().get(0).getId());
+ assertEquals("edited 1", bean.getIdentityItems().get(0).getName());
renderAndEndRequest();
}
@@ -2371,7 +2372,7 @@ private ForEachInputSessionBean renderGeneratedIdsAndEdit(String group,
facesContext.getViewRoot().findComponent("mainForm:" + group).getChildren().stream()
.filter(UIInput.class::isInstance)
.forEach(input -> clientIds.add(input.getClientId(facesContext)));
- Assertions.assertEquals(2, clientIds.size());
+ assertEquals(2, clientIds.size());
ForEachInputSessionBean bean = facesContext.getApplication().evaluateExpressionGet(
facesContext, "#{forEachInputSessionBean}", ForEachInputSessionBean.class);
@@ -2403,14 +2404,14 @@ private void renderAndEndRequest() throws Exception
* @throws Exception
*/
@Test
- public void testSimpleComponent1() throws Exception
+ void simpleComponent1() throws Exception
{
startViewRequest("/simpleComponent1.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertNotNull(comp);
- Assertions.assertTrue(comp instanceof UISimpleComponent1);
+ assertNotNull(comp);
+ assertInstanceOf(UISimpleComponent1.class, comp);
//Assertions.assertEquals(1, comp.getChildCount());
//Assertions.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
@@ -2419,21 +2420,21 @@ public void testSimpleComponent1() throws Exception
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertNotNull(comp);
- Assertions.assertTrue(comp instanceof UISimpleComponent1);
+ assertNotNull(comp);
+ assertInstanceOf(UISimpleComponent1.class, comp);
endRequest();
}
-
+
@Test
- public void testSimpleComponent2() throws Exception
+ void simpleComponent2() throws Exception
{
startViewRequest("/simpleComponent2.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertNotNull(comp);
- Assertions.assertTrue(comp instanceof UISimpleComponent2);
+ assertNotNull(comp);
+ assertInstanceOf(UISimpleComponent2.class, comp);
//Assertions.assertEquals(1, comp.getChildCount());
//Assertions.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
@@ -2442,23 +2443,23 @@ public void testSimpleComponent2() throws Exception
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assertions.assertNotNull(comp);
- Assertions.assertTrue(comp instanceof UISimpleComponent2);
+ assertNotNull(comp);
+ assertInstanceOf(UISimpleComponent2.class, comp);
endRequest();
}
-
+
@Test
- public void testUIRepeatCC1() throws Exception
+ void uIRepeatCC1() throws Exception
{
startViewRequest("/nested_ui_repeat_1.xhtml");
processLifecycleExecuteAndRender();
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
- Assertions.assertTrue(content1.contains("A-"));
- Assertions.assertTrue(content1.contains("B-"));
- Assertions.assertTrue(content1.contains("C-"));
+ assertTrue(content1.contains("A-"));
+ assertTrue(content1.contains("B-"));
+ assertTrue(content1.contains("C-"));
this.client.ajax("mainForm:j_id_7:1:j_id_8:refresh", "action",
"mainForm:j_id_7:1:j_id_8:refresh",
@@ -2468,29 +2469,29 @@ public void testUIRepeatCC1() throws Exception
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
- Assertions.assertTrue(content2.contains("mainForm:j_id_7:1:j_id_8:compToUpdate"));
- Assertions.assertTrue(content2.contains("B-"));
+ assertTrue(content2.contains("mainForm:j_id_7:1:j_id_8:compToUpdate"));
+ assertTrue(content2.contains("B-"));
endRequest();
}
@Test
- public void testOnloadScript() throws Exception
+ void onloadScript() throws Exception
{
startViewRequest("/onloadscript.xhtml");
processLifecycleExecuteAndRender();
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
- Assertions.assertTrue(new String(writer2.content()).contains("onloadScript successfully executed"));
- Assertions.assertTrue(new String(writer2.content()).contains("Remove this c:if and it will work."));
+ assertTrue(new String(writer2.content()).contains("onloadScript successfully executed"));
+ assertTrue(new String(writer2.content()).contains("Remove this c:if and it will work."));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
writer2 = (MockPrintWriter) response.getWriter();
- Assertions.assertTrue(new String(writer2.content()).contains("onloadScript successfully executed"));
- Assertions.assertTrue(new String(writer2.content()).contains("Remove this c:if and it will work."));
+ assertTrue(new String(writer2.content()).contains("onloadScript successfully executed"));
+ assertTrue(new String(writer2.content()).contains("Remove this c:if and it will work."));
endRequest();
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/pss/dynamicchild/DynamicChildInPostAddToViewTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/pss/dynamicchild/DynamicChildInPostAddToViewTestCase.java
index 3f8de457c8..f8cfa763f0 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/pss/dynamicchild/DynamicChildInPostAddToViewTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/pss/dynamicchild/DynamicChildInPostAddToViewTestCase.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.view.facelets.pss.dynamicchild;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
import java.util.List;
import jakarta.el.ExpressionFactory;
@@ -27,7 +30,6 @@
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.view.facelets.PartialStateManagementStrategy;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -35,7 +37,7 @@
* reproduces it. It must therefore not be tracked as a dynamically added component in the saved state, and the
* postback must neither lose it nor duplicate it.
*/
-public class DynamicChildInPostAddToViewTestCase extends AbstractMyFacesCDIRequestTestCase
+class DynamicChildInPostAddToViewTestCase extends AbstractMyFacesCDIRequestTestCase
{
private static final String SUBMITTED_VALUE = "submitted into a dynamically added input";
@@ -58,13 +60,13 @@ protected void setUpWebConfigParams() throws Exception
}
@Test
- public void testListenerOnViewRoot() throws Exception
+ void listenerOnViewRoot() throws Exception
{
assertBuildTimeAddIsNotSaved("/dynamicChildInViewRoot.xhtml");
}
@Test
- public void testListenerOnContainer() throws Exception
+ void listenerOnContainer() throws Exception
{
assertBuildTimeAddIsNotSaved("/dynamicChildInContainer.xhtml");
}
@@ -74,22 +76,22 @@ private void assertBuildTimeAddIsNotSaved(String viewId) throws Exception
startViewRequest(viewId);
processLifecycleExecuteAndRender();
- Assertions.assertEquals(1, countDynamicChildren(), "one added child on initial render");
- Assertions.assertFalse(isMarkedAsAddedAfterBuild(), "added child marked as added after build on initial render");
- Assertions.assertEquals(0, countClientIdsAdded(), "dynamically added components on initial render");
+ assertEquals(1, countDynamicChildren(), "one added child on initial render");
+ assertFalse(isMarkedAsAddedAfterBuild(), "added child marked as added after build on initial render");
+ assertEquals(0, countClientIdsAdded(), "dynamically added components on initial render");
client.inputText(CHILD_CLIENT_ID, SUBMITTED_VALUE);
client.submit("form:submit");
processLifecycleExecuteAndRender();
- Assertions.assertEquals(1, countDynamicChildren(), "one added child after postback");
- Assertions.assertEquals(SUBMITTED_VALUE, facesContext.getApplication().evaluateExpressionGet(facesContext,
+ assertEquals(1, countDynamicChildren(), "one added child after postback");
+ assertEquals(SUBMITTED_VALUE, facesContext.getApplication().evaluateExpressionGet(facesContext,
"#{dynamicChildInPostAddToViewBean.value}", String.class), "value decoded from the added child");
- Assertions.assertEquals(SUBMITTED_VALUE,
+ assertEquals(SUBMITTED_VALUE,
((UIInput) facesContext.getViewRoot().findComponent(CHILD_CLIENT_ID)).getValue(),
"value of the added child after postback");
- Assertions.assertFalse(isMarkedAsAddedAfterBuild(), "added child marked as added after build after postback");
- Assertions.assertEquals(0, countClientIdsAdded(), "dynamically added components after postback");
+ assertFalse(isMarkedAsAddedAfterBuild(), "added child marked as added after build after postback");
+ assertEquals(0, countClientIdsAdded(), "dynamically added components after postback");
endRequest();
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/stateless/StatelessTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/stateless/StatelessTest.java
index 68c50a2fa0..9a9a920c56 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/stateless/StatelessTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/stateless/StatelessTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.stateless;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.faces.application.StateManager;
import jakarta.faces.component.UIComponent;
import jakarta.faces.render.ResponseStateManager;
@@ -25,13 +27,12 @@
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.test.core.AbstractMyFacesRequestTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* See https://issues.apache.org/jira/browse/MYFACES-4267
*/
-public class StatelessTest extends AbstractMyFacesCDIRequestTestCase
+class StatelessTest extends AbstractMyFacesCDIRequestTestCase
{
@Override
protected void setUpWebConfigParams() throws Exception
@@ -41,19 +42,19 @@ protected void setUpWebConfigParams() throws Exception
servletContext.addInitParameter(StateManager.STATE_SAVING_METHOD_PARAM_NAME, StateManager.StateSavingMethod.SERVER.name());
servletContext.addInitParameter(MyfacesConfig.REFRESH_TRANSIENT_BUILD_ON_PSS, "auto");
}
-
+
/**
* Verify that a view with a template that has transient set can be restored
*
* @throws Exception
*/
@Test
- public void restoreStatelessTemplateView() throws Exception
+ void restoreStatelessTemplateView() throws Exception
{
startViewRequest("/stateless.xhtml");
processLifecycleExecuteAndRender();
- Assertions.assertTrue(facesContext.getViewRoot().isTransient());
+ assertTrue(facesContext.getViewRoot().isTransient());
// set the view state param so this context is treated as a postback
client.getParameters().put(ResponseStateManager.VIEW_STATE_PARAM, "stateless");
@@ -64,18 +65,18 @@ public void restoreStatelessTemplateView() throws Exception
// this will cause an exception without the fix in MYFACES-4267
restoreView();
} catch (Exception e) {
- Assertions.fail("caught an exception trying to restore a stateless view", e);
+ fail("caught an exception trying to restore a stateless view", e);
endRequest();
return;
}
- Assertions.assertNotNull(facesContext.getViewRoot());
+ assertNotNull(facesContext.getViewRoot());
// render the response and make sure the view contains the expected text
renderResponse();
String text = getRenderedContent(facesContext);
- Assertions.assertTrue(text.contains("success"));
+ assertTrue(text.contains("success"));
endRequest();
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/AbstractMyfaces4585FaceletsIntegrationTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/AbstractMyfaces4585FaceletsIntegrationTestCase.java
index d82dd005ac..7aaeb25455 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/AbstractMyfaces4585FaceletsIntegrationTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/AbstractMyfaces4585FaceletsIntegrationTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
@@ -37,7 +39,6 @@
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -86,7 +87,7 @@ protected ExpressionFactory createExpressionFactory()
}
@Test
- public void testTagAttributeConverterMethodNotLost4585() throws Exception
+ public void tagAttributeConverterMethodNotLost4585() throws Exception
{
facesContext.getExternalContext().getRequestMap().put("autoCompleteDepartmentConverter",
new DepartmentConverter());
@@ -96,9 +97,9 @@ public void testTagAttributeConverterMethodNotLost4585() throws Exception
vdl.buildView(facesContext, root, "myfaces4585_test.xhtml");
String out = render(root);
- Assertions.assertTrue(out.contains("Development"), () -> out);
- Assertions.assertTrue(out.contains("Sales"), () -> out);
- Assertions.assertTrue(out.contains("departmentName"), () -> out);
+ assertTrue(out.contains("Development"), () -> out);
+ assertTrue(out.contains("Sales"), () -> out);
+ assertTrue(out.contains("departmentName"), () -> out);
}
public static class TestViewBean
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/AbstractMyfaces4589FaceletsIntegrationTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/AbstractMyfaces4589FaceletsIntegrationTestCase.java
index a1b45f9b9b..e78c2f07d1 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/AbstractMyfaces4589FaceletsIntegrationTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/AbstractMyfaces4589FaceletsIntegrationTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.application.ProjectStage;
import jakarta.faces.application.StateManager;
@@ -26,7 +28,6 @@
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -74,7 +75,7 @@ protected ExpressionFactory createExpressionFactory()
* Asserts request beans {@code color} / {@code icon} are not shadowed inside nested composites (MYFACES-4589).
*/
@Test
- public void testExternalReproducerTagAttributeShadowing4589() throws Exception
+ public void externalReproducerTagAttributeShadowing4589() throws Exception
{
facesContext.getExternalContext().getRequestMap().put("color", new ColorBean());
facesContext.getExternalContext().getRequestMap().put("icon", new IconBean());
@@ -84,10 +85,10 @@ public void testExternalReproducerTagAttributeShadowing4589() throws Exception
vdl.buildView(facesContext, root, "myfaces4589_test.xhtml");
String out = render(root);
- Assertions.assertTrue(out.contains("color-blue-panel"), () -> out);
- Assertions.assertTrue(out.contains("pi pi-at pi-spin"), () -> out);
- Assertions.assertTrue(out.contains("color-blue"), () -> out);
- Assertions.assertTrue(out.contains("Development"), () -> out);
+ assertTrue(out.contains("color-blue-panel"), () -> out);
+ assertTrue(out.contains("pi pi-at pi-spin"), () -> out);
+ assertTrue(out.contains("color-blue"), () -> out);
+ assertTrue(out.contains("Development"), () -> out);
}
public static class ColorBean
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/TagAttributesImplTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/TagAttributesImplTest.java
index d3892db635..b4dff73fd0 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/TagAttributesImplTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/TagAttributesImplTest.java
@@ -18,42 +18,43 @@
*/
package org.apache.myfaces.view.facelets.tag;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.Arrays;
import jakarta.faces.view.facelets.TagAttribute;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TagAttributesImplTest
+class TagAttributesImplTest
{
@Test
- public void testNamespaceMapping()
+ void namespaceMapping()
{
TagAttributeImpl test1 = new TagAttributeImpl(null, "", "test1", null, "");
TagAttributeImpl test2 = new TagAttributeImpl(null, "", "test2", null, "");
TagAttributeImpl testTest1 = new TagAttributeImpl(null, "test", "test1", null, "");
TagAttributesImpl impl = new TagAttributesImpl(new TagAttribute[] { test1, test2, testTest1 });
- Assertions.assertEquals(test1, impl.get("test1"));
- Assertions.assertEquals(test2, impl.get("test2"));
+ assertEquals(test1, impl.get("test1"));
+ assertEquals(test2, impl.get("test2"));
- Assertions.assertEquals(testTest1, impl.get("test", "test1"));
+ assertEquals(testTest1, impl.get("test", "test1"));
- Assertions.assertEquals(3, Arrays.asList(impl.getAll()).size());
- Assertions.assertTrue(Arrays.asList(impl.getAll()).contains(test1));
- Assertions.assertTrue(Arrays.asList(impl.getAll()).contains(test2));
- Assertions.assertTrue(Arrays.asList(impl.getAll()).contains(testTest1));
+ assertEquals(3, Arrays.asList(impl.getAll()).size());
+ assertTrue(Arrays.asList(impl.getAll()).contains(test1));
+ assertTrue(Arrays.asList(impl.getAll()).contains(test2));
+ assertTrue(Arrays.asList(impl.getAll()).contains(testTest1));
- Assertions.assertEquals(2, Arrays.asList(impl.getAll("")).size());
- Assertions.assertTrue(Arrays.asList(impl.getAll()).contains(test1));
- Assertions.assertTrue(Arrays.asList(impl.getAll()).contains(test2));
+ assertEquals(2, Arrays.asList(impl.getAll("")).size());
+ assertTrue(Arrays.asList(impl.getAll()).contains(test1));
+ assertTrue(Arrays.asList(impl.getAll()).contains(test2));
}
-
+
@Test
- public void testNotAvailable()
+ void notAvailable()
{
TagAttributesImpl impl = new TagAttributesImpl(new TagAttribute[] { });
- Assertions.assertEquals(null, impl.get("test1"));
- Assertions.assertEquals(null, impl.get("test", "test2"));
+ assertNull(impl.get("test1"));
+ assertNull(impl.get("test", "test2"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentActionListenerTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentActionListenerTestCase.java
index fe0d297bfb..74772c2130 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentActionListenerTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentActionListenerTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.component.UICommand;
import jakarta.faces.component.UIComponent;
@@ -26,10 +28,9 @@
import jakarta.faces.event.ActionEvent;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositeComponentActionListenerTestCase extends AbstractFaceletTestCase
+class CompositeComponentActionListenerTestCase extends AbstractFaceletTestCase
{
@Override
protected void setupComponents() throws Exception
@@ -52,9 +53,9 @@ protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
}
-
+
@Test
- public void testSimpleActionListenerTarget() throws Exception
+ void simpleActionListenerTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -66,34 +67,34 @@ public void testSimpleActionListenerTarget() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UICommand button1 = (UICommand) compositeComponent1.findComponent("testComponent");
- Assertions.assertNotNull(button1);
- Assertions.assertNotNull(button1.getActionListeners());
- Assertions.assertEquals(1, button1.getActionListeners().length);
+ assertNotNull(button1);
+ assertNotNull(button1.getActionListeners());
+ assertEquals(1, button1.getActionListeners().length);
bean.setActionListener1Called(false);
button1.getActionListeners()[0].processAction(new ActionEvent(button1));
- Assertions.assertTrue(bean.isActionListener1Called());
+ assertTrue(bean.isActionListener1Called());
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UICommand button2 = (UICommand) compositeComponent2.findComponent("testComponent");
- Assertions.assertNotNull(button2);
- Assertions.assertNotNull(button2.getActionListeners());
- Assertions.assertEquals(1, button2.getActionListeners().length);
+ assertNotNull(button2);
+ assertNotNull(button2.getActionListeners());
+ assertEquals(1, button2.getActionListeners().length);
bean.setActionListener2Called(false);
button2.getActionListeners()[0].processAction(new ActionEvent(button2));
- Assertions.assertTrue(bean.isActionListener2Called());
+ assertTrue(bean.isActionListener2Called());
}
@Test
- public void testCompositeActionListenerTarget() throws Exception
+ void compositeActionListenerTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -104,41 +105,41 @@ public void testCompositeActionListenerTarget() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeActionListenerTarget.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1inner = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent1inner);
+ assertNotNull(compositeComponent1inner);
UICommand button1 = (UICommand) compositeComponent1inner.findComponent("testComponent");
- Assertions.assertNotNull(button1);
- Assertions.assertNotNull(button1.getActionListeners());
- Assertions.assertEquals(1, button1.getActionListeners().length);
+ assertNotNull(button1);
+ assertNotNull(button1.getActionListeners());
+ assertEquals(1, button1.getActionListeners().length);
bean.setActionListener1Called(false);
button1.getActionListeners()[0].processAction(new ActionEvent(button1));
- Assertions.assertTrue(bean.isActionListener1Called());
+ assertTrue(bean.isActionListener1Called());
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UINamingContainer compositeComponent2inner = (UINamingContainer) compositeComponent2.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent2inner);
+ assertNotNull(compositeComponent2inner);
UICommand button2 = (UICommand) compositeComponent2inner.findComponent("testComponent");
- Assertions.assertNotNull(button2);
- Assertions.assertNotNull(button2.getActionListeners());
- Assertions.assertEquals(1, button2.getActionListeners().length);
+ assertNotNull(button2);
+ assertNotNull(button2.getActionListeners());
+ assertEquals(1, button2.getActionListeners().length);
bean.setActionListener2Called(false);
button2.getActionListeners()[0].processAction(new ActionEvent(button2));
- Assertions.assertTrue(bean.isActionListener2Called());
+ assertTrue(bean.isActionListener2Called());
}
-
+
@Test
- public void testSimpleActionListenerTarget2() throws Exception
+ void simpleActionListenerTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -150,58 +151,58 @@ public void testSimpleActionListenerTarget2() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UICommand button1 = (UICommand) compositeComponent1.findComponent("testComponent");
- Assertions.assertNotNull(button1);
- Assertions.assertNotNull(button1.getActionListeners());
- Assertions.assertEquals(1, button1.getActionListeners().length);
+ assertNotNull(button1);
+ assertNotNull(button1.getActionListeners());
+ assertEquals(1, button1.getActionListeners().length);
bean.setActionListener1Called(false);
button1.getActionListeners()[0].processAction(new ActionEvent(button1));
- Assertions.assertTrue(bean.isActionListener1Called());
+ assertTrue(bean.isActionListener1Called());
UICommand button1n = (UICommand) compositeComponent1.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(button1n);
- Assertions.assertNotNull(button1n.getActionListeners());
- Assertions.assertEquals(1, button1n.getActionListeners().length);
+ assertNotNull(button1n);
+ assertNotNull(button1n.getActionListeners());
+ assertEquals(1, button1n.getActionListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
bean.setActionListener1Called(false);
button1n.getActionListeners()[0].processAction(new ActionEvent(button1n));
- Assertions.assertTrue(bean.isActionListener1Called());
+ assertTrue(bean.isActionListener1Called());
compositeComponent1.popComponentFromEL(facesContext);
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UICommand button2 = (UICommand) compositeComponent2.findComponent("testComponent");
- Assertions.assertNotNull(button2);
- Assertions.assertNotNull(button2.getActionListeners());
- Assertions.assertEquals(1, button2.getActionListeners().length);
+ assertNotNull(button2);
+ assertNotNull(button2.getActionListeners());
+ assertEquals(1, button2.getActionListeners().length);
bean.setActionListener2Called(false);
button2.getActionListeners()[0].processAction(new ActionEvent(button2));
- Assertions.assertTrue(bean.isActionListener2Called());
+ assertTrue(bean.isActionListener2Called());
UICommand button2n = (UICommand) compositeComponent2.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(button2n);
- Assertions.assertNotNull(button2n.getActionListeners());
- Assertions.assertEquals(1, button2n.getActionListeners().length);
+ assertNotNull(button2n);
+ assertNotNull(button2n.getActionListeners());
+ assertEquals(1, button2n.getActionListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
bean.setActionListener2Called(false);
button2n.getActionListeners()[0].processAction(new ActionEvent(button2n));
- Assertions.assertTrue(bean.isActionListener2Called());
+ assertTrue(bean.isActionListener2Called());
compositeComponent2.popComponentFromEL(facesContext);
}
@Test
- public void testCompositeActionListenerTarget2() throws Exception
+ void compositeActionListenerTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -212,120 +213,120 @@ public void testCompositeActionListenerTarget2() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeActionListenerTarget2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1target = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent1target);
+ assertNotNull(compositeComponent1target);
UICommand button1target = (UICommand) compositeComponent1target.findComponent("testComponent");
- Assertions.assertNotNull(button1target);
- Assertions.assertNotNull(button1target.getActionListeners());
- Assertions.assertEquals(1, button1target.getActionListeners().length);
+ assertNotNull(button1target);
+ assertNotNull(button1target.getActionListeners());
+ assertEquals(1, button1target.getActionListeners().length);
bean.setActionListener1Called(false);
button1target.getActionListeners()[0].processAction(new ActionEvent(button1target));
- Assertions.assertTrue(bean.isActionListener1Called());
+ assertTrue(bean.isActionListener1Called());
UICommand button1notarget = (UICommand) compositeComponent1target.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(button1notarget);
- Assertions.assertNotNull(button1notarget.getActionListeners());
- Assertions.assertEquals(1, button1notarget.getActionListeners().length);
+ assertNotNull(button1notarget);
+ assertNotNull(button1notarget.getActionListeners());
+ assertEquals(1, button1notarget.getActionListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1target.pushComponentToEL(facesContext, compositeComponent1target);
bean.setActionListener1Called(false);
button1notarget.getActionListeners()[0].processAction(new ActionEvent(button1notarget));
- Assertions.assertTrue(bean.isActionListener1Called());
+ assertTrue(bean.isActionListener1Called());
compositeComponent1target.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UINamingContainer compositeComponent1notarget = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1notarget);
+ assertNotNull(compositeComponent1notarget);
UICommand buttonnotarget1target = (UICommand) compositeComponent1notarget.findComponent("testComponent");
- Assertions.assertNotNull(buttonnotarget1target);
- Assertions.assertNotNull(buttonnotarget1target.getActionListeners());
- Assertions.assertEquals(1, buttonnotarget1target.getActionListeners().length);
+ assertNotNull(buttonnotarget1target);
+ assertNotNull(buttonnotarget1target.getActionListeners());
+ assertEquals(1, buttonnotarget1target.getActionListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1notarget.pushComponentToEL(facesContext, compositeComponent1notarget);
bean.setActionListener1Called(false);
buttonnotarget1target.getActionListeners()[0].processAction(new ActionEvent(buttonnotarget1target));
- Assertions.assertTrue(bean.isActionListener1Called());
+ assertTrue(bean.isActionListener1Called());
compositeComponent1notarget.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UICommand buttonnotarget1notarget = (UICommand) compositeComponent1notarget.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(buttonnotarget1notarget);
- Assertions.assertNotNull(buttonnotarget1notarget.getActionListeners());
- Assertions.assertEquals(1, buttonnotarget1notarget.getActionListeners().length);
+ assertNotNull(buttonnotarget1notarget);
+ assertNotNull(buttonnotarget1notarget.getActionListeners());
+ assertEquals(1, buttonnotarget1notarget.getActionListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1notarget.pushComponentToEL(facesContext, compositeComponent1notarget);
bean.setActionListener1Called(false);
buttonnotarget1notarget.getActionListeners()[0].processAction(new ActionEvent(buttonnotarget1notarget));
- Assertions.assertTrue(bean.isActionListener1Called());
+ assertTrue(bean.isActionListener1Called());
compositeComponent1notarget.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UINamingContainer compositeComponent2target = (UINamingContainer) compositeComponent2.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent2target);
+ assertNotNull(compositeComponent2target);
UICommand button2target = (UICommand) compositeComponent2target.findComponent("testComponent");
- Assertions.assertNotNull(button2target);
- Assertions.assertNotNull(button2target.getActionListeners());
- Assertions.assertEquals(1, button2target.getActionListeners().length);
+ assertNotNull(button2target);
+ assertNotNull(button2target.getActionListeners());
+ assertEquals(1, button2target.getActionListeners().length);
bean.setActionListener2Called(false);
button2target.getActionListeners()[0].processAction(new ActionEvent(button2target));
- Assertions.assertTrue(bean.isActionListener2Called());
+ assertTrue(bean.isActionListener2Called());
UICommand button2notarget = (UICommand) compositeComponent2target.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(button2notarget);
- Assertions.assertNotNull(button2notarget.getActionListeners());
- Assertions.assertEquals(1, button2notarget.getActionListeners().length);
+ assertNotNull(button2notarget);
+ assertNotNull(button2notarget.getActionListeners());
+ assertEquals(1, button2notarget.getActionListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
compositeComponent2target.pushComponentToEL(facesContext, compositeComponent2target);
bean.setActionListener2Called(false);
button2notarget.getActionListeners()[0].processAction(new ActionEvent(button2notarget));
- Assertions.assertTrue(bean.isActionListener2Called());
+ assertTrue(bean.isActionListener2Called());
compositeComponent2target.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
UINamingContainer compositeComponent2notarget = (UINamingContainer) compositeComponent2.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent2notarget);
+ assertNotNull(compositeComponent2notarget);
UICommand buttonnotarget2target = (UICommand) compositeComponent2notarget.findComponent("testComponent");
- Assertions.assertNotNull(buttonnotarget2target);
- Assertions.assertNotNull(buttonnotarget2target.getActionListeners());
- Assertions.assertEquals(1, buttonnotarget2target.getActionListeners().length);
+ assertNotNull(buttonnotarget2target);
+ assertNotNull(buttonnotarget2target.getActionListeners());
+ assertEquals(1, buttonnotarget2target.getActionListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
compositeComponent2notarget.pushComponentToEL(facesContext, compositeComponent2notarget);
bean.setActionListener2Called(false);
buttonnotarget2target.getActionListeners()[0].processAction(new ActionEvent(buttonnotarget2target));
- Assertions.assertTrue(bean.isActionListener2Called());
+ assertTrue(bean.isActionListener2Called());
compositeComponent2notarget.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
UICommand buttonnotarget2notarget = (UICommand) compositeComponent2notarget.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(buttonnotarget2notarget);
- Assertions.assertNotNull(buttonnotarget2notarget.getActionListeners());
- Assertions.assertEquals(1, buttonnotarget2notarget.getActionListeners().length);
+ assertNotNull(buttonnotarget2notarget);
+ assertNotNull(buttonnotarget2notarget.getActionListeners());
+ assertEquals(1, buttonnotarget2notarget.getActionListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
compositeComponent2notarget.pushComponentToEL(facesContext, compositeComponent2notarget);
bean.setActionListener2Called(false);
buttonnotarget2notarget.getActionListeners()[0].processAction(new ActionEvent(buttonnotarget2notarget));
- Assertions.assertTrue(bean.isActionListener2Called());
+ assertTrue(bean.isActionListener2Called());
compositeComponent2notarget.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
}
-
+
@Test
- public void testSimpleActionListenerNoTarget() throws Exception
+ void simpleActionListenerNoTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -336,44 +337,44 @@ public void testSimpleActionListenerNoTarget() throws Exception
vdl.buildView(facesContext, root, "testSimpleAttributeActionListenerNoTarget.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UICommand button1 = (UICommand) compositeComponent1.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(button1);
- Assertions.assertNotNull(button1.getActionListeners());
- Assertions.assertEquals(1, button1.getActionListeners().length);
+ assertNotNull(button1);
+ assertNotNull(button1.getActionListeners());
+ assertEquals(1, button1.getActionListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
button1.pushComponentToEL(facesContext, button1);
bean.setActionListener1Called(false);
button1.getActionListeners()[0].processAction(new ActionEvent(button1));
- Assertions.assertTrue(bean.isActionListener1Called());
+ assertTrue(bean.isActionListener1Called());
button1.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UICommand button2 = (UICommand) compositeComponent2.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(button2);
- Assertions.assertNotNull(button2.getActionListeners());
- Assertions.assertEquals(1, button2.getActionListeners().length);
+ assertNotNull(button2);
+ assertNotNull(button2.getActionListeners());
+ assertEquals(1, button2.getActionListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
button2.pushComponentToEL(facesContext, button2);
bean.setActionListener2Called(false);
button2.getActionListeners()[0].processAction(new ActionEvent(button2));
- Assertions.assertTrue(bean.isActionListener2Called());
+ assertTrue(bean.isActionListener2Called());
button2.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
}
-
+
@Test
- public void testCompositeActionListenerNoTarget() throws Exception
+ void compositeActionListenerNoTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -384,49 +385,49 @@ public void testCompositeActionListenerNoTarget() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeActionListenerNoTarget.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1inner = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeActionMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1inner);
+ assertNotNull(compositeComponent1inner);
UICommand testComponentNoTarget1 = (UICommand) compositeComponent1inner.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget1);
- Assertions.assertNotNull(testComponentNoTarget1.getActionListeners());
- Assertions.assertEquals(1, testComponentNoTarget1.getActionListeners().length);
+ assertNotNull(testComponentNoTarget1);
+ assertNotNull(testComponentNoTarget1.getActionListeners());
+ assertEquals(1, testComponentNoTarget1.getActionListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1inner);
bean.setActionListener1Called(false);
testComponentNoTarget1.getActionListeners()[0].processAction(new ActionEvent(testComponentNoTarget1));
- Assertions.assertTrue(bean.isActionListener1Called());
+ assertTrue(bean.isActionListener1Called());
compositeComponent1inner.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UINamingContainer compositeComponent2inner = (UINamingContainer) compositeComponent2.findComponent("simpleAttributeActionMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent2inner);
+ assertNotNull(compositeComponent2inner);
UICommand testComponentNoTarget2 = (UICommand) compositeComponent2inner.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget2);
- Assertions.assertNotNull(testComponentNoTarget2.getActionListeners());
- Assertions.assertEquals(1, testComponentNoTarget2.getActionListeners().length);
+ assertNotNull(testComponentNoTarget2);
+ assertNotNull(testComponentNoTarget2.getActionListeners());
+ assertEquals(1, testComponentNoTarget2.getActionListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2inner);
bean.setActionListener2Called(false);
testComponentNoTarget2.getActionListeners()[0].processAction(new ActionEvent(testComponentNoTarget2));
- Assertions.assertTrue(bean.isActionListener2Called());
+ assertTrue(bean.isActionListener2Called());
compositeComponent2inner.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
}
@Test
- public void testCompositeActionListenerNoTarget2() throws Exception
+ void compositeActionListenerNoTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -437,23 +438,23 @@ public void testCompositeActionListenerNoTarget2() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeActionListenerNoTarget2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1n1 = (UINamingContainer) compositeComponent1.findComponent("compositeAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1n1);
+ assertNotNull(compositeComponent1n1);
UINamingContainer compositeComponent1n2 = (UINamingContainer) compositeComponent1n1.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1n2);
+ assertNotNull(compositeComponent1n2);
UICommand button1 = (UICommand) compositeComponent1n2.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(button1);
- Assertions.assertNotNull(button1.getActionListeners());
- Assertions.assertEquals(1, button1.getActionListeners().length);
+ assertNotNull(button1);
+ assertNotNull(button1.getActionListeners());
+ assertEquals(1, button1.getActionListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1n2);
bean.setActionListener1Called(false);
button1.getActionListeners()[0].processAction(new ActionEvent(button1));
- Assertions.assertTrue(bean.isActionListener1Called());
+ assertTrue(bean.isActionListener1Called());
compositeComponent1n2.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentAttributeTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentAttributeTestCase.java
index cef3f6a1ed..c1e1ba5af2 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentAttributeTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentAttributeTestCase.java
@@ -19,6 +19,8 @@
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.beans.BeanDescriptor;
import java.beans.FeatureDescriptor;
import java.beans.PropertyDescriptor;
@@ -46,10 +48,9 @@
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.view.facelets.bean.DummyBean;
import org.apache.myfaces.view.facelets.bean.HelloWorld;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositeComponentAttributeTestCase extends AbstractFaceletTestCase
+class CompositeComponentAttributeTestCase extends AbstractFaceletTestCase
{
@Override
@@ -66,7 +67,7 @@ protected void setupComponents() throws Exception
* @throws Exception
*/
@Test
- public void testSimpleCompositeAttribute() throws Exception
+ void simpleCompositeAttribute() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -77,35 +78,35 @@ public void testSimpleCompositeAttribute() throws Exception
vdl.buildView(facesContext, root, "testSimpleAttributeVE.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
CompositeTestComponent compositeComponent1 = (CompositeTestComponent) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
HtmlOutputText text1 = (HtmlOutputText) facet1.findComponent("text");
- Assertions.assertNotNull(text1);
+ assertNotNull(text1);
HtmlCommandButton button1 = (HtmlCommandButton) facet1.findComponent("button");
- Assertions.assertNotNull(button1);
+ assertNotNull(button1);
HtmlInputText input1 = (HtmlInputText) facet1.findComponent("input");
- Assertions.assertNotNull(input1);
+ assertNotNull(input1);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
facet1.pushComponentToEL(facesContext, facet1);
text1.pushComponentToEL(facesContext, text1);
//set on tag
- Assertions.assertEquals(bean.getStyleClass(), text1.getStyleClass());
+ assertEquals(bean.getStyleClass(), text1.getStyleClass());
//set as default
- Assertions.assertEquals(bean.getStyle(), text1.getStyle());
+ assertEquals(bean.getStyle(), text1.getStyle());
- Assertions.assertEquals(bean.getJavaProperty(), text1.getValue());
+ assertEquals(bean.getJavaProperty(), text1.getValue());
- Assertions.assertEquals(bean.getValue(), input1.getValue());
- Assertions.assertEquals(true, input1.isRequired());
+ assertEquals(bean.getValue(), input1.getValue());
+ assertTrue(input1.isRequired());
text1.popComponentFromEL(facesContext);
button1.pushComponentToEL(facesContext, button1);
MethodExpression method = button1.getActionExpression();
- Assertions.assertEquals(bean.doSomethingFunny("xysj"), method.invoke(facesContext.getELContext(), new Object[]{"xysj"}));
+ assertEquals(bean.doSomethingFunny("xysj"), method.invoke(facesContext.getELContext(), new Object[]{"xysj"}));
button1.popComponentFromEL(facesContext);
facet1.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
@@ -123,14 +124,14 @@ public void testSimpleCompositeAttribute() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
}
-
+
/**
* Test simple attribute resolution (not set, default, normal use case).
*
* @throws Exception
*/
@Test
- public void testSimpleCompositeAttributeInsertChildren() throws Exception
+ void simpleCompositeAttributeInsertChildren() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -141,34 +142,34 @@ public void testSimpleCompositeAttributeInsertChildren() throws Exception
vdl.buildView(facesContext, root, "testSimpleAttributeVEInsertChildren.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
CompositeTestComponent compositeComponent1 = (CompositeTestComponent) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
UIComponent compositeComponent2 = facet1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UIComponent facet2 = compositeComponent2.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet2);
+ assertNotNull(facet2);
HtmlOutputText text1 = (HtmlOutputText) facet2.findComponent("text");
- Assertions.assertNotNull(text1);
+ assertNotNull(text1);
HtmlCommandButton button1 = (HtmlCommandButton) facet2.findComponent("button");
- Assertions.assertNotNull(button1);
+ assertNotNull(button1);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
facet1.pushComponentToEL(facesContext, facet1);
text1.pushComponentToEL(facesContext, text1);
//set on tag
- Assertions.assertEquals(bean.getStyleClass(), text1.getStyleClass());
+ assertEquals(bean.getStyleClass(), text1.getStyleClass());
//set as default
- Assertions.assertEquals(bean.getStyle(), text1.getStyle());
+ assertEquals(bean.getStyle(), text1.getStyle());
- Assertions.assertEquals(bean.getJavaProperty(), text1.getValue());
+ assertEquals(bean.getJavaProperty(), text1.getValue());
text1.popComponentFromEL(facesContext);
button1.pushComponentToEL(facesContext, button1);
MethodExpression method = button1.getActionExpression();
- Assertions.assertEquals(bean.doSomethingFunny("xysj"), method.invoke(facesContext.getELContext(), new Object[]{"xysj"}));
+ assertEquals(bean.doSomethingFunny("xysj"), method.invoke(facesContext.getELContext(), new Object[]{"xysj"}));
button1.popComponentFromEL(facesContext);
facet1.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
@@ -186,10 +187,10 @@ public void testSimpleCompositeAttributeInsertChildren() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
}
-
-
+
+
@Test
- public void testSimpleMethodInvocation() throws Exception
+ void simpleMethodInvocation() throws Exception
{
DummyBean dummyBean = new DummyBean();
@@ -200,27 +201,27 @@ public void testSimpleMethodInvocation() throws Exception
vdl.buildView(facesContext, root, "testSimpleMethodInvocation.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
UINamingContainer compositeComponent2 = (UINamingContainer) facet1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UIComponent facet2 = compositeComponent2.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet2);
+ assertNotNull(facet2);
UIForm form = (UIForm) facet2.findComponent("mainForm");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UICommand button1 = (UICommand) form.findComponent("button1");
- Assertions.assertNotNull(button1);
+ assertNotNull(button1);
UICommand button2 = (UICommand) form.findComponent("button2");
- Assertions.assertNotNull(button2);
+ assertNotNull(button2);
UICommand button3 = (UICommand) form.findComponent("button3");
- Assertions.assertNotNull(button3);
+ assertNotNull(button3);
UIInput text1 = (UIInput) form.findComponent("text1");
- Assertions.assertNotNull(text1);
+ assertNotNull(text1);
UIInput text2 = (UIInput) form.findComponent("text2");
- Assertions.assertNotNull(text2);
+ assertNotNull(text2);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
facet1.pushComponentToEL(facesContext, facet1);
@@ -265,9 +266,9 @@ public void testSimpleMethodInvocation() throws Exception
String resp = sw.toString();
}
-
+
@Test
- public void testCompositeActionMethodInvocation() throws Exception
+ void compositeActionMethodInvocation() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -278,19 +279,19 @@ public void testCompositeActionMethodInvocation() throws Exception
vdl.buildView(facesContext, root, "testCompositeActionMethodInvocation.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("button1");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UICommand button = (UICommand) compositeComponent2.findComponent("button2");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
- Assertions.assertNotNull(button.getActionExpression());
+ assertNotNull(button.getActionExpression());
- Assertions.assertEquals("success", button.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals("success", button.getActionExpression().invoke(facesContext.getELContext(), null));
- Assertions.assertEquals(1, button.getActionListeners().length);
+ assertEquals(1, button.getActionListeners().length);
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -299,8 +300,8 @@ public void testCompositeActionMethodInvocation() throws Exception
//root.encodeAll(facesContext);
//sw.flush();
//System.out.print(sw.toString());
- }
-
+ }
+
/**
* Tests if unspecified attributes on ,
* and are handled correctly.
@@ -308,7 +309,7 @@ public void testCompositeActionMethodInvocation() throws Exception
*/
@Test
@SuppressWarnings("unchecked")
- public void testUnspecifiedAttributes() throws Exception
+ void unspecifiedAttributes() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testInterfaceDescriptorAttributes.xhtml");
@@ -318,7 +319,7 @@ public void testUnspecifiedAttributes() throws Exception
CompositeComponentBeanInfo beanInfo =
(CompositeComponentBeanInfo) composite.getAttributes()
.get(UIComponent.BEANINFO_KEY);
- Assertions.assertNotNull(beanInfo);
+ assertNotNull(beanInfo);
// get the descriptor and check the unspecified attribute
BeanDescriptor interfaceDescriptor = beanInfo.getBeanDescriptor();
@@ -326,7 +327,7 @@ public void testUnspecifiedAttributes() throws Exception
"unspecifiedInterfaceAttribute", "unspecifiedInterfaceValue");
// check
- Assertions.assertEquals(1, beanInfo.getPropertyDescriptors().length,
+ assertEquals(1, beanInfo.getPropertyDescriptors().length,
"Expecting one ");
PropertyDescriptor attributeDescriptor = beanInfo.getPropertyDescriptors()[0];
_checkUnspecifiedAttribute(attributeDescriptor,
@@ -335,7 +336,7 @@ public void testUnspecifiedAttributes() throws Exception
// check
Map facetPropertyDescriptorMap =
(Map) interfaceDescriptor.getValue(UIComponent.FACETS_KEY);
- Assertions.assertNotNull(facetPropertyDescriptorMap);
+ assertNotNull(facetPropertyDescriptorMap);
PropertyDescriptor facetDescriptor = facetPropertyDescriptorMap.get("facet");
_checkUnspecifiedAttribute(facetDescriptor,
"unspecifiedFacetAttribute", "unspecifiedFacetValue");
@@ -351,12 +352,11 @@ private void _checkUnspecifiedAttribute(FeatureDescriptor descriptor,
final String attributeName, final String attributeValue)
{
Object value = descriptor.getValue(attributeName);
- Assertions.assertTrue(value instanceof ValueExpression,
- "Unspecified attributes must be stored as a ValueExpression");
- Assertions.assertEquals(attributeValue,
+ assertInstanceOf(ValueExpression.class, value, "Unspecified attributes must be stored as a ValueExpression");
+ assertEquals(attributeValue,
((ValueExpression) value).getValue(facesContext.getELContext()));
}
-
+
/**
* The "displayName", "shortDescription", "expert", "hidden", and "preferred"
* attributes are only exposed, if ProjectStage equals Development. This test
@@ -364,11 +364,11 @@ private void _checkUnspecifiedAttribute(FeatureDescriptor descriptor,
* @throws Exception
*/
@Test
- public void testDevelopmentValuesDevelopmentStage() throws Exception
+ void developmentValuesDevelopmentStage() throws Exception
{
_testDevelopmentValues(ProjectStage.Development);
}
-
+
/**
* The "displayName", "shortDescription", "expert", "hidden", and "preferred"
* attributes are only exposed, if ProjectStage equals Development. This test
@@ -377,7 +377,7 @@ public void testDevelopmentValuesDevelopmentStage() throws Exception
* @throws Exception
*/
@Test
- public void testDevelopmentValuesProductionStage() throws Exception
+ void developmentValuesProductionStage() throws Exception
{
_testDevelopmentValues(ProjectStage.Production);
}
@@ -404,7 +404,7 @@ private void _testDevelopmentValues(ProjectStage stage) throws Exception
CompositeComponentBeanInfo beanInfo =
(CompositeComponentBeanInfo) composite.getAttributes()
.get(UIComponent.BEANINFO_KEY);
- Assertions.assertNotNull(beanInfo);
+ assertNotNull(beanInfo);
// check
BeanDescriptor interfaceDescriptor = beanInfo.getBeanDescriptor();
@@ -412,7 +412,7 @@ private void _testDevelopmentValues(ProjectStage stage) throws Exception
"interfaceShortDescription", development);
// check
- Assertions.assertEquals(1, beanInfo.getPropertyDescriptors().length,
+ assertEquals(1, beanInfo.getPropertyDescriptors().length,
"Expecting one ");
PropertyDescriptor attributeDescriptor = beanInfo.getPropertyDescriptors()[0];
_checkDevelopmentValues(attributeDescriptor, "attributeDisplayName",
@@ -421,7 +421,7 @@ private void _testDevelopmentValues(ProjectStage stage) throws Exception
// check
Map facetPropertyDescriptorMap =
(Map) interfaceDescriptor.getValue(UIComponent.FACETS_KEY);
- Assertions.assertNotNull(facetPropertyDescriptorMap);
+ assertNotNull(facetPropertyDescriptorMap);
PropertyDescriptor facetDescriptor = facetPropertyDescriptorMap.get("facet");
_checkDevelopmentValues(facetDescriptor, "facetDisplayName",
"facetShortDescription", development);
@@ -462,15 +462,15 @@ private void _checkDevelopmentValues(FeatureDescriptor descriptor,
}
// Assertions
- Assertions.assertEquals(displayName, descriptor.getDisplayName());
- Assertions.assertEquals(shortDescription, descriptor.getShortDescription());
- Assertions.assertEquals(booleanPropertiesValue, descriptor.isExpert());
- Assertions.assertEquals(booleanPropertiesValue, descriptor.isHidden());
- Assertions.assertEquals(booleanPropertiesValue, descriptor.isPreferred());
+ assertEquals(displayName, descriptor.getDisplayName());
+ assertEquals(shortDescription, descriptor.getShortDescription());
+ assertEquals(booleanPropertiesValue, descriptor.isExpert());
+ assertEquals(booleanPropertiesValue, descriptor.isHidden());
+ assertEquals(booleanPropertiesValue, descriptor.isPreferred());
}
-
+
@Test
- public void testSimpleActionTargetAttributeName() throws Exception
+ void simpleActionTargetAttributeName() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -481,36 +481,36 @@ public void testSimpleActionTargetAttributeName() throws Exception
vdl.buildView(facesContext, root, "testActionTargetAttributeName.xhtml");
UIComponent panelGroup1 = root.findComponent("mainForm:testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.findComponent("cc1");
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
HtmlCommandButton button1 = (HtmlCommandButton) facet1.findComponent("submitButton");
- Assertions.assertNotNull(button1);
+ assertNotNull(button1);
HtmlCommandButton button2 = (HtmlCommandButton) facet1.findComponent("cancelAction");
- Assertions.assertNotNull(button2);
+ assertNotNull(button2);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
facet1.pushComponentToEL(facesContext, facet1);
button1.pushComponentToEL(facesContext, button1);
MethodExpression method = button1.getActionExpression();
- Assertions.assertEquals("testActionMethodTypeSubmit", method.invoke(facesContext.getELContext(), null));
+ assertEquals("testActionMethodTypeSubmit", method.invoke(facesContext.getELContext(), null));
- Assertions.assertEquals(1, button1.getActionListeners().length);
+ assertEquals(1, button1.getActionListeners().length);
button1.getActionListeners()[0].processAction(new ActionEvent(button1));
- Assertions.assertTrue(bean.isSubmitActionListenerCalled());
+ assertTrue(bean.isSubmitActionListenerCalled());
button1.popComponentFromEL(facesContext);
button2.pushComponentToEL(facesContext, button2);
method = button2.getActionExpression();
- Assertions.assertEquals(bean.cancelAction(), method.invoke(facesContext.getELContext(), null));
+ assertEquals(bean.cancelAction(), method.invoke(facesContext.getELContext(), null));
- Assertions.assertEquals(1, button2.getActionListeners().length);
+ assertEquals(1, button2.getActionListeners().length);
button2.getActionListeners()[0].processAction(new ActionEvent(button2));
- Assertions.assertTrue(bean.isCancelActionListenerCalled());
+ assertTrue(bean.isCancelActionListenerCalled());
button2.popComponentFromEL(facesContext);
facet1.popComponentFromEL(facesContext);
@@ -533,7 +533,7 @@ public void testSimpleActionTargetAttributeName() throws Exception
}
@Test
- public void testCompositeActionTargetAttributeName() throws Exception
+ void compositeActionTargetAttributeName() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -544,21 +544,21 @@ public void testCompositeActionTargetAttributeName() throws Exception
vdl.buildView(facesContext, root, "testCompositeActionTargetAttributeName.xhtml");
UIComponent panelGroup1 = root.findComponent("mainForm:testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.findComponent("cc1");
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
UINamingContainer compositeComponent2 = (UINamingContainer) facet1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UIComponent facet2 = compositeComponent2.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet2);
+ assertNotNull(facet2);
HtmlCommandButton button1 = (HtmlCommandButton) facet2.findComponent("submitButton");
- Assertions.assertNotNull(button1);
+ assertNotNull(button1);
HtmlCommandButton button2 = (HtmlCommandButton) facet2.findComponent("cancelAction");
- Assertions.assertNotNull(button2);
+ assertNotNull(button2);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
facet1.pushComponentToEL(facesContext, facet1);
@@ -567,21 +567,21 @@ public void testCompositeActionTargetAttributeName() throws Exception
button1.pushComponentToEL(facesContext, button1);
MethodExpression method = button1.getActionExpression();
- Assertions.assertEquals("testActionMethodTypeSubmit", method.invoke(facesContext.getELContext(), null));
+ assertEquals("testActionMethodTypeSubmit", method.invoke(facesContext.getELContext(), null));
- Assertions.assertEquals(1, button1.getActionListeners().length);
+ assertEquals(1, button1.getActionListeners().length);
button1.getActionListeners()[0].processAction(new ActionEvent(button1));
- Assertions.assertTrue(bean.isSubmitActionListenerCalled());
+ assertTrue(bean.isSubmitActionListenerCalled());
button1.popComponentFromEL(facesContext);
button2.pushComponentToEL(facesContext, button2);
method = button2.getActionExpression();
- Assertions.assertEquals(bean.cancelAction(), method.invoke(facesContext.getELContext(), null));
+ assertEquals(bean.cancelAction(), method.invoke(facesContext.getELContext(), null));
- Assertions.assertEquals(1, button2.getActionListeners().length);
+ assertEquals(1, button2.getActionListeners().length);
button2.getActionListeners()[0].processAction(new ActionEvent(button2));
- Assertions.assertTrue(bean.isCancelActionListenerCalled());
+ assertTrue(bean.isCancelActionListenerCalled());
button2.popComponentFromEL(facesContext);
facet2.popComponentFromEL(facesContext);
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentBeanValidationTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentBeanValidationTest.java
index 42d786409f..41a723a96b 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentBeanValidationTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentBeanValidationTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+
import java.io.IOException;
import jakarta.el.ValueExpression;
@@ -28,7 +31,6 @@
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.el.resolver.CompositeComponentELResolver;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -37,7 +39,7 @@
* @author Jakob Korherr (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class CompositeComponentBeanValidationTest extends AbstractFaceletTestCase
+class CompositeComponentBeanValidationTest extends AbstractFaceletTestCase
{
/**
@@ -51,7 +53,7 @@ public class CompositeComponentBeanValidationTest extends AbstractFaceletTestCas
* @throws IOException
*/
@Test
- public void testCompositeComponentExpressionHolder() throws IOException
+ void compositeComponentExpressionHolder() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testSimpleEditableValueHolder.xhtml");
@@ -62,16 +64,16 @@ public void testCompositeComponentExpressionHolder() throws IOException
// "resolve" #{cc.attrs}
CompositeComponentELResolver resolver = new CompositeComponentELResolver(MyfacesConfig.getCurrentInstance());
Object attrs = resolver.getValue(facesContext.getELContext(), compositeComponent, "attrs");
-
+
// the resolved value has to be a CompositeComponentExpressionHolder
- Assertions.assertTrue(attrs instanceof CompositeComponentExpressionHolder);
+ assertInstanceOf(CompositeComponentExpressionHolder.class, attrs);
// get the actual ValueExpression which is needed by the BeanValidator
ValueExpression valueExpression
= ((CompositeComponentExpressionHolder) attrs).getExpression("input");
-
+
// the expression String from the VE has to be #{myBean.input}
- Assertions.assertTrue("#{myBean.input}".equals(valueExpression.getExpressionString()));
+ assertEquals("#{myBean.input}", valueExpression.getExpressionString());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java
index 0bfc2769c1..76a4463a0f 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java
@@ -19,6 +19,9 @@
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.el.ExpressionFactory;
@@ -28,10 +31,9 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.view.facelets.bean.HelloWorld;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositeComponentCCRefTestCase extends AbstractFaceletTestCase
+class CompositeComponentCCRefTestCase extends AbstractFaceletTestCase
{
@Override
@@ -45,9 +47,9 @@ protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
}
-
+
@Test
- public void testCCRefOnStylesheet() throws Exception
+ void cCRefOnStylesheet() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -58,7 +60,7 @@ public void testCCRefOnStylesheet() throws Exception
vdl.buildView(facesContext, root, "testCCRefOnStylesheet.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -66,11 +68,11 @@ public void testCCRefOnStylesheet() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains(".myCustomStyle { background:red }"));
+ assertTrue(sw.toString().contains(".myCustomStyle { background:red }"));
}
-
+
@Test
- public void testCCRefOnScript() throws Exception
+ void cCRefOnScript() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -81,7 +83,7 @@ public void testCCRefOnScript() throws Exception
vdl.buildView(facesContext, root, "testCCRefOnScript.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -89,7 +91,7 @@ public void testCCRefOnScript() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains(".myCustomStyle { background:red }"));
- Assertions.assertTrue(sw.toString().contains(".myCustomScript = 'myvalue'"));
+ assertTrue(sw.toString().contains(".myCustomStyle { background:red }"));
+ assertTrue(sw.toString().contains(".myCustomScript = 'myvalue'"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCConIncludeTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCConIncludeTestCase.java
index ca1bdf4067..9e7d68b306 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCConIncludeTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCConIncludeTestCase.java
@@ -19,6 +19,8 @@
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.el.ExpressionFactory;
@@ -26,10 +28,9 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositeComponentCConIncludeTestCase extends AbstractFaceletTestCase
+class CompositeComponentCConIncludeTestCase extends AbstractFaceletTestCase
{
@Override
@@ -43,9 +44,9 @@ protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
}
-
+
@Test
- public void testCCOnInclude1() throws Exception
+ void cCOnInclude1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCConInclude1.xhtml");
@@ -59,13 +60,13 @@ public void testCCOnInclude1() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("value1"));
- Assertions.assertTrue(sw.toString().contains("value2"));
- Assertions.assertTrue(sw.toString().contains("value3"));
+ assertTrue(sw.toString().contains("value1"));
+ assertTrue(sw.toString().contains("value2"));
+ assertTrue(sw.toString().contains("value3"));
}
-
+
@Test
- public void testCCOnInclude2() throws Exception
+ void cCOnInclude2() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCConInclude2.xhtml");
@@ -79,8 +80,8 @@ public void testCCOnInclude2() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("value1"));
- Assertions.assertTrue(sw.toString().contains("value2"));
- Assertions.assertTrue(sw.toString().contains("value3"));
+ assertTrue(sw.toString().contains("value1"));
+ assertTrue(sw.toString().contains("value2"));
+ assertTrue(sw.toString().contains("value3"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentClientBehaviorTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentClientBehaviorTestCase.java
index e24f1cb600..af61510e59 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentClientBehaviorTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentClientBehaviorTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.faces.component.UICommand;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UINamingContainer;
@@ -25,13 +27,12 @@
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.view.facelets.bean.HelloWorld;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositeComponentClientBehaviorTestCase extends AbstractFaceletTestCase
+class CompositeComponentClientBehaviorTestCase extends AbstractFaceletTestCase
{
@Test
- public void testSimpleClientBehavior() throws Exception
+ void simpleClientBehavior() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -42,13 +43,13 @@ public void testSimpleClientBehavior() throws Exception
vdl.buildView(facesContext, root, "testSimpleClientBehavior.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
- Assertions.assertNotNull(button);
- Assertions.assertNotNull(button.getClientBehaviors().get("action"));
- Assertions.assertEquals(1, button.getClientBehaviors().get("action").size());
+ assertNotNull(button);
+ assertNotNull(button.getClientBehaviors().get("action"));
+ assertEquals(1, button.getClientBehaviors().get("action").size());
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -58,9 +59,9 @@ public void testSimpleClientBehavior() throws Exception
//sw.flush();
//System.out.print(sw.toString());
}
-
+
@Test
- public void testSimpleClientBehaviorDefault() throws Exception
+ void simpleClientBehaviorDefault() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -71,13 +72,13 @@ public void testSimpleClientBehaviorDefault() throws Exception
vdl.buildView(facesContext, root, "testSimpleClientBehaviorDefault.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
- Assertions.assertNotNull(button);
- Assertions.assertNotNull(button.getClientBehaviors().get("dblclick"));
- Assertions.assertEquals(1, button.getClientBehaviors().get("dblclick").size());
+ assertNotNull(button);
+ assertNotNull(button.getClientBehaviors().get("dblclick"));
+ assertEquals(1, button.getClientBehaviors().get("dblclick").size());
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -89,7 +90,7 @@ public void testSimpleClientBehaviorDefault() throws Exception
}
@Test
- public void testSimpleClientBehaviorDefaultNoEvent() throws Exception
+ void simpleClientBehaviorDefaultNoEvent() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -100,13 +101,13 @@ public void testSimpleClientBehaviorDefaultNoEvent() throws Exception
vdl.buildView(facesContext, root, "testSimpleClientBehaviorDefaultNoEvent.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
- Assertions.assertNotNull(button);
- Assertions.assertNotNull(button.getClientBehaviors().get("action"));
- Assertions.assertEquals(1, button.getClientBehaviors().get("action").size());
+ assertNotNull(button);
+ assertNotNull(button.getClientBehaviors().get("action"));
+ assertEquals(1, button.getClientBehaviors().get("action").size());
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -118,7 +119,7 @@ public void testSimpleClientBehaviorDefaultNoEvent() throws Exception
}
@Test
- public void testSimpleClientBehaviorAjaxWrap() throws Exception
+ void simpleClientBehaviorAjaxWrap() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -129,13 +130,13 @@ public void testSimpleClientBehaviorAjaxWrap() throws Exception
vdl.buildView(facesContext, root, "testSimpleClientBehaviorAjaxWrap.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
- Assertions.assertNotNull(button);
- Assertions.assertNotNull(button.getClientBehaviors().get("action"));
- Assertions.assertEquals(1, button.getClientBehaviors().get("action").size());
+ assertNotNull(button);
+ assertNotNull(button.getClientBehaviors().get("action"));
+ assertEquals(1, button.getClientBehaviors().get("action").size());
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -147,7 +148,7 @@ public void testSimpleClientBehaviorAjaxWrap() throws Exception
}
@Test
- public void testSimpleClientBehaviorDefaultAjaxWrap() throws Exception
+ void simpleClientBehaviorDefaultAjaxWrap() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -158,13 +159,13 @@ public void testSimpleClientBehaviorDefaultAjaxWrap() throws Exception
vdl.buildView(facesContext, root, "testSimpleClientBehaviorDefaultAjaxWrap.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
- Assertions.assertNotNull(button);
- Assertions.assertNotNull(button.getClientBehaviors().get("dblclick"));
- Assertions.assertEquals(1, button.getClientBehaviors().get("dblclick").size());
+ assertNotNull(button);
+ assertNotNull(button.getClientBehaviors().get("dblclick"));
+ assertEquals(1, button.getClientBehaviors().get("dblclick").size());
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -176,7 +177,7 @@ public void testSimpleClientBehaviorDefaultAjaxWrap() throws Exception
}
@Test
- public void testSimpleClientBehaviorDefaultNoEventAjaxWrap() throws Exception
+ void simpleClientBehaviorDefaultNoEventAjaxWrap() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -187,13 +188,13 @@ public void testSimpleClientBehaviorDefaultNoEventAjaxWrap() throws Exception
vdl.buildView(facesContext, root, "testSimpleClientBehaviorDefaultNoEventAjaxWrap.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
- Assertions.assertNotNull(button);
- Assertions.assertNotNull(button.getClientBehaviors().get("action"));
- Assertions.assertEquals(1, button.getClientBehaviors().get("action").size());
+ assertNotNull(button);
+ assertNotNull(button.getClientBehaviors().get("action"));
+ assertEquals(1, button.getClientBehaviors().get("action").size());
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -203,9 +204,9 @@ public void testSimpleClientBehaviorDefaultNoEventAjaxWrap() throws Exception
//sw.flush();
//System.out.print(sw.toString());
}
-
+
@Test
- public void testCompositeClientBehavior() throws Exception
+ void compositeClientBehavior() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -216,17 +217,17 @@ public void testCompositeClientBehavior() throws Exception
vdl.buildView(facesContext, root, "testCompositeClientBehavior.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("button3");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UICommand button = (UICommand) compositeComponent2.findComponent("button");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
//One added in testCompositeActionSource, the other one
//inside compositeActionSource.xhtml
- Assertions.assertNotNull(button.getClientBehaviors().get("action"));
- Assertions.assertEquals(1, button.getClientBehaviors().get("action").size());
+ assertNotNull(button.getClientBehaviors().get("action"));
+ assertEquals(1, button.getClientBehaviors().get("action").size());
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -238,7 +239,7 @@ public void testCompositeClientBehavior() throws Exception
}
@Test
- public void testCompositeDoubleClientBehavior() throws Exception
+ void compositeDoubleClientBehavior() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -249,19 +250,19 @@ public void testCompositeDoubleClientBehavior() throws Exception
vdl.buildView(facesContext, root, "testCompositeDoubleClientBehavior.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("compositeClientBehavior");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent2.findComponent("button3");
- Assertions.assertNotNull(compositeComponent3);
+ assertNotNull(compositeComponent3);
UICommand button = (UICommand) compositeComponent3.findComponent("button");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
//One added in testCompositeActionSource, the other one
//inside compositeActionSource.xhtml
- Assertions.assertNotNull(button.getClientBehaviors().get("action"));
- Assertions.assertEquals(1, button.getClientBehaviors().get("action").size());
+ assertNotNull(button.getClientBehaviors().get("action"));
+ assertEquals(1, button.getClientBehaviors().get("action").size());
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -271,9 +272,9 @@ public void testCompositeDoubleClientBehavior() throws Exception
//sw.flush();
//System.out.print(sw.toString());
}
-
+
@Test
- public void testSimpleClientBehaviorProcessThisInCC() throws Exception
+ void simpleClientBehaviorProcessThisInCC() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -284,16 +285,16 @@ public void testSimpleClientBehaviorProcessThisInCC() throws Exception
vdl.buildView(facesContext, root, "testSimpleClientBehaviorProcessThisInCC.xhtml");
UIComponent form = root.findComponent("form");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
- Assertions.assertNotNull(button);
- Assertions.assertNotNull(button.getClientBehaviors().get("action"));
- Assertions.assertEquals(1, button.getClientBehaviors().get("action").size());
+ assertNotNull(button);
+ assertNotNull(button.getClientBehaviors().get("action"));
+ assertEquals(1, button.getClientBehaviors().get("action").size());
String content = render(root);
- Assertions.assertTrue(content.contains("myfaces.ab(this,event,'action','form:cc:button','form:cc:button'"));
+ assertTrue(content.contains("myfaces.ab(this,event,'action','form:cc:button','form:cc:button'"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentConditionalButtonTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentConditionalButtonTestCase.java
index 0a6fd4ca49..f2556c9f2c 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentConditionalButtonTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentConditionalButtonTestCase.java
@@ -19,6 +19,9 @@
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.component.UICommand;
import jakarta.faces.component.UIComponent;
@@ -27,10 +30,9 @@
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.view.facelets.bean.HelloWorld;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositeComponentConditionalButtonTestCase extends AbstractFaceletTestCase
+class CompositeComponentConditionalButtonTestCase extends AbstractFaceletTestCase
{
@Override
@@ -46,7 +48,7 @@ protected ExpressionFactory createExpressionFactory()
}
@Test
- public void testConditionalButtonTargets() throws Exception
+ void conditionalButtonTargets() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -58,25 +60,25 @@ public void testConditionalButtonTargets() throws Exception
//The first component has a default command button
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent1 = (UINamingContainer) form.findComponent("actionSource1");
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UICommand button1 = (UICommand) compositeComponent1.findComponent("button");
- Assertions.assertNotNull(button1);
- Assertions.assertEquals("submit", button1.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertNotNull(button1);
+ assertEquals("submit", button1.getActionExpression().invoke(facesContext.getELContext(), null));
- Assertions.assertNotNull(button1.getActionListeners());
- Assertions.assertEquals(1, button1.getActionListeners().length);
+ assertNotNull(button1.getActionListeners());
+ assertEquals(1, button1.getActionListeners().length);
UINamingContainer compositeComponent2 = (UINamingContainer) form.findComponent("actionSource");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UICommand button2 = (UICommand) compositeComponent2.findComponent("button");
- Assertions.assertNotNull(button2);
+ assertNotNull(button2);
//Since the button is outside cc:implementation, by the spec it cannot be taken into account as a valid "targets" value.
- Assertions.assertEquals("fail", button2.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals("fail", button2.getActionExpression().invoke(facesContext.getELContext(), null));
//It also cannot be target of cc:actionSource
- Assertions.assertNotNull(button2.getActionListeners());
- Assertions.assertEquals(0, button2.getActionListeners().length);
+ assertNotNull(button2.getActionListeners());
+ assertEquals(0, button2.getActionListeners().length);
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentMethodExpressionTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentMethodExpressionTestCase.java
index 42ab375353..20e4eb83d0 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentMethodExpressionTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentMethodExpressionTestCase.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import jakarta.el.ExpressionFactory;
import jakarta.el.MethodExpression;
import jakarta.faces.component.UICommand;
@@ -26,10 +29,9 @@
import jakarta.faces.component.UIViewRoot;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositeComponentMethodExpressionTestCase extends AbstractFaceletTestCase
+class CompositeComponentMethodExpressionTestCase extends AbstractFaceletTestCase
{
@Override
protected void setupComponents() throws Exception
@@ -54,7 +56,7 @@ protected ExpressionFactory createExpressionFactory()
}
@Test
- public void testSimpleMethodExpressionTarget() throws Exception
+ void simpleMethodExpressionTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -66,17 +68,17 @@ public void testSimpleMethodExpressionTarget() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
SimpleComponent testComponent = (SimpleComponent) compositeComponent.findComponent("testComponent");
- Assertions.assertNotNull(testComponent);
- Assertions.assertNotNull(testComponent.getCustomMethod());
- Assertions.assertEquals("somethingFunny"+"x", testComponent.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
+ assertNotNull(testComponent);
+ assertNotNull(testComponent.getCustomMethod());
+ assertEquals("somethingFunny"+"x", testComponent.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
}
@Test
- public void testCompositeMethodExpressionTarget() throws Exception
+ void compositeMethodExpressionTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -88,20 +90,20 @@ public void testCompositeMethodExpressionTarget() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
SimpleComponent testComponent = (SimpleComponent) compositeComponent2.findComponent("testComponent");
- Assertions.assertNotNull(testComponent);
- Assertions.assertNotNull(testComponent.getCustomMethod());
- Assertions.assertEquals("somethingFunny"+"x", testComponent.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
+ assertNotNull(testComponent);
+ assertNotNull(testComponent.getCustomMethod());
+ assertEquals("somethingFunny"+"x", testComponent.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
}
-
+
@Test
- public void testSimpleMethodExpressionNoTarget() throws Exception
+ void simpleMethodExpressionNoTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -113,21 +115,21 @@ public void testSimpleMethodExpressionNoTarget() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
SimpleComponent testComponentNoTarget = (SimpleComponent) compositeComponent.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget);
- Assertions.assertNotNull(testComponentNoTarget.getCustomMethod());
+ assertNotNull(testComponentNoTarget);
+ assertNotNull(testComponentNoTarget.getCustomMethod());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
- Assertions.assertEquals("somethingFunny"+"x", testComponentNoTarget.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
+ assertEquals("somethingFunny"+"x", testComponentNoTarget.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
compositeComponent.popComponentFromEL(facesContext);
}
@Test
- public void testCompositeMethodExpressionNoTarget() throws Exception
+ void compositeMethodExpressionNoTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -139,24 +141,24 @@ public void testCompositeMethodExpressionNoTarget() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent3);
+ assertNotNull(compositeComponent3);
SimpleComponent testComponentNoTarget3 = (SimpleComponent) compositeComponent3.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget3);
- Assertions.assertNotNull(testComponentNoTarget3.getCustomMethod());
+ assertNotNull(testComponentNoTarget3);
+ assertNotNull(testComponentNoTarget3.getCustomMethod());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
compositeComponent.pushComponentToEL(facesContext, compositeComponent3);
- Assertions.assertEquals("somethingFunny"+"x", testComponentNoTarget3.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
+ assertEquals("somethingFunny"+"x", testComponentNoTarget3.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
compositeComponent3.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
}
-
+
@Test
- public void testCompositeMethodExpressionNoTarget2() throws Exception
+ void compositeMethodExpressionNoTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -168,27 +170,27 @@ public void testCompositeMethodExpressionNoTarget2() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("compositeAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent2.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent3);
+ assertNotNull(compositeComponent3);
SimpleComponent testComponentNoTarget3 = (SimpleComponent) compositeComponent3.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget3);
- Assertions.assertNotNull(testComponentNoTarget3.getCustomMethod());
+ assertNotNull(testComponentNoTarget3);
+ assertNotNull(testComponentNoTarget3.getCustomMethod());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
compositeComponent.pushComponentToEL(facesContext, compositeComponent3);
- Assertions.assertEquals("somethingFunny"+"x", testComponentNoTarget3.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
+ assertEquals("somethingFunny"+"x", testComponentNoTarget3.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
compositeComponent3.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
}
@Test
- public void testSimpleMethodExpressionTarget2() throws Exception
+ void simpleMethodExpressionTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -200,24 +202,24 @@ public void testSimpleMethodExpressionTarget2() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
SimpleComponent testComponent = (SimpleComponent) compositeComponent.findComponent("testComponent");
- Assertions.assertNotNull(testComponent);
- Assertions.assertNotNull(testComponent.getCustomMethod());
- Assertions.assertEquals("somethingFunny"+"x", testComponent.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
+ assertNotNull(testComponent);
+ assertNotNull(testComponent.getCustomMethod());
+ assertEquals("somethingFunny"+"x", testComponent.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
SimpleComponent testComponentNoTarget = (SimpleComponent) compositeComponent.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget);
- Assertions.assertNotNull(testComponentNoTarget.getCustomMethod());
+ assertNotNull(testComponentNoTarget);
+ assertNotNull(testComponentNoTarget.getCustomMethod());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
- Assertions.assertEquals("somethingFunny"+"x", testComponentNoTarget.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
+ assertEquals("somethingFunny"+"x", testComponentNoTarget.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
compositeComponent.popComponentFromEL(facesContext);
}
@Test
- public void testCompositeMethodExpressionTarget2() throws Exception
+ void compositeMethodExpressionTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -229,47 +231,47 @@ public void testCompositeMethodExpressionTarget2() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
SimpleComponent testComponent = (SimpleComponent) compositeComponent2.findComponent("testComponent");
- Assertions.assertNotNull(testComponent);
- Assertions.assertNotNull(testComponent.getCustomMethod());
- Assertions.assertEquals("somethingFunny"+"x", testComponent.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
+ assertNotNull(testComponent);
+ assertNotNull(testComponent.getCustomMethod());
+ assertEquals("somethingFunny"+"x", testComponent.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
SimpleComponent testComponentNoTarget = (SimpleComponent) compositeComponent2.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget);
- Assertions.assertNotNull(testComponentNoTarget.getCustomMethod());
+ assertNotNull(testComponentNoTarget);
+ assertNotNull(testComponentNoTarget.getCustomMethod());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
- Assertions.assertEquals("somethingFunny"+"x", testComponentNoTarget.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
+ assertEquals("somethingFunny"+"x", testComponentNoTarget.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
compositeComponent.popComponentFromEL(facesContext);
UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent3);
+ assertNotNull(compositeComponent3);
SimpleComponent testComponent3 = (SimpleComponent) compositeComponent3.findComponent("testComponent");
- Assertions.assertNotNull(testComponent3);
- Assertions.assertNotNull(testComponent3.getCustomMethod());
+ assertNotNull(testComponent3);
+ assertNotNull(testComponent3.getCustomMethod());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
compositeComponent3.pushComponentToEL(facesContext, compositeComponent3);
- Assertions.assertEquals("somethingFunny"+"x", testComponent3.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
+ assertEquals("somethingFunny"+"x", testComponent3.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
compositeComponent3.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
SimpleComponent testComponentNoTarget3 = (SimpleComponent) compositeComponent3.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget3);
- Assertions.assertNotNull(testComponentNoTarget3.getCustomMethod());
+ assertNotNull(testComponentNoTarget3);
+ assertNotNull(testComponentNoTarget3.getCustomMethod());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
compositeComponent3.pushComponentToEL(facesContext, compositeComponent3);
- Assertions.assertEquals("somethingFunny"+"x", testComponentNoTarget3.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
+ assertEquals("somethingFunny"+"x", testComponentNoTarget3.getCustomMethod().invoke(facesContext.getELContext(), new Object[]{"x"}));
compositeComponent3.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
}
@Test
- public void testSimpleActionMethodExpressionTarget() throws Exception
+ void simpleActionMethodExpressionTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -281,17 +283,17 @@ public void testSimpleActionMethodExpressionTarget() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand testComponent = (UICommand) compositeComponent.findComponent("testComponent");
- Assertions.assertNotNull(testComponent);
- Assertions.assertNotNull(testComponent.getActionExpression());
- Assertions.assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertNotNull(testComponent);
+ assertNotNull(testComponent.getActionExpression());
+ assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
}
@Test
- public void testCompositeActionMethodExpressionTarget() throws Exception
+ void compositeActionMethodExpressionTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -303,20 +305,20 @@ public void testCompositeActionMethodExpressionTarget() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UICommand testComponent = (UICommand) compositeComponent2.findComponent("testComponent");
- Assertions.assertNotNull(testComponent);
- Assertions.assertNotNull(testComponent.getActionExpression());
- Assertions.assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertNotNull(testComponent);
+ assertNotNull(testComponent.getActionExpression());
+ assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
}
@Test
- public void testSimpleActionMethodExpressionNoTarget() throws Exception
+ void simpleActionMethodExpressionNoTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -328,23 +330,23 @@ public void testSimpleActionMethodExpressionNoTarget() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
button.pushComponentToEL(facesContext, button);
MethodExpression method = button.getActionExpression();
- Assertions.assertEquals(bean.doSomeAction(), method.invoke(facesContext.getELContext(), null));
+ assertEquals(bean.doSomeAction(), method.invoke(facesContext.getELContext(), null));
button.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
}
-
+
@Test
- public void testCompositeActionMethodExpressionNoTarget() throws Exception
+ void compositeActionMethodExpressionNoTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -355,24 +357,24 @@ public void testCompositeActionMethodExpressionNoTarget() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeActionMethodExpressionNoTarget.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeActionMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent3);
+ assertNotNull(compositeComponent3);
UICommand testComponentNoTarget3 = (UICommand) compositeComponent3.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget3);
- Assertions.assertNotNull(testComponentNoTarget3.getActionExpression());
+ assertNotNull(testComponentNoTarget3);
+ assertNotNull(testComponentNoTarget3.getActionExpression());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
compositeComponent.pushComponentToEL(facesContext, compositeComponent3);
- Assertions.assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
compositeComponent3.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
}
@Test
- public void testSimpleActionMethodExpressionTarget2() throws Exception
+ void simpleActionMethodExpressionTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -384,24 +386,24 @@ public void testSimpleActionMethodExpressionTarget2() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand testComponent = (UICommand) compositeComponent.findComponent("testComponent");
- Assertions.assertNotNull(testComponent);
- Assertions.assertNotNull(testComponent.getActionExpression());
- Assertions.assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertNotNull(testComponent);
+ assertNotNull(testComponent.getActionExpression());
+ assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
UICommand testComponentNoTarget = (UICommand) compositeComponent.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget);
- Assertions.assertNotNull(testComponentNoTarget.getActionExpression());
+ assertNotNull(testComponentNoTarget);
+ assertNotNull(testComponentNoTarget.getActionExpression());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
- Assertions.assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
compositeComponent.popComponentFromEL(facesContext);
}
-
+
@Test
- public void testSimpleActionMethodExpressionTarget3() throws Exception
+ void simpleActionMethodExpressionTarget3() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -413,24 +415,24 @@ public void testSimpleActionMethodExpressionTarget3() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand testComponent = (UICommand) compositeComponent.findComponent("testComponent");
- Assertions.assertNotNull(testComponent);
- Assertions.assertNotNull(testComponent.getActionExpression());
- Assertions.assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertNotNull(testComponent);
+ assertNotNull(testComponent.getActionExpression());
+ assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
UICommand testComponentNoTarget = (UICommand) compositeComponent.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget);
- Assertions.assertNotNull(testComponentNoTarget.getActionExpression());
+ assertNotNull(testComponentNoTarget);
+ assertNotNull(testComponentNoTarget.getActionExpression());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
- Assertions.assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
compositeComponent.popComponentFromEL(facesContext);
}
@Test
- public void testCompositeActionMethodExpressionTarget2() throws Exception
+ void compositeActionMethodExpressionTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -442,47 +444,47 @@ public void testCompositeActionMethodExpressionTarget2() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UICommand testComponent = (UICommand) compositeComponent2.findComponent("testComponent");
- Assertions.assertNotNull(testComponent);
- Assertions.assertNotNull(testComponent.getActionExpression());
- Assertions.assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertNotNull(testComponent);
+ assertNotNull(testComponent.getActionExpression());
+ assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
UICommand testComponentNoTarget = (UICommand) compositeComponent2.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget);
- Assertions.assertNotNull(testComponentNoTarget.getActionExpression());
+ assertNotNull(testComponentNoTarget);
+ assertNotNull(testComponentNoTarget.getActionExpression());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
- Assertions.assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
compositeComponent.popComponentFromEL(facesContext);
UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent3);
+ assertNotNull(compositeComponent3);
UICommand testComponent3 = (UICommand) compositeComponent3.findComponent("testComponent");
- Assertions.assertNotNull(testComponent3);
- Assertions.assertNotNull(testComponent3.getActionExpression());
+ assertNotNull(testComponent3);
+ assertNotNull(testComponent3.getActionExpression());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
compositeComponent3.pushComponentToEL(facesContext, compositeComponent3);
- Assertions.assertEquals(bean.doSomeAction(), testComponent3.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals(bean.doSomeAction(), testComponent3.getActionExpression().invoke(facesContext.getELContext(), null));
compositeComponent3.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
UICommand testComponentNoTarget3 = (UICommand) compositeComponent3.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget3);
- Assertions.assertNotNull(testComponentNoTarget3.getActionExpression());
+ assertNotNull(testComponentNoTarget3);
+ assertNotNull(testComponentNoTarget3.getActionExpression());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
compositeComponent3.pushComponentToEL(facesContext, compositeComponent3);
- Assertions.assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
compositeComponent3.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
}
@Test
- public void testCompositeActionMethodExpressionNoTarget2() throws Exception
+ void compositeActionMethodExpressionNoTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -493,26 +495,26 @@ public void testCompositeActionMethodExpressionNoTarget2() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeActionMethodExpressionNoTarget2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("compositeAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent2.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent3);
+ assertNotNull(compositeComponent3);
UICommand testComponentNoTarget3 = (UICommand) compositeComponent3.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget3);
- Assertions.assertNotNull(testComponentNoTarget3.getActionExpression());
+ assertNotNull(testComponentNoTarget3);
+ assertNotNull(testComponentNoTarget3.getActionExpression());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
compositeComponent.pushComponentToEL(facesContext, compositeComponent3);
- Assertions.assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
compositeComponent3.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
}
-
+
@Test
- public void testCompositeActionMethodExpressionTarget3() throws Exception
+ void compositeActionMethodExpressionTarget3() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -524,43 +526,43 @@ public void testCompositeActionMethodExpressionTarget3() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UICommand testComponent = (UICommand) compositeComponent2.findComponent("testComponent");
- Assertions.assertNotNull(testComponent);
- Assertions.assertNotNull(testComponent.getActionExpression());
- Assertions.assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertNotNull(testComponent);
+ assertNotNull(testComponent.getActionExpression());
+ assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
UICommand testComponentNoTarget = (UICommand) compositeComponent2.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget);
- Assertions.assertNotNull(testComponentNoTarget.getActionExpression());
+ assertNotNull(testComponentNoTarget);
+ assertNotNull(testComponentNoTarget.getActionExpression());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
- Assertions.assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
compositeComponent2.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent3);
+ assertNotNull(compositeComponent3);
UICommand testComponent3 = (UICommand) compositeComponent3.findComponent("testComponent");
- Assertions.assertNotNull(testComponent3);
- Assertions.assertNotNull(testComponent3.getActionExpression());
+ assertNotNull(testComponent3);
+ assertNotNull(testComponent3.getActionExpression());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
compositeComponent3.pushComponentToEL(facesContext, compositeComponent3);
- Assertions.assertEquals(bean.doSomeAction(), testComponent3.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals(bean.doSomeAction(), testComponent3.getActionExpression().invoke(facesContext.getELContext(), null));
compositeComponent3.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
UICommand testComponentNoTarget3 = (UICommand) compositeComponent3.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget3);
- Assertions.assertNotNull(testComponentNoTarget3.getActionExpression());
+ assertNotNull(testComponentNoTarget3);
+ assertNotNull(testComponentNoTarget3.getActionExpression());
compositeComponent.pushComponentToEL(facesContext, compositeComponent);
compositeComponent3.pushComponentToEL(facesContext, compositeComponent3);
- Assertions.assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
+ assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
compositeComponent3.popComponentFromEL(facesContext);
compositeComponent.popComponentFromEL(facesContext);
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentNestedCCTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentNestedCCTestCase.java
index 5659a48c4f..a4fdea3876 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentNestedCCTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentNestedCCTestCase.java
@@ -19,6 +19,9 @@
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.el.ExpressionFactory;
@@ -29,10 +32,9 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.ELExpressionCacheMode;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositeComponentNestedCCTestCase extends AbstractFaceletTestCase
+class CompositeComponentNestedCCTestCase extends AbstractFaceletTestCase
{
@Override
@@ -46,15 +48,15 @@ protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
}
-
+
@Test
- public void testCompositeNestedCC1() throws Exception
+ void compositeNestedCC1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCompositeNestedCC1.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -62,11 +64,11 @@ public void testCompositeNestedCC1() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
}
-
+
/**
* The same tests, but with caching enabled. In this case, ccLevel changes
* all the time, so the caching logic must take that into account.
@@ -74,7 +76,7 @@ public void testCompositeNestedCC1() throws Exception
* @throws Exception
*/
@Test
- public void testCompositeNestedCC1Cache() throws Exception
+ void compositeNestedCC1Cache() throws Exception
{
servletContext.addInitParameter(MyfacesConfig.CACHE_EL_EXPRESSIONS,
ELExpressionCacheMode.always.toString());
@@ -82,7 +84,7 @@ public void testCompositeNestedCC1Cache() throws Exception
vdl.buildView(facesContext, root, "testCompositeNestedCC1.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -90,24 +92,24 @@ public void testCompositeNestedCC1Cache() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
}
-
+
/**
* Try a nested reference inside the same composite component
*
* @throws Exception
*/
@Test
- public void testCompositeNestedCC2() throws Exception
+ void compositeNestedCC2() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCompositeNestedCC2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -115,10 +117,10 @@ public void testCompositeNestedCC2() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
/**
@@ -127,7 +129,7 @@ public void testCompositeNestedCC2() throws Exception
* @throws Exception
*/
@Test
- public void testCompositeNestedCC2Cache() throws Exception
+ void compositeNestedCC2Cache() throws Exception
{
servletContext.addInitParameter(MyfacesConfig.CACHE_EL_EXPRESSIONS,
ELExpressionCacheMode.always.toString());
@@ -135,7 +137,7 @@ public void testCompositeNestedCC2Cache() throws Exception
vdl.buildView(facesContext, root, "testCompositeNestedCC2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -143,12 +145,12 @@ public void testCompositeNestedCC2Cache() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
-
+
/**
* Try what happen when a dynamic ui:include is used inside a composite
* component and that include contains a reference to the same composite
@@ -157,13 +159,13 @@ public void testCompositeNestedCC2Cache() throws Exception
* @throws Exception
*/
@Test
- public void testCompositeNestedCC3() throws Exception
+ void compositeNestedCC3() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCompositeNestedCC3.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -171,12 +173,12 @@ public void testCompositeNestedCC3() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
-
+
/**
* Try what happen when a dynamic ui:include is used inside a composite
* component and that include contains a reference to the same composite
@@ -185,7 +187,7 @@ public void testCompositeNestedCC3() throws Exception
* @throws Exception
*/
@Test
- public void testCompositeNestedCC3Cache() throws Exception
+ void compositeNestedCC3Cache() throws Exception
{
servletContext.addInitParameter(MyfacesConfig.CACHE_EL_EXPRESSIONS,
ELExpressionCacheMode.always.toString()); //allowCset
@@ -194,7 +196,7 @@ public void testCompositeNestedCC3Cache() throws Exception
vdl.buildView(facesContext, root, "testCompositeNestedCC3.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -202,25 +204,25 @@ public void testCompositeNestedCC3Cache() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
-
+
/**
* Try a nested insertChildren with some conditional inclusions.
*
* @throws Exception
*/
@Test
- public void testCompositeNestedCC4() throws Exception
+ void compositeNestedCC4() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCompositeNestedCC4.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -228,19 +230,19 @@ public void testCompositeNestedCC4() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
-
+
/**
* Try a nested insertChildren with some conditional inclusions.
*
* @throws Exception
*/
@Test
- public void testCompositeNestedCC4Cache() throws Exception
+ void compositeNestedCC4Cache() throws Exception
{
servletContext.addInitParameter(MyfacesConfig.CACHE_EL_EXPRESSIONS,
ELExpressionCacheMode.always.toString());
@@ -249,7 +251,7 @@ public void testCompositeNestedCC4Cache() throws Exception
vdl.buildView(facesContext, root, "testCompositeNestedCC4.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -257,20 +259,20 @@ public void testCompositeNestedCC4Cache() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
@Test
- public void testCompositeNestedCC5() throws Exception
+ void compositeNestedCC5() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCompositeNestedCC5.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -278,11 +280,11 @@ public void testCompositeNestedCC5() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
}
-
+
/**
* The same tests, but with caching enabled. In this case, ccLevel changes
* all the time, so the caching logic must take that into account.
@@ -290,7 +292,7 @@ public void testCompositeNestedCC5() throws Exception
* @throws Exception
*/
@Test
- public void testCompositeNestedCC5Cache() throws Exception
+ void compositeNestedCC5Cache() throws Exception
{
servletContext.addInitParameter(MyfacesConfig.CACHE_EL_EXPRESSIONS,
ELExpressionCacheMode.always.toString());
@@ -298,7 +300,7 @@ public void testCompositeNestedCC5Cache() throws Exception
vdl.buildView(facesContext, root, "testCompositeNestedCC5.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -306,24 +308,24 @@ public void testCompositeNestedCC5Cache() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
}
-
+
/**
* Try a nested reference inside the same composite component
*
* @throws Exception
*/
@Test
- public void testCompositeNestedCC6() throws Exception
+ void compositeNestedCC6() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCompositeNestedCC6.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -331,10 +333,10 @@ public void testCompositeNestedCC6() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
/**
@@ -343,7 +345,7 @@ public void testCompositeNestedCC6() throws Exception
* @throws Exception
*/
@Test
- public void testCompositeNestedCC6Cache() throws Exception
+ void compositeNestedCC6Cache() throws Exception
{
servletContext.addInitParameter(MyfacesConfig.CACHE_EL_EXPRESSIONS,
ELExpressionCacheMode.always.toString());
@@ -351,7 +353,7 @@ public void testCompositeNestedCC6Cache() throws Exception
vdl.buildView(facesContext, root, "testCompositeNestedCC6.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -359,12 +361,12 @@ public void testCompositeNestedCC6Cache() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
-
+
/**
* Try what happen when a dynamic ui:include is used inside a composite
* component and that include contains a reference to the same composite
@@ -373,13 +375,13 @@ public void testCompositeNestedCC6Cache() throws Exception
* @throws Exception
*/
@Test
- public void testCompositeNestedCC7() throws Exception
+ void compositeNestedCC7() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCompositeNestedCC7.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -387,12 +389,12 @@ public void testCompositeNestedCC7() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
-
+
/**
* Try what happen when a dynamic ui:include is used inside a composite
* component and that include contains a reference to the same composite
@@ -401,7 +403,7 @@ public void testCompositeNestedCC7() throws Exception
* @throws Exception
*/
@Test
- public void testCompositeNestedCC7Cache() throws Exception
+ void compositeNestedCC7Cache() throws Exception
{
servletContext.addInitParameter(MyfacesConfig.CACHE_EL_EXPRESSIONS,
ELExpressionCacheMode.always.toString()); //allowCset
@@ -410,7 +412,7 @@ public void testCompositeNestedCC7Cache() throws Exception
vdl.buildView(facesContext, root, "testCompositeNestedCC7.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -418,25 +420,25 @@ public void testCompositeNestedCC7Cache() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
-
+
/**
* Try a nested insertChildren with some conditional inclusions.
*
* @throws Exception
*/
@Test
- public void testCompositeNestedCC8() throws Exception
+ void compositeNestedCC8() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCompositeNestedCC8.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -444,19 +446,19 @@ public void testCompositeNestedCC8() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
-
+
/**
* Try a nested insertChildren with some conditional inclusions.
*
* @throws Exception
*/
@Test
- public void testCompositeNestedCC8Cache() throws Exception
+ void compositeNestedCC8Cache() throws Exception
{
servletContext.addInitParameter(MyfacesConfig.CACHE_EL_EXPRESSIONS,
ELExpressionCacheMode.always.toString());
@@ -465,7 +467,7 @@ public void testCompositeNestedCC8Cache() throws Exception
vdl.buildView(facesContext, root, "testCompositeNestedCC8.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -473,9 +475,9 @@ public void testCompositeNestedCC8Cache() throws Exception
root.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("ALFA"));
- Assertions.assertTrue(sw.toString().contains("BETA"));
- Assertions.assertTrue(sw.toString().contains("GAMMA"));
- Assertions.assertTrue(sw.toString().contains("OMEGA"));
+ assertTrue(sw.toString().contains("ALFA"));
+ assertTrue(sw.toString().contains("BETA"));
+ assertTrue(sw.toString().contains("GAMMA"));
+ assertTrue(sw.toString().contains("OMEGA"));
}
}
\ No newline at end of file
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java
index 115d9ad8ea..41b377d25a 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java
@@ -19,6 +19,8 @@
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.el.MethodExpression;
@@ -44,10 +46,9 @@
import org.apache.myfaces.test.utils.HtmlRenderedAttr;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.view.facelets.bean.HelloWorld;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositeComponentTestCase extends AbstractFaceletTestCase
+class CompositeComponentTestCase extends AbstractFaceletTestCase
{
@Override
@@ -81,17 +82,17 @@ protected void setUpExternalContext() throws Exception
* @throws Exception
*/
@Test
- public void testSimpleCompositeComponent() throws Exception
+ void simpleCompositeComponent() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testSimpleComposite.xhtml");
UIComponent panelGroup = root.findComponent("testGroup");
- Assertions.assertNotNull(panelGroup);
+ assertNotNull(panelGroup);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UIOutput text = (UIOutput) compositeComponent.getFacet(UIComponent.COMPOSITE_FACET_NAME).findComponent("text");
- Assertions.assertNotNull(text);
+ assertNotNull(text);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -113,54 +114,54 @@ public void testSimpleCompositeComponent() throws Exception
* @throws Exception
*/
@Test
- public void testSimpleCompositeAttribute() throws Exception
+ void simpleCompositeAttribute() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testSimpleAttribute.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
HtmlOutputText text1 = (HtmlOutputText) facet1.findComponent("text");
- Assertions.assertNotNull(text1);
+ assertNotNull(text1);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
facet1.pushComponentToEL(facesContext, facet1);
text1.pushComponentToEL(facesContext, text1);
//set on tag
- Assertions.assertEquals("class1", text1.getStyleClass());
+ assertEquals("class1", text1.getStyleClass());
//set as default
- Assertions.assertEquals("background:red", text1.getStyle());
+ assertEquals("background:red", text1.getStyle());
//Check coercion of attribute using type value
- Assertions.assertEquals(5, compositeComponent1.getAttributes().get("index"));
+ assertEquals(5, compositeComponent1.getAttributes().get("index"));
//Check default coercion
ValueExpression ve = facesContext.getApplication().getExpressionFactory().createValueExpression(
facesContext.getELContext(), "#{cc.attrs.cols}", Object.class);
- Assertions.assertEquals(1, (int) ve.getValue(facesContext.getELContext()));
+ assertEquals(1, (int) ve.getValue(facesContext.getELContext()));
text1.popComponentFromEL(facesContext);
facet1.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UIComponent facet2 = compositeComponent2.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet2);
+ assertNotNull(facet2);
HtmlOutputText text2 = (HtmlOutputText) facet2.findComponent("text");
- Assertions.assertNotNull(text2);
+ assertNotNull(text2);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
facet2.pushComponentToEL(facesContext, facet2);
text2.pushComponentToEL(facesContext, text2);
//set on tag
- Assertions.assertEquals("background:green", text2.getStyle());
+ assertEquals("background:green", text2.getStyle());
// not set, should return null, but since there is a ValueExpression indirection,
// coercing rules apply here, so null is converted as ""
- Assertions.assertEquals("", text2.getStyleClass());
+ assertEquals("", text2.getStyleClass());
text2.popComponentFromEL(facesContext);
facet2.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
@@ -178,9 +179,9 @@ public void testSimpleCompositeAttribute() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
}
-
+
@Test
- public void testSimpleCompositeAttributeMethodExpression() throws Exception
+ void simpleCompositeAttributeMethodExpression() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -191,22 +192,22 @@ public void testSimpleCompositeAttributeMethodExpression() throws Exception
vdl.buildView(facesContext, root, "testSimpleAttributeMethodExpression.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
- Assertions.assertNotNull(button);
- Assertions.assertEquals("#{helloWorldBean.send}", button.getActionExpression().getExpressionString());
- Assertions.assertEquals("#{helloWorldBean.send}", ((MethodExpression)compositeComponent.getAttributes().get("metodo")).getExpressionString());
- Assertions.assertNull(button.getAttributes().get("metodo"));
+ assertNotNull(button);
+ assertEquals("#{helloWorldBean.send}", button.getActionExpression().getExpressionString());
+ assertEquals("#{helloWorldBean.send}", ((MethodExpression)compositeComponent.getAttributes().get("metodo")).getExpressionString());
+ assertNull(button.getAttributes().get("metodo"));
UICommand link = (UICommand) compositeComponent.findComponent("link");
- Assertions.assertNotNull(link);
- Assertions.assertEquals(1, link.getActionListeners().length);
+ assertNotNull(link);
+ assertEquals(1, link.getActionListeners().length);
UIInput input = (UIInput) compositeComponent.findComponent("input");
- Assertions.assertNotNull(input);
- Assertions.assertEquals(1, input.getValidators().length);
- Assertions.assertEquals(1, input.getValueChangeListeners().length);
+ assertNotNull(input);
+ assertEquals(1, input.getValidators().length);
+ assertEquals(1, input.getValueChangeListeners().length);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -217,9 +218,9 @@ public void testSimpleCompositeAttributeMethodExpression() throws Exception
//sw.flush();
//System.out.print(sw.toString());
}
-
+
@Test
- public void testSimpleActionSource() throws Exception
+ void simpleActionSource() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -230,12 +231,12 @@ public void testSimpleActionSource() throws Exception
vdl.buildView(facesContext, root, "testSimpleActionSource.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
- Assertions.assertNotNull(button);
- Assertions.assertEquals(3, button.getActionListeners().length);
+ assertNotNull(button);
+ assertEquals(3, button.getActionListeners().length);
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -245,9 +246,9 @@ public void testSimpleActionSource() throws Exception
//sw.flush();
//System.out.print(sw.toString());
}
-
+
@Test
- public void testSimpleValueHolder() throws Exception
+ void simpleValueHolder() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -258,12 +259,12 @@ public void testSimpleValueHolder() throws Exception
vdl.buildView(facesContext, root, "testSimpleValueHolder.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UIOutput text = (UIOutput) compositeComponent.findComponent("text");
- Assertions.assertNotNull(text);
- Assertions.assertNotNull(text.getConverter());
+ assertNotNull(text);
+ assertNotNull(text.getConverter());
//Assertions.assertEquals(2, button.getActionListeners().length);
//StringWriter sw = new StringWriter();
@@ -274,9 +275,9 @@ public void testSimpleValueHolder() throws Exception
//sw.flush();
//System.out.print(sw.toString());
}
-
+
@Test
- public void testCompositeActionSource() throws Exception
+ void compositeActionSource() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -287,16 +288,16 @@ public void testCompositeActionSource() throws Exception
vdl.buildView(facesContext, root, "testCompositeActionSource.xhtml");
UIComponent form = root.findComponent("testForm1");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("button3");
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UICommand button = (UICommand) compositeComponent2.findComponent("button");
- Assertions.assertNotNull(button);
+ assertNotNull(button);
//One added in testCompositeActionSource, the other one
//inside compositeActionSource.xhtml
- Assertions.assertEquals(2, button.getActionListeners().length);
+ assertEquals(2, button.getActionListeners().length);
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -306,9 +307,9 @@ public void testCompositeActionSource() throws Exception
//sw.flush();
//System.out.print(sw.toString());
}
-
+
@Test
- public void testSimpleInsertChildren() throws Exception
+ void simpleInsertChildren() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -337,16 +338,16 @@ public void testSimpleInsertChildren() throws Exception
String resp = sw.toString();
- Assertions.assertTrue(resp.contains("Hello"));
- Assertions.assertTrue(resp.contains("Leonardo"));
- Assertions.assertTrue(resp.contains("Alfredo"));
- Assertions.assertTrue(resp.contains("Uribe"));
- Assertions.assertTrue(resp.contains("Sayonara"));
+ assertTrue(resp.contains("Hello"));
+ assertTrue(resp.contains("Leonardo"));
+ assertTrue(resp.contains("Alfredo"));
+ assertTrue(resp.contains("Uribe"));
+ assertTrue(resp.contains("Sayonara"));
//System.out.print(sw.toString());
}
-
+
@Test
- public void testSimpleInsertChildrenAjax() throws Exception
+ void simpleInsertChildrenAjax() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -357,15 +358,15 @@ public void testSimpleInsertChildrenAjax() throws Exception
vdl.buildView(facesContext, root, "testSimpleInsertChildrenAjax.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
HtmlCommandLink link = (HtmlCommandLink) facet1.findComponent("link");
- Assertions.assertNotNull(link);
- Assertions.assertEquals(1, link.getClientBehaviors().size());
- Assertions.assertEquals(1, link.getClientBehaviors().get(link.getDefaultEventName()).size());
+ assertNotNull(link);
+ assertEquals(1, link.getClientBehaviors().size());
+ assertEquals(1, link.getClientBehaviors().get(link.getDefaultEventName()).size());
/*
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -380,7 +381,7 @@ public void testSimpleInsertChildrenAjax() throws Exception
}
@Test
- public void testSimpleInsertChildrenAjax2() throws Exception
+ void simpleInsertChildrenAjax2() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -391,15 +392,15 @@ public void testSimpleInsertChildrenAjax2() throws Exception
vdl.buildView(facesContext, root, "testSimpleInsertChildrenAjax2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
HtmlCommandLink link = (HtmlCommandLink) compositeComponent1.findComponent("link");
- Assertions.assertNotNull(link);
- Assertions.assertEquals(1, link.getClientBehaviors().size());
- Assertions.assertEquals(1, link.getClientBehaviors().get(link.getDefaultEventName()).size());
+ assertNotNull(link);
+ assertEquals(1, link.getClientBehaviors().size());
+ assertEquals(1, link.getClientBehaviors().get(link.getDefaultEventName()).size());
/*
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -412,9 +413,9 @@ public void testSimpleInsertChildrenAjax2() throws Exception
*/
//System.out.print(sw.toString());
}
-
+
@Test
- public void testSimpleInsertChildrenNoAjax() throws Exception
+ void simpleInsertChildrenNoAjax() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -425,14 +426,14 @@ public void testSimpleInsertChildrenNoAjax() throws Exception
vdl.buildView(facesContext, root, "testSimpleInsertChildrenNoAjax.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
HtmlCommandLink link = (HtmlCommandLink) facet1.findComponent("link");
- Assertions.assertNotNull(link);
- Assertions.assertEquals(0, link.getClientBehaviors().size());
+ assertNotNull(link);
+ assertEquals(0, link.getClientBehaviors().size());
/*
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -445,9 +446,9 @@ public void testSimpleInsertChildrenNoAjax() throws Exception
*/
//System.out.print(sw.toString());
}
-
+
@Test
- public void testCompositeInsertChildren() throws Exception
+ void compositeInsertChildren() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -458,11 +459,11 @@ public void testCompositeInsertChildren() throws Exception
vdl.buildView(facesContext, root, "testCompositeInsertChildren.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -474,14 +475,14 @@ public void testCompositeInsertChildren() throws Exception
String resp = sw.toString();
- Assertions.assertTrue(resp.contains("ALFA"));
- Assertions.assertTrue(resp.contains("BETA"));
- Assertions.assertTrue(resp.contains("GAMMA"));
- Assertions.assertTrue(resp.contains("OMEGA"));
+ assertTrue(resp.contains("ALFA"));
+ assertTrue(resp.contains("BETA"));
+ assertTrue(resp.contains("GAMMA"));
+ assertTrue(resp.contains("OMEGA"));
}
-
+
@Test
- public void testCompositeInsertChildrenPreserveTemplateSlot() throws Exception
+ void compositeInsertChildrenPreserveTemplateSlot() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -492,11 +493,11 @@ public void testCompositeInsertChildrenPreserveTemplateSlot() throws Exception
vdl.buildView(facesContext, root, "testCompositeInsertChildren2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -508,14 +509,14 @@ public void testCompositeInsertChildrenPreserveTemplateSlot() throws Exception
String resp = sw.toString();
- Assertions.assertTrue(resp.contains("ALFA"));
- Assertions.assertTrue(resp.contains("BETA"));
- Assertions.assertTrue(resp.contains("GAMMA"));
- Assertions.assertTrue(resp.contains("OMEGA"));
+ assertTrue(resp.contains("ALFA"));
+ assertTrue(resp.contains("BETA"));
+ assertTrue(resp.contains("GAMMA"));
+ assertTrue(resp.contains("OMEGA"));
}
-
+
@Test
- public void testCompositeInsertChildren3() throws Exception
+ void compositeInsertChildren3() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -526,11 +527,11 @@ public void testCompositeInsertChildren3() throws Exception
vdl.buildView(facesContext, root, "testCompositeInsertChildren3.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -542,14 +543,14 @@ public void testCompositeInsertChildren3() throws Exception
String resp = sw.toString();
- Assertions.assertTrue(resp.contains("ALFA"));
- Assertions.assertTrue(resp.contains("BETA"));
- Assertions.assertTrue(resp.contains("GAMMA"));
- Assertions.assertTrue(resp.contains("OMEGA"));
+ assertTrue(resp.contains("ALFA"));
+ assertTrue(resp.contains("BETA"));
+ assertTrue(resp.contains("GAMMA"));
+ assertTrue(resp.contains("OMEGA"));
}
-
+
@Test
- public void testCompositeInsertChildren4() throws Exception
+ void compositeInsertChildren4() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -560,7 +561,7 @@ public void testCompositeInsertChildren4() throws Exception
vdl.buildView(facesContext, root, "testCompositeInsertChildren4.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
//UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
//Assertions.assertNotNull(compositeComponent1);
//UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
@@ -576,15 +577,15 @@ public void testCompositeInsertChildren4() throws Exception
String resp = sw.toString();
- Assertions.assertTrue(resp.contains("ALFA"));
- Assertions.assertTrue(resp.contains("BETA"));
- Assertions.assertTrue(resp.contains("GAMMA"));
- Assertions.assertTrue(resp.contains("OMEGA"));
+ assertTrue(resp.contains("ALFA"));
+ assertTrue(resp.contains("BETA"));
+ assertTrue(resp.contains("GAMMA"));
+ assertTrue(resp.contains("OMEGA"));
}
-
-
+
+
@Test
- public void testCompositeInsertChildren5() throws Exception
+ void compositeInsertChildren5() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -595,7 +596,7 @@ public void testCompositeInsertChildren5() throws Exception
vdl.buildView(facesContext, root, "testCompositeInsertChildren5.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
//UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
//Assertions.assertNotNull(compositeComponent1);
//UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
@@ -611,14 +612,14 @@ public void testCompositeInsertChildren5() throws Exception
String resp = sw.toString();
- Assertions.assertTrue(resp.contains("ALFA"));
- Assertions.assertTrue(resp.contains("BETA"));
- Assertions.assertTrue(resp.contains("GAMMA"));
- Assertions.assertTrue(resp.contains("OMEGA"));
+ assertTrue(resp.contains("ALFA"));
+ assertTrue(resp.contains("BETA"));
+ assertTrue(resp.contains("GAMMA"));
+ assertTrue(resp.contains("OMEGA"));
}
@Test
- public void testCompositeInsertChildren6() throws Exception
+ void compositeInsertChildren6() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -629,7 +630,7 @@ public void testCompositeInsertChildren6() throws Exception
vdl.buildView(facesContext, root, "testCompositeInsertChildren6.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
//UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
//Assertions.assertNotNull(compositeComponent1);
//UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
@@ -645,14 +646,14 @@ public void testCompositeInsertChildren6() throws Exception
String resp = sw.toString();
- Assertions.assertTrue(resp.contains("ALFA"));
- Assertions.assertTrue(resp.contains("BETA"));
- Assertions.assertTrue(resp.contains("GAMMA"));
- Assertions.assertTrue(resp.contains("OMEGA"));
+ assertTrue(resp.contains("ALFA"));
+ assertTrue(resp.contains("BETA"));
+ assertTrue(resp.contains("GAMMA"));
+ assertTrue(resp.contains("OMEGA"));
}
@Test
- public void testCompositeInsertFacet() throws Exception
+ void compositeInsertFacet() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -663,24 +664,24 @@ public void testCompositeInsertFacet() throws Exception
vdl.buildView(facesContext, root, "testCompositeInsertFacet.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
UINamingContainer compositeComponent2 = (UINamingContainer) facet1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UIComponent facet2 = compositeComponent2.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet2);
- Assertions.assertEquals(1,facet2.getChildCount());
+ assertNotNull(facet2);
+ assertEquals(1,facet2.getChildCount());
UIOutput targetComp = (UIOutput) facet2.getChildren().get(0);
UIComponent insertedFacet = targetComp.getFacet("header");
- Assertions.assertNotNull(insertedFacet);
+ assertNotNull(insertedFacet);
}
-
+
@Test
- public void testCompositeInsertFacetChildren() throws Exception
+ void compositeInsertFacetChildren() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -691,23 +692,23 @@ public void testCompositeInsertFacetChildren() throws Exception
vdl.buildView(facesContext, root, "testCompositeInsertFacetChildren.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
UINamingContainer compositeComponent2 = (UINamingContainer) facet1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UIComponent facet2 = compositeComponent2.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet2);
- Assertions.assertEquals(3,facet2.getChildCount());
+ assertNotNull(facet2);
+ assertEquals(3,facet2.getChildCount());
UIComponent insertedFacet = facet2.getChildren().get(1).getFacet("header");
- Assertions.assertNotNull(insertedFacet);
+ assertNotNull(insertedFacet);
}
@Test
- public void testSimpleRenderFacet() throws Exception
+ void simpleRenderFacet() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -718,9 +719,9 @@ public void testSimpleRenderFacet() throws Exception
vdl.buildView(facesContext, root, "testSimpleRenderFacet.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -732,13 +733,13 @@ public void testSimpleRenderFacet() throws Exception
String resp = sw.toString();
- Assertions.assertTrue(resp.contains("HELLO"));
- Assertions.assertTrue(resp.contains("WORLD"));
+ assertTrue(resp.contains("HELLO"));
+ assertTrue(resp.contains("WORLD"));
}
-
+
@Test
- public void testSimpleFEvent() throws Exception
+ void simpleFEvent() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -749,11 +750,11 @@ public void testSimpleFEvent() throws Exception
vdl.buildView(facesContext, root, "testSimpleFEvent.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
CompositeTestComponent compositeComponent1 = (CompositeTestComponent) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
- Assertions.assertTrue((Boolean) compositeComponent1.getAttributes().get("postAddToViewCallback"),
+ assertTrue((Boolean) compositeComponent1.getAttributes().get("postAddToViewCallback"),
"postAddToViewCallback should be called");
/*
@@ -772,9 +773,9 @@ public void testSimpleFEvent() throws Exception
*/
}
-
+
@Test
- public void testSimpleFEvent2() throws Exception
+ void simpleFEvent2() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -785,18 +786,18 @@ public void testSimpleFEvent2() throws Exception
vdl.buildView(facesContext, root, "testSimpleFEvent2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
CompositeTestComponent compositeComponent1 = (CompositeTestComponent) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
application.publishEvent(facesContext, PreRenderViewEvent.class, root);
- Assertions.assertTrue((Boolean) compositeComponent1.getAttributes().get("preRenderViewCallback"),
+ assertTrue((Boolean) compositeComponent1.getAttributes().get("preRenderViewCallback"),
"preRenderViewCallback should be called");
application.publishEvent(facesContext, PostRenderViewEvent.class, root);
- Assertions.assertTrue((Boolean) compositeComponent1.getAttributes().get("postRenderViewCallback"),
+ assertTrue((Boolean) compositeComponent1.getAttributes().get("postRenderViewCallback"),
"postRenderViewCallback should be called");
/*
@@ -815,9 +816,9 @@ public void testSimpleFEvent2() throws Exception
*/
}
-
+
@Test
- public void testsCompositeRefVE() throws Exception {
+ void testsCompositeRefVE() throws Exception {
servletContext.addInitParameter(
MyfacesConfig.CACHE_EL_EXPRESSIONS,
@@ -827,11 +828,11 @@ public void testsCompositeRefVE() throws Exception {
vdl.buildView(facesContext, root, "testCompositeRefVE.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assertions.assertNotNull(facet1);
+ assertNotNull(facet1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -840,20 +841,20 @@ public void testsCompositeRefVE() throws Exception {
compositeComponent1.encodeAll(facesContext);
sw.flush();
- Assertions.assertTrue(sw.toString().contains("success"),
+ assertTrue(sw.toString().contains("success"),
"Error when rendering" + sw.toString());
}
@Test
- public void testSimpleThisResourceReference() throws Exception
+ void simpleThisResourceReference() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testSimpleThisResourceReference.xhtml");
UINamingContainer compositeComponent = (UINamingContainer) root.findComponent("cc1");
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
HtmlGraphicImage gi = (HtmlGraphicImage) compositeComponent.getFacet(UIComponent.COMPOSITE_FACET_NAME).findComponent("gi");
- Assertions.assertNotNull(gi);
+ assertNotNull(gi);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -865,23 +866,23 @@ public void testSimpleThisResourceReference() throws Exception
String result = sw.toString();
Resource resource = facesContext.getApplication().getResourceHandler().createResource("logo_mini.jpg", "testComposite");
- Assertions.assertNotNull(resource);
+ assertNotNull(resource);
- Assertions.assertTrue(result.contains(resource.getRequestPath()));
+ assertTrue(result.contains(resource.getRequestPath()));
}
-
+
@Test
- public void testComponentFromResourceId() throws Exception
+ void componentFromResourceId() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testComponentFromResourceId.xhtml");
UIComponent panelGroup = root.findComponent("testGroup");
- Assertions.assertNotNull(panelGroup);
+ assertNotNull(panelGroup);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent);
+ assertNotNull(compositeComponent);
UIOutput text = (UIOutput) compositeComponent.getFacet(UIComponent.COMPOSITE_FACET_NAME).findComponent("text");
- Assertions.assertNotNull(text);
+ assertNotNull(text);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentValidatorTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentValidatorTestCase.java
index 31268ab8eb..1a34061c70 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentValidatorTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentValidatorTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIInput;
@@ -25,10 +27,9 @@
import jakarta.faces.component.UIViewRoot;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositeComponentValidatorTestCase extends AbstractFaceletTestCase
+class CompositeComponentValidatorTestCase extends AbstractFaceletTestCase
{
@Override
protected void setupComponents() throws Exception
@@ -53,7 +54,7 @@ protected ExpressionFactory createExpressionFactory()
}
@Test
- public void testSimpleValidatorTarget() throws Exception
+ void simpleValidatorTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -65,21 +66,21 @@ public void testSimpleValidatorTarget() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIInput input1 = (UIInput) compositeComponent1.findComponent("testComponent");
- Assertions.assertNotNull(input1);
- Assertions.assertNotNull(input1.getValidators());
- Assertions.assertEquals(1, input1.getValidators().length);
+ assertNotNull(input1);
+ assertNotNull(input1.getValidators());
+ assertEquals(1, input1.getValidators().length);
bean.setValidator1Called(false);
input1.getValidators()[0].validate(facesContext, input1, "x");
- Assertions.assertTrue(bean.isValidator1Called());
+ assertTrue(bean.isValidator1Called());
}
@Test
- public void testCompositeValidatorTarget() throws Exception
+ void compositeValidatorTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -90,25 +91,25 @@ public void testCompositeValidatorTarget() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeValidatorTarget.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1inner = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent1inner);
+ assertNotNull(compositeComponent1inner);
UIInput input1 = (UIInput) compositeComponent1inner.findComponent("testComponent");
- Assertions.assertNotNull(input1);
- Assertions.assertNotNull(input1.getValidators());
- Assertions.assertEquals(1, input1.getValidators().length);
+ assertNotNull(input1);
+ assertNotNull(input1.getValidators());
+ assertEquals(1, input1.getValidators().length);
bean.setValidator1Called(false);
input1.getValidators()[0].validate(facesContext, input1, "x");
- Assertions.assertTrue(bean.isValidator1Called());
+ assertTrue(bean.isValidator1Called());
}
-
+
@Test
- public void testSimpleValidatorTarget2() throws Exception
+ void simpleValidatorTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -120,34 +121,34 @@ public void testSimpleValidatorTarget2() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIInput input1 = (UIInput) compositeComponent1.findComponent("testComponent");
- Assertions.assertNotNull(input1);
- Assertions.assertNotNull(input1.getValidators());
- Assertions.assertEquals(1, input1.getValidators().length);
+ assertNotNull(input1);
+ assertNotNull(input1.getValidators());
+ assertEquals(1, input1.getValidators().length);
bean.setValidator1Called(false);
input1.getValidators()[0].validate(facesContext, input1, "x");
- Assertions.assertTrue(bean.isValidator1Called());
+ assertTrue(bean.isValidator1Called());
UIInput input1n = (UIInput) compositeComponent1.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(input1n);
- Assertions.assertNotNull(input1n.getValidators());
- Assertions.assertEquals(1, input1n.getValidators().length);
+ assertNotNull(input1n);
+ assertNotNull(input1n.getValidators());
+ assertEquals(1, input1n.getValidators().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
bean.setValidator1Called(false);
input1n.getValidators()[0].validate(facesContext, input1n, "x");
- Assertions.assertTrue(bean.isValidator1Called());
+ assertTrue(bean.isValidator1Called());
compositeComponent1.popComponentFromEL(facesContext);
}
@Test
- public void testCompositeValidatorTarget2() throws Exception
+ void compositeValidatorTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -158,65 +159,65 @@ public void testCompositeValidatorTarget2() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeValidatorTarget2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1target = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent1target);
+ assertNotNull(compositeComponent1target);
UIInput input1target = (UIInput) compositeComponent1target.findComponent("testComponent");
- Assertions.assertNotNull(input1target);
- Assertions.assertNotNull(input1target.getValidators());
- Assertions.assertEquals(1, input1target.getValidators().length);
+ assertNotNull(input1target);
+ assertNotNull(input1target.getValidators());
+ assertEquals(1, input1target.getValidators().length);
bean.setValidator1Called(false);
input1target.getValidators()[0].validate(facesContext, input1target, "x");
- Assertions.assertTrue(bean.isValidator1Called());
+ assertTrue(bean.isValidator1Called());
UIInput input1notarget = (UIInput) compositeComponent1target.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(input1notarget);
- Assertions.assertNotNull(input1notarget.getValidators());
- Assertions.assertEquals(1, input1notarget.getValidators().length);
+ assertNotNull(input1notarget);
+ assertNotNull(input1notarget.getValidators());
+ assertEquals(1, input1notarget.getValidators().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1target.pushComponentToEL(facesContext, compositeComponent1target);
bean.setValidator1Called(false);
input1notarget.getValidators()[0].validate(facesContext, input1notarget, "x");
- Assertions.assertTrue(bean.isValidator1Called());
+ assertTrue(bean.isValidator1Called());
compositeComponent1target.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UINamingContainer compositeComponent1notarget = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1notarget);
+ assertNotNull(compositeComponent1notarget);
UIInput inputnotarget1target = (UIInput) compositeComponent1notarget.findComponent("testComponent");
- Assertions.assertNotNull(inputnotarget1target);
- Assertions.assertNotNull(inputnotarget1target.getValidators());
- Assertions.assertEquals(1, inputnotarget1target.getValidators().length);
+ assertNotNull(inputnotarget1target);
+ assertNotNull(inputnotarget1target.getValidators());
+ assertEquals(1, inputnotarget1target.getValidators().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1notarget.pushComponentToEL(facesContext, compositeComponent1notarget);
bean.setValidator1Called(false);
inputnotarget1target.getValidators()[0].validate(facesContext, inputnotarget1target, "x");
- Assertions.assertTrue(bean.isValidator1Called());
+ assertTrue(bean.isValidator1Called());
compositeComponent1notarget.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UIInput inputnotarget1notarget = (UIInput) compositeComponent1notarget.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(inputnotarget1notarget);
- Assertions.assertNotNull(inputnotarget1notarget.getValidators());
- Assertions.assertEquals(1, inputnotarget1notarget.getValidators().length);
+ assertNotNull(inputnotarget1notarget);
+ assertNotNull(inputnotarget1notarget.getValidators());
+ assertEquals(1, inputnotarget1notarget.getValidators().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1notarget.pushComponentToEL(facesContext, compositeComponent1notarget);
bean.setValidator1Called(false);
inputnotarget1notarget.getValidators()[0].validate(facesContext, inputnotarget1notarget, "x");
- Assertions.assertTrue(bean.isValidator1Called());
+ assertTrue(bean.isValidator1Called());
compositeComponent1notarget.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
}
-
+
@Test
- public void testSimpleValidatorNoTarget() throws Exception
+ void simpleValidatorNoTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -227,26 +228,26 @@ public void testSimpleValidatorNoTarget() throws Exception
vdl.buildView(facesContext, root, "testSimpleAttributeValidatorNoTarget.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIInput input1 = (UIInput) compositeComponent1.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(input1);
- Assertions.assertNotNull(input1.getValidators());
- Assertions.assertEquals(1, input1.getValidators().length);
+ assertNotNull(input1);
+ assertNotNull(input1.getValidators());
+ assertEquals(1, input1.getValidators().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
input1.pushComponentToEL(facesContext, input1);
bean.setValidator1Called(false);
input1.getValidators()[0].validate(facesContext, input1, "x");
- Assertions.assertTrue(bean.isValidator1Called());
+ assertTrue(bean.isValidator1Called());
input1.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
}
-
+
@Test
- public void testCompositeValidatorNoTarget() throws Exception
+ void compositeValidatorNoTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -257,29 +258,29 @@ public void testCompositeValidatorNoTarget() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeValidatorNoTarget.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1inner = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeActionMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1inner);
+ assertNotNull(compositeComponent1inner);
UIInput testComponentNoTarget1 = (UIInput) compositeComponent1inner.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget1);
- Assertions.assertNotNull(testComponentNoTarget1.getValidators());
- Assertions.assertEquals(1, testComponentNoTarget1.getValidators().length);
+ assertNotNull(testComponentNoTarget1);
+ assertNotNull(testComponentNoTarget1.getValidators());
+ assertEquals(1, testComponentNoTarget1.getValidators().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1inner);
bean.setValidator1Called(false);
testComponentNoTarget1.getValidators()[0].validate(facesContext, testComponentNoTarget1, "x");
- Assertions.assertTrue(bean.isValidator1Called());
+ assertTrue(bean.isValidator1Called());
compositeComponent1inner.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
}
@Test
- public void testCompositeValidatorNoTarget2() throws Exception
+ void compositeValidatorNoTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -290,23 +291,23 @@ public void testCompositeValidatorNoTarget2() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeValidatorNoTarget2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1n1 = (UINamingContainer) compositeComponent1.findComponent("compositeAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1n1);
+ assertNotNull(compositeComponent1n1);
UINamingContainer compositeComponent1n2 = (UINamingContainer) compositeComponent1n1.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1n2);
+ assertNotNull(compositeComponent1n2);
UIInput input1 = (UIInput) compositeComponent1n2.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(input1);
- Assertions.assertNotNull(input1.getValidators());
- Assertions.assertEquals(1, input1.getValidators().length);
+ assertNotNull(input1);
+ assertNotNull(input1.getValidators());
+ assertEquals(1, input1.getValidators().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1n2);
bean.setValidator1Called(false);
input1.getValidators()[0].validate(facesContext, input1, "x");
- Assertions.assertTrue(bean.isValidator1Called());
+ assertTrue(bean.isValidator1Called());
compositeComponent1n2.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentValueChangeListenerTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentValueChangeListenerTestCase.java
index c50c019315..8447802961 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentValueChangeListenerTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentValueChangeListenerTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIInput;
@@ -26,10 +28,9 @@
import jakarta.faces.event.ValueChangeEvent;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositeComponentValueChangeListenerTestCase extends AbstractFaceletTestCase
+class CompositeComponentValueChangeListenerTestCase extends AbstractFaceletTestCase
{
@Override
protected void setupComponents() throws Exception
@@ -52,9 +53,9 @@ protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
}
-
+
@Test
- public void testSimpleValueChangeListenerTarget() throws Exception
+ void simpleValueChangeListenerTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -66,34 +67,34 @@ public void testSimpleValueChangeListenerTarget() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIInput input1 = (UIInput) compositeComponent1.findComponent("testComponent");
- Assertions.assertNotNull(input1);
- Assertions.assertNotNull(input1.getValueChangeListeners());
- Assertions.assertEquals(1, input1.getValueChangeListeners().length);
+ assertNotNull(input1);
+ assertNotNull(input1.getValueChangeListeners());
+ assertEquals(1, input1.getValueChangeListeners().length);
bean.setValueChangeListener1Called(false);
input1.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input1,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener1Called());
+ assertTrue(bean.isValueChangeListener1Called());
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UIInput input2 = (UIInput) compositeComponent2.findComponent("testComponent");
- Assertions.assertNotNull(input2);
- Assertions.assertNotNull(input2.getValueChangeListeners());
- Assertions.assertEquals(1, input2.getValueChangeListeners().length);
+ assertNotNull(input2);
+ assertNotNull(input2.getValueChangeListeners());
+ assertEquals(1, input2.getValueChangeListeners().length);
bean.setValueChangeListener2Called(false);
input2.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input2,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener2Called());
+ assertTrue(bean.isValueChangeListener2Called());
}
@Test
- public void testCompositeValueChangeListenerTarget() throws Exception
+ void compositeValueChangeListenerTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -104,41 +105,41 @@ public void testCompositeValueChangeListenerTarget() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeValueChangeListenerTarget.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1inner = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent1inner);
+ assertNotNull(compositeComponent1inner);
UIInput input1 = (UIInput) compositeComponent1inner.findComponent("testComponent");
- Assertions.assertNotNull(input1);
- Assertions.assertNotNull(input1.getValueChangeListeners());
- Assertions.assertEquals(1, input1.getValueChangeListeners().length);
+ assertNotNull(input1);
+ assertNotNull(input1.getValueChangeListeners());
+ assertEquals(1, input1.getValueChangeListeners().length);
bean.setValueChangeListener1Called(false);
input1.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input1,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener1Called());
+ assertTrue(bean.isValueChangeListener1Called());
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UINamingContainer compositeComponent2inner = (UINamingContainer) compositeComponent2.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent2inner);
+ assertNotNull(compositeComponent2inner);
UIInput input2 = (UIInput) compositeComponent2inner.findComponent("testComponent");
- Assertions.assertNotNull(input2);
- Assertions.assertNotNull(input2.getValueChangeListeners());
- Assertions.assertEquals(1, input2.getValueChangeListeners().length);
+ assertNotNull(input2);
+ assertNotNull(input2.getValueChangeListeners());
+ assertEquals(1, input2.getValueChangeListeners().length);
bean.setValueChangeListener2Called(false);
input2.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input2,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener2Called());
+ assertTrue(bean.isValueChangeListener2Called());
}
-
+
@Test
- public void testSimpleValueChangeListenerTarget2() throws Exception
+ void simpleValueChangeListenerTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -150,58 +151,58 @@ public void testSimpleValueChangeListenerTarget2() throws Exception
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIInput input1 = (UIInput) compositeComponent1.findComponent("testComponent");
- Assertions.assertNotNull(input1);
- Assertions.assertNotNull(input1.getValueChangeListeners());
- Assertions.assertEquals(1, input1.getValueChangeListeners().length);
+ assertNotNull(input1);
+ assertNotNull(input1.getValueChangeListeners());
+ assertEquals(1, input1.getValueChangeListeners().length);
bean.setValueChangeListener1Called(false);
input1.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input1,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener1Called());
+ assertTrue(bean.isValueChangeListener1Called());
UIInput input1n = (UIInput) compositeComponent1.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(input1n);
- Assertions.assertNotNull(input1n.getValueChangeListeners());
- Assertions.assertEquals(1, input1n.getValueChangeListeners().length);
+ assertNotNull(input1n);
+ assertNotNull(input1n.getValueChangeListeners());
+ assertEquals(1, input1n.getValueChangeListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
bean.setValueChangeListener1Called(false);
input1n.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input1n,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener1Called());
+ assertTrue(bean.isValueChangeListener1Called());
compositeComponent1.popComponentFromEL(facesContext);
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UIInput input2 = (UIInput) compositeComponent2.findComponent("testComponent");
- Assertions.assertNotNull(input2);
- Assertions.assertNotNull(input2.getValueChangeListeners());
- Assertions.assertEquals(1, input2.getValueChangeListeners().length);
+ assertNotNull(input2);
+ assertNotNull(input2.getValueChangeListeners());
+ assertEquals(1, input2.getValueChangeListeners().length);
bean.setValueChangeListener2Called(false);
input2.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input2,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener2Called());
+ assertTrue(bean.isValueChangeListener2Called());
UIInput input2n = (UIInput) compositeComponent2.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(input2n);
- Assertions.assertNotNull(input2n.getValueChangeListeners());
- Assertions.assertEquals(1, input2n.getValueChangeListeners().length);
+ assertNotNull(input2n);
+ assertNotNull(input2n.getValueChangeListeners());
+ assertEquals(1, input2n.getValueChangeListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
bean.setValueChangeListener2Called(false);
input2n.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input2n,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener2Called());
+ assertTrue(bean.isValueChangeListener2Called());
compositeComponent2.popComponentFromEL(facesContext);
}
@Test
- public void testCompositeValueChangeListenerTarget2() throws Exception
+ void compositeValueChangeListenerTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -212,120 +213,120 @@ public void testCompositeValueChangeListenerTarget2() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeValueChangeListenerTarget2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1target = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent1target);
+ assertNotNull(compositeComponent1target);
UIInput input1target = (UIInput) compositeComponent1target.findComponent("testComponent");
- Assertions.assertNotNull(input1target);
- Assertions.assertNotNull(input1target.getValueChangeListeners());
- Assertions.assertEquals(1, input1target.getValueChangeListeners().length);
+ assertNotNull(input1target);
+ assertNotNull(input1target.getValueChangeListeners());
+ assertEquals(1, input1target.getValueChangeListeners().length);
bean.setValueChangeListener1Called(false);
input1target.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input1target,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener1Called());
+ assertTrue(bean.isValueChangeListener1Called());
UIInput input1notarget = (UIInput) compositeComponent1target.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(input1notarget);
- Assertions.assertNotNull(input1notarget.getValueChangeListeners());
- Assertions.assertEquals(1, input1notarget.getValueChangeListeners().length);
+ assertNotNull(input1notarget);
+ assertNotNull(input1notarget.getValueChangeListeners());
+ assertEquals(1, input1notarget.getValueChangeListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1target.pushComponentToEL(facesContext, compositeComponent1target);
bean.setValueChangeListener1Called(false);
input1notarget.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input1notarget,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener1Called());
+ assertTrue(bean.isValueChangeListener1Called());
compositeComponent1target.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UINamingContainer compositeComponent1notarget = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1notarget);
+ assertNotNull(compositeComponent1notarget);
UIInput inputnotarget1target = (UIInput) compositeComponent1notarget.findComponent("testComponent");
- Assertions.assertNotNull(inputnotarget1target);
- Assertions.assertNotNull(inputnotarget1target.getValueChangeListeners());
- Assertions.assertEquals(1, inputnotarget1target.getValueChangeListeners().length);
+ assertNotNull(inputnotarget1target);
+ assertNotNull(inputnotarget1target.getValueChangeListeners());
+ assertEquals(1, inputnotarget1target.getValueChangeListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1notarget.pushComponentToEL(facesContext, compositeComponent1notarget);
bean.setValueChangeListener1Called(false);
inputnotarget1target.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(inputnotarget1target,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener1Called());
+ assertTrue(bean.isValueChangeListener1Called());
compositeComponent1notarget.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UIInput inputnotarget1notarget = (UIInput) compositeComponent1notarget.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(inputnotarget1notarget);
- Assertions.assertNotNull(inputnotarget1notarget.getValueChangeListeners());
- Assertions.assertEquals(1, inputnotarget1notarget.getValueChangeListeners().length);
+ assertNotNull(inputnotarget1notarget);
+ assertNotNull(inputnotarget1notarget.getValueChangeListeners());
+ assertEquals(1, inputnotarget1notarget.getValueChangeListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1notarget.pushComponentToEL(facesContext, compositeComponent1notarget);
bean.setValueChangeListener1Called(false);
inputnotarget1notarget.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(inputnotarget1notarget,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener1Called());
+ assertTrue(bean.isValueChangeListener1Called());
compositeComponent1notarget.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UINamingContainer compositeComponent2target = (UINamingContainer) compositeComponent2.findComponent("simpleAttributeMethodExpressionTarget");
- Assertions.assertNotNull(compositeComponent2target);
+ assertNotNull(compositeComponent2target);
UIInput input2target = (UIInput) compositeComponent2target.findComponent("testComponent");
- Assertions.assertNotNull(input2target);
- Assertions.assertNotNull(input2target.getValueChangeListeners());
- Assertions.assertEquals(1, input2target.getValueChangeListeners().length);
+ assertNotNull(input2target);
+ assertNotNull(input2target.getValueChangeListeners());
+ assertEquals(1, input2target.getValueChangeListeners().length);
bean.setValueChangeListener2Called(false);
input2target.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input2target,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener2Called());
+ assertTrue(bean.isValueChangeListener2Called());
UIInput input2notarget = (UIInput) compositeComponent2target.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(input2notarget);
- Assertions.assertNotNull(input2notarget.getValueChangeListeners());
- Assertions.assertEquals(1, input2notarget.getValueChangeListeners().length);
+ assertNotNull(input2notarget);
+ assertNotNull(input2notarget.getValueChangeListeners());
+ assertEquals(1, input2notarget.getValueChangeListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
compositeComponent2target.pushComponentToEL(facesContext, compositeComponent2target);
bean.setValueChangeListener2Called(false);
input2notarget.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input2notarget,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener2Called());
+ assertTrue(bean.isValueChangeListener2Called());
compositeComponent2target.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
UINamingContainer compositeComponent2notarget = (UINamingContainer) compositeComponent2.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent2notarget);
+ assertNotNull(compositeComponent2notarget);
UIInput inputnotarget2target = (UIInput) compositeComponent2notarget.findComponent("testComponent");
- Assertions.assertNotNull(inputnotarget2target);
- Assertions.assertNotNull(inputnotarget2target.getValueChangeListeners());
- Assertions.assertEquals(1, inputnotarget2target.getValueChangeListeners().length);
+ assertNotNull(inputnotarget2target);
+ assertNotNull(inputnotarget2target.getValueChangeListeners());
+ assertEquals(1, inputnotarget2target.getValueChangeListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
compositeComponent2notarget.pushComponentToEL(facesContext, compositeComponent2notarget);
bean.setValueChangeListener2Called(false);
inputnotarget2target.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(inputnotarget2target,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener2Called());
+ assertTrue(bean.isValueChangeListener2Called());
compositeComponent2notarget.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
UIInput inputnotarget2notarget = (UIInput) compositeComponent2notarget.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(inputnotarget2notarget);
- Assertions.assertNotNull(inputnotarget2notarget.getValueChangeListeners());
- Assertions.assertEquals(1, inputnotarget2notarget.getValueChangeListeners().length);
+ assertNotNull(inputnotarget2notarget);
+ assertNotNull(inputnotarget2notarget.getValueChangeListeners());
+ assertEquals(1, inputnotarget2notarget.getValueChangeListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
compositeComponent2notarget.pushComponentToEL(facesContext, compositeComponent2notarget);
bean.setValueChangeListener2Called(false);
inputnotarget2notarget.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(inputnotarget2notarget,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener2Called());
+ assertTrue(bean.isValueChangeListener2Called());
compositeComponent2notarget.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
}
-
+
@Test
- public void testSimpleValueChangeListenerNoTarget() throws Exception
+ void simpleValueChangeListenerNoTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -336,44 +337,44 @@ public void testSimpleValueChangeListenerNoTarget() throws Exception
vdl.buildView(facesContext, root, "testSimpleAttributeValueChangeListenerNoTarget.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UIInput input1 = (UIInput) compositeComponent1.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(input1);
- Assertions.assertNotNull(input1.getValueChangeListeners());
- Assertions.assertEquals(1, input1.getValueChangeListeners().length);
+ assertNotNull(input1);
+ assertNotNull(input1.getValueChangeListeners());
+ assertEquals(1, input1.getValueChangeListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
input1.pushComponentToEL(facesContext, input1);
bean.setValueChangeListener1Called(false);
input1.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input1,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener1Called());
+ assertTrue(bean.isValueChangeListener1Called());
input1.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UIInput input2 = (UIInput) compositeComponent2.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(input2);
- Assertions.assertNotNull(input2.getValueChangeListeners());
- Assertions.assertEquals(1, input2.getValueChangeListeners().length);
+ assertNotNull(input2);
+ assertNotNull(input2.getValueChangeListeners());
+ assertEquals(1, input2.getValueChangeListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
input2.pushComponentToEL(facesContext, input2);
bean.setValueChangeListener2Called(false);
input2.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input2,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener2Called());
+ assertTrue(bean.isValueChangeListener2Called());
input2.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
}
-
+
@Test
- public void testCompositeValueChangeListenerNoTarget() throws Exception
+ void compositeValueChangeListenerNoTarget() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -384,49 +385,49 @@ public void testCompositeValueChangeListenerNoTarget() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeValueChangeListenerNoTarget.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1inner = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeActionMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1inner);
+ assertNotNull(compositeComponent1inner);
UIInput testComponentNoTarget1 = (UIInput) compositeComponent1inner.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget1);
- Assertions.assertNotNull(testComponentNoTarget1.getValueChangeListeners());
- Assertions.assertEquals(1, testComponentNoTarget1.getValueChangeListeners().length);
+ assertNotNull(testComponentNoTarget1);
+ assertNotNull(testComponentNoTarget1.getValueChangeListeners());
+ assertEquals(1, testComponentNoTarget1.getValueChangeListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1inner);
bean.setValueChangeListener1Called(false);
testComponentNoTarget1.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(testComponentNoTarget1,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener1Called());
+ assertTrue(bean.isValueChangeListener1Called());
compositeComponent1inner.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UIComponent panelGroup2 = root.findComponent("testGroup2");
- Assertions.assertNotNull(panelGroup2);
+ assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent2);
+ assertNotNull(compositeComponent2);
UINamingContainer compositeComponent2inner = (UINamingContainer) compositeComponent2.findComponent("simpleAttributeActionMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent2inner);
+ assertNotNull(compositeComponent2inner);
UIInput testComponentNoTarget2 = (UIInput) compositeComponent2inner.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(testComponentNoTarget2);
- Assertions.assertNotNull(testComponentNoTarget2.getValueChangeListeners());
- Assertions.assertEquals(1, testComponentNoTarget2.getValueChangeListeners().length);
+ assertNotNull(testComponentNoTarget2);
+ assertNotNull(testComponentNoTarget2.getValueChangeListeners());
+ assertEquals(1, testComponentNoTarget2.getValueChangeListeners().length);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2inner);
bean.setValueChangeListener2Called(false);
testComponentNoTarget2.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(testComponentNoTarget2,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener2Called());
+ assertTrue(bean.isValueChangeListener2Called());
compositeComponent2inner.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
}
@Test
- public void testCompositeValueChangeListenerNoTarget2() throws Exception
+ void compositeValueChangeListenerNoTarget2() throws Exception
{
MockAttributeBean bean = new MockAttributeBean();
@@ -437,23 +438,23 @@ public void testCompositeValueChangeListenerNoTarget2() throws Exception
vdl.buildView(facesContext, root, "testCompositeAttributeValueChangeListenerNoTarget2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- Assertions.assertNotNull(panelGroup1);
+ assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- Assertions.assertNotNull(compositeComponent1);
+ assertNotNull(compositeComponent1);
UINamingContainer compositeComponent1n1 = (UINamingContainer) compositeComponent1.findComponent("compositeAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1n1);
+ assertNotNull(compositeComponent1n1);
UINamingContainer compositeComponent1n2 = (UINamingContainer) compositeComponent1n1.findComponent("simpleAttributeMethodExpressionNoTarget");
- Assertions.assertNotNull(compositeComponent1n2);
+ assertNotNull(compositeComponent1n2);
UIInput input1 = (UIInput) compositeComponent1n2.findComponent("testComponentNoTarget");
- Assertions.assertNotNull(input1);
- Assertions.assertNotNull(input1.getValueChangeListeners());
- Assertions.assertEquals(1, input1.getValueChangeListeners().length);
+ assertNotNull(input1);
+ assertNotNull(input1.getValueChangeListeners());
+ assertEquals(1, input1.getValueChangeListeners().length);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1n2);
bean.setValueChangeListener1Called(false);
input1.getValueChangeListeners()[0].processValueChange(new ValueChangeEvent(input1,"x","y"));
- Assertions.assertTrue(bean.isValueChangeListener1Called());
+ assertTrue(bean.isValueChangeListener1Called());
compositeComponent1n2.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/OverwriteRequiredCompositeTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/OverwriteRequiredCompositeTest.java
index e2ce92b55e..85bddbb8c8 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/OverwriteRequiredCompositeTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/OverwriteRequiredCompositeTest.java
@@ -19,14 +19,15 @@
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.component.UICommand;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
// test for MYFACES-4656
-public class OverwriteRequiredCompositeTest extends AbstractMyFacesCDIRequestTestCase
+class OverwriteRequiredCompositeTest extends AbstractMyFacesCDIRequestTestCase
{
@Override
protected void setUpServletObjects() throws Exception
@@ -37,28 +38,28 @@ protected void setUpServletObjects() throws Exception
}
@Test
- public void testSimpleCompositeComponent() throws Exception
+ void simpleCompositeComponent() throws Exception
{
startViewRequest("/overwriteRequiredComposite.xhtml");
processLifecycleExecuteAndRender();
String content = getRenderedContent(facesContext);
- Assertions.assertTrue(content.contains("form:fifth REQUIRED: false")
+ assertTrue(content.contains("form:fifth REQUIRED: false")
&& content.contains("form:fifth VALID: true"));
- Assertions.assertTrue(content.contains("form:sixth REQUIRED: true")
+ assertTrue(content.contains("form:sixth REQUIRED: true")
&& content.contains("form:sixth VALID: true"));
- Assertions.assertTrue(content.contains("form:seventh REQUIRED: true")
+ assertTrue(content.contains("form:seventh REQUIRED: true")
&& content.contains("form:seventh VALID: true"));
- Assertions.assertTrue(content.contains("form:eight REQUIRED: true")
+ assertTrue(content.contains("form:eight REQUIRED: true")
&& content.contains("form:eight VALID: true"));
- Assertions.assertTrue(content.contains("form:ninth REQUIRED: false")
+ assertTrue(content.contains("form:ninth REQUIRED: false")
&& content.contains("form:ninth VALID: true"));
- Assertions.assertTrue(content.contains("form:tenth REQUIRED: true")
+ assertTrue(content.contains("form:tenth REQUIRED: true")
&& content.contains("form:tenth VALID: true"));
- Assertions.assertTrue(content.contains("form:eleventh REQUIRED: true")
+ assertTrue(content.contains("form:eleventh REQUIRED: true")
&& content.contains("form:eleventh VALID: true"));
- Assertions.assertTrue(content.contains("form:twelvth REQUIRED: true")
+ assertTrue(content.contains("form:twelvth REQUIRED: true")
&& content.contains("form:twelvth VALID: true"));
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/SerializableAttributesTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/SerializableAttributesTestCase.java
index 5e5a9a341d..8f4396d5a5 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/SerializableAttributesTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/SerializableAttributesTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.composite;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.beans.BeanDescriptor;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -25,13 +27,12 @@
import java.io.ObjectOutputStream;
import jakarta.faces.component.UINamingContainer;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class SerializableAttributesTestCase
+class SerializableAttributesTestCase
{
@Test
- public void testSerializeCompositeResourceWrapper() throws Exception
+ void serializeCompositeResourceWrapper() throws Exception
{
CompositeResourceWrapper subject = new CompositeResourceWrapper();
subject.setResourceName("testRes");
@@ -46,15 +47,15 @@ public void testSerializeCompositeResourceWrapper() throws Exception
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bais);
CompositeResourceWrapper blorg = (CompositeResourceWrapper) ois.readObject();
- Assertions.assertEquals(blorg.getResourceName(), subject.getResourceName());
- Assertions.assertEquals(blorg.getLibraryName(), subject.getLibraryName());
- Assertions.assertEquals(blorg.getContentType(), subject.getContentType());
+ assertEquals(blorg.getResourceName(), subject.getResourceName());
+ assertEquals(blorg.getLibraryName(), subject.getLibraryName());
+ assertEquals(blorg.getContentType(), subject.getContentType());
oos.close();
ois.close();
}
-
+
@Test
- public void testSerializeCompositeComponentBeanInfo() throws Exception
+ void serializeCompositeComponentBeanInfo() throws Exception
{
BeanDescriptor descriptor = new BeanDescriptor(UINamingContainer.class);
CompositeComponentBeanInfo subject = new CompositeComponentBeanInfo(descriptor);
@@ -70,8 +71,8 @@ public void testSerializeCompositeComponentBeanInfo() throws Exception
ObjectInputStream ois = new ObjectInputStream(bais);
CompositeComponentBeanInfo blorg = (CompositeComponentBeanInfo) ois.readObject();
- Assertions.assertEquals(UINamingContainer.class, blorg.getBeanDescriptor().getBeanClass());
- Assertions.assertEquals(pd.getName(), blorg.getPropertyDescriptorsList().get(0).getName());
+ assertEquals(UINamingContainer.class, blorg.getBeanDescriptor().getBeanClass());
+ assertEquals(pd.getName(), blorg.getPropertyDescriptorsList().get(0).getName());
oos.close();
ois.close();
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/localized/LocalizedCompositeComponentTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/localized/LocalizedCompositeComponentTestCase.java
index 61a6f3c041..9584c5a613 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/localized/LocalizedCompositeComponentTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/localized/LocalizedCompositeComponentTestCase.java
@@ -21,9 +21,11 @@
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.test.core.AbstractMyFacesRequestTestCase;
import org.apache.myfaces.test.core.annotation.DeclareFacesConfig;
-import org.junit.jupiter.api.Assertions;
+
import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* Check if a composite component can be localized following the rules
* of Faces 2.0 Resource Handler API that are used for css, javascript
@@ -33,7 +35,7 @@
*
*/
@DeclareFacesConfig("/faces-config.xml")
-public class LocalizedCompositeComponentTestCase extends AbstractMyFacesCDIRequestTestCase
+class LocalizedCompositeComponentTestCase extends AbstractMyFacesCDIRequestTestCase
{
// This is a nice example that shows how AbstractMyFacesRequestTestCase
// could be be useful.
@@ -43,31 +45,31 @@ public class LocalizedCompositeComponentTestCase extends AbstractMyFacesCDIReque
// teardown all MyFaces container.
@Test
- public void testNoLocaleCompositeComponent() throws Exception
+ void noLocaleCompositeComponent() throws Exception
{
startViewRequest("/testNoLocalizedComposite.xhtml");
processLifecycleExecuteAndRender();
- Assertions.assertTrue(getRenderedContent().contains(
+ assertTrue(getRenderedContent().contains(
"English page fragment"));
endRequest();
}
-
+
@Test
- public void testSpanishLocaleCompositeComponent() throws Exception
+ void spanishLocaleCompositeComponent() throws Exception
{
startViewRequest("/testSpanishLocalizedComposite.xhtml");
processLifecycleExecuteAndRender();
- Assertions.assertTrue(getRenderedContent().contains(
+ assertTrue(getRenderedContent().contains(
"Fragmento de pagina Espanol"));
endRequest();
}
-
+
@Test
- public void testGermanLocaleCompositeComponent() throws Exception
+ void germanLocaleCompositeComponent() throws Exception
{
startViewRequest("/testGermanLocalizedComposite.xhtml");
processLifecycleExecuteAndRender();
- Assertions.assertTrue(getRenderedContent().contains(
+ assertTrue(getRenderedContent().contains(
"Deutsches Seitenfragment"));
endRequest();
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/AjaxListenerTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/AjaxListenerTestCase.java
index e3fb8acd9b..c13dfc3a33 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/AjaxListenerTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/AjaxListenerTestCase.java
@@ -19,6 +19,8 @@
package org.apache.myfaces.view.facelets.tag.faces.core;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.util.List;
import java.util.Map;
@@ -33,7 +35,6 @@
import jakarta.faces.event.AjaxBehaviorEvent;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -41,43 +42,43 @@
* f:ajax listener must accept a method taking the AjaxBehaviorEvent or a method taking no arguments.
* The method taking the event is preferred when both exist.
*/
-public class AjaxListenerTestCase extends AbstractFaceletTestCase
+class AjaxListenerTestCase extends AbstractFaceletTestCase
{
private AjaxListenerBean bean;
@BeforeEach
- public void setUpBean()
+ void setUpBean()
{
bean = new AjaxListenerBean();
facesContext.getExternalContext().getRequestMap().put("ajaxListenerBean", bean);
}
@Test
- public void testOneArgMethod() throws Exception
+ void oneArgMethod() throws Exception
{
- Assertions.assertEquals(List.of("oneArg(event)"), broadcast("oneArg"));
+ assertEquals(List.of("oneArg(event)"), broadcast("oneArg"));
}
@Test
- public void testZeroArgMethod() throws Exception
+ void zeroArgMethod() throws Exception
{
- Assertions.assertEquals(List.of("zeroArg()"), broadcast("zeroArg"));
+ assertEquals(List.of("zeroArg()"), broadcast("zeroArg"));
}
@Test
- public void testBothMethodsPrefersEvent() throws Exception
+ void bothMethodsPrefersEvent() throws Exception
{
- Assertions.assertEquals(List.of("both(event)"), broadcast("both"));
+ assertEquals(List.of("both(event)"), broadcast("both"));
}
@Test
- public void testMissingMethod() throws Exception
+ void missingMethod() throws Exception
{
- Assertions.assertThrows(MethodNotFoundException.class, () -> broadcast("missing"));
+ assertThrows(MethodNotFoundException.class, () -> broadcast("missing"));
}
@Test
- public void testStateSaving() throws Exception
+ void stateSaving() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "ajaxListener.xhtml");
@@ -96,7 +97,7 @@ public void testStateSaving() throws Exception
restored.processAjaxBehavior(new AjaxBehaviorEvent(facesContext,
root.findComponent("form:zeroArg"), getAjaxBehavior(root, "zeroArg")));
- Assertions.assertEquals(List.of("zeroArg()"), bean.getInvocations());
+ assertEquals(List.of("zeroArg()"), bean.getInvocations());
}
private List broadcast(String id) throws Exception
@@ -114,12 +115,12 @@ private List broadcast(String id) throws Exception
private AjaxBehavior getAjaxBehavior(UIViewRoot root, String id)
{
UIComponent input = root.findComponent("form:" + id);
- Assertions.assertNotNull(input);
+ assertNotNull(input);
Map> behaviors = ((ClientBehaviorHolder) input).getClientBehaviors();
List change = behaviors.get("change");
- Assertions.assertNotNull(change);
- Assertions.assertEquals(1, change.size());
+ assertNotNull(change);
+ assertEquals(1, change.size());
return (AjaxBehavior) change.get(0);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/CoreTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/CoreTestCase.java
index 871d1595a9..b64e191c2b 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/CoreTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/CoreTestCase.java
@@ -20,7 +20,11 @@
package org.apache.myfaces.view.facelets.tag.faces.core;
import org.apache.myfaces.view.facelets.tag.faces.core.reset.ResetValuesBean;
+
import java.text.DateFormat;
+
+import static org.junit.jupiter.api.Assertions.*;
+
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@@ -59,10 +63,9 @@
import org.apache.myfaces.renderkit.html.HtmlTableRenderer;
import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CoreTestCase extends AbstractFaceletTestCase
+class CoreTestCase extends AbstractFaceletTestCase
{
@Override
@@ -124,7 +127,7 @@ protected void setupRenderers() throws Exception
}
@Test
- public void testActionListenerHandler() throws Exception
+ void actionListenerHandler() throws Exception
{
ActionListener listener = new ActionListenerImpl();
@@ -137,15 +140,15 @@ public void testActionListenerHandler() throws Exception
UICommand action1 = (UICommand) root.findComponent("action1");
UICommand action2 = (UICommand) root.findComponent("action2");
- Assertions.assertNotNull(action1);
- Assertions.assertNotNull(action2);
+ assertNotNull(action1);
+ assertNotNull(action2);
- Assertions.assertEquals(1,action1.getActionListeners().length);
- Assertions.assertEquals(2,action2.getActionListeners().length);
+ assertEquals(1,action1.getActionListeners().length);
+ assertEquals(2,action2.getActionListeners().length);
}
@Test
- public void testAttributeHandler() throws Exception
+ void attributeHandler() throws Exception
{
String title = "Dog in a Funny Hat";
facesContext.getExternalContext().getRequestMap().put("title", title);
@@ -158,15 +161,15 @@ public void testAttributeHandler() throws Exception
HtmlGraphicImage graphic2 = (HtmlGraphicImage) root
.findComponent("graphic2");
- Assertions.assertNotNull(graphic1);
- Assertions.assertNotNull(graphic2);
+ assertNotNull(graphic1);
+ assertNotNull(graphic2);
- Assertions.assertEquals("literal", graphic1.getTitle());
- Assertions.assertEquals(title, graphic2.getTitle());
+ assertEquals("literal", graphic1.getTitle());
+ assertEquals(title, graphic2.getTitle());
}
@Test
- public void testConvertDateTimeHandler() throws Exception
+ void convertDateTimeHandler() throws Exception
{
Date now = new Date(1000 * 360 * 60 * 24 * 7);
facesContext.getExternalContext().getRequestMap().put("now", now);
@@ -181,18 +184,18 @@ public void testConvertDateTimeHandler() throws Exception
UIOutput out5 = (UIOutput) root.findComponent("form:out5");
UIOutput out6 = (UIOutput) root.findComponent("form:out6");
- Assertions.assertNotNull(out1);
- Assertions.assertNotNull(out2);
- Assertions.assertNotNull(out3);
- Assertions.assertNotNull(out4);
- Assertions.assertNotNull(out5);
- Assertions.assertNotNull(out6);
-
- Assertions.assertNotNull(out1.getConverter());
- Assertions.assertNotNull(out2.getConverter());
- Assertions.assertNotNull(out3.getConverter());
- Assertions.assertNotNull(out4.getConverter());
- Assertions.assertNotNull(out5.getConverter());
+ assertNotNull(out1);
+ assertNotNull(out2);
+ assertNotNull(out3);
+ assertNotNull(out4);
+ assertNotNull(out5);
+ assertNotNull(out6);
+
+ assertNotNull(out1.getConverter());
+ assertNotNull(out2.getConverter());
+ assertNotNull(out3.getConverter());
+ assertNotNull(out4.getConverter());
+ assertNotNull(out5.getConverter());
DateTimeConverter converter6 = (DateTimeConverter) out6.getConverter();
TimeZone gmt = TimeZone.getTimeZone("GMT");
@@ -200,38 +203,38 @@ public void testConvertDateTimeHandler() throws Exception
DateFormat shortDate = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
shortDate.setLenient(false);
shortDate.setTimeZone(gmt);
- Assertions.assertEquals(shortDate.format(now), out1.getConverter().getAsString(
+ assertEquals(shortDate.format(now), out1.getConverter().getAsString(
facesContext, out1, now));
DateFormat shortDateMediumTime = DateFormat.getDateTimeInstance(
DateFormat.SHORT, DateFormat.MEDIUM, Locale.US);
shortDateMediumTime.setLenient(false);
shortDateMediumTime.setTimeZone(gmt);
- Assertions.assertEquals(shortDateMediumTime.format(now), out2.getConverter()
+ assertEquals(shortDateMediumTime.format(now), out2.getConverter()
.getAsString(facesContext, out2, now));
DateFormat mediumDate = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.US);
mediumDate.setTimeZone(TimeZone.getTimeZone("CST"));
mediumDate.setLenient(false);
- Assertions.assertEquals(mediumDate.format(now), out3.getConverter()
+ assertEquals(mediumDate.format(now), out3.getConverter()
.getAsString(facesContext, out3, now));
DateFormat mediumTime = DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.US);
mediumTime.setLenient(false);
mediumTime.setTimeZone(gmt);
- Assertions.assertEquals(mediumTime.format(now), out4.getConverter()
+ assertEquals(mediumTime.format(now), out4.getConverter()
.getAsString(facesContext, out4, now));
SimpleDateFormat patternCst = new SimpleDateFormat("K:mm a, z", Locale.US);
patternCst.setTimeZone(TimeZone.getTimeZone("CST"));
patternCst.setLenient(false);
- Assertions.assertEquals(patternCst.format(now), out5.getConverter()
+ assertEquals(patternCst.format(now), out5.getConverter()
.getAsString(facesContext, out5, now));
- Assertions.assertEquals(TimeZone.getTimeZone("GMT"), converter6.getTimeZone());
+ assertEquals(TimeZone.getTimeZone("GMT"), converter6.getTimeZone());
}
@Test
- public void testConvertDelegateHandler() throws Exception
+ void convertDelegateHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
root.setLocale(Locale.US);
@@ -239,16 +242,16 @@ public void testConvertDelegateHandler() throws Exception
UIOutput out1 = (UIOutput) root.findComponent("out1");
- Assertions.assertNotNull( out1);
+ assertNotNull( out1);
- Assertions.assertNotNull(out1.getConverter());
+ assertNotNull(out1.getConverter());
- Assertions.assertEquals(new Double(42.5), out1.getConverter()
+ assertEquals(new Double(42.5), out1.getConverter()
.getAsObject(facesContext, out1, out1.getLocalValue().toString()));
}
@Test
- public void testConvertNumberHandler() throws Exception
+ void convertNumberHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
root.setLocale(Locale.US);
@@ -260,57 +263,57 @@ public void testConvertNumberHandler() throws Exception
UIOutput out4 = (UIOutput) root.findComponent("out4");
UIOutput out5 = (UIOutput) root.findComponent("out5");
- Assertions.assertNotNull(out1);
- Assertions.assertNotNull(out2);
- Assertions.assertNotNull(out3);
- Assertions.assertNotNull(out4);
- Assertions.assertNotNull(out5);
+ assertNotNull(out1);
+ assertNotNull(out2);
+ assertNotNull(out3);
+ assertNotNull(out4);
+ assertNotNull(out5);
- Assertions.assertNotNull(out1.getConverter());
- Assertions.assertNotNull(out2.getConverter());
- Assertions.assertNotNull(out3.getConverter());
- Assertions.assertNotNull(out4.getConverter());
- Assertions.assertNotNull(out5.getConverter());
+ assertNotNull(out1.getConverter());
+ assertNotNull(out2.getConverter());
+ assertNotNull(out3.getConverter());
+ assertNotNull(out4.getConverter());
+ assertNotNull(out5.getConverter());
- Assertions.assertEquals("12", out1.getConverter().getAsString(facesContext,
+ assertEquals("12", out1.getConverter().getAsString(facesContext,
out1, new Double(12.001)));
- Assertions.assertEquals("$12.00", out2.getConverter().getAsString(
+ assertEquals("$12.00", out2.getConverter().getAsString(
facesContext, out2, new Double(12.00)));
- Assertions.assertEquals("00,032", out3.getConverter().getAsString(
+ assertEquals("00,032", out3.getConverter().getAsString(
facesContext, out3, new Double(32)));
- Assertions.assertEquals("0.67", out4.getConverter().getAsString(
+ assertEquals("0.67", out4.getConverter().getAsString(
facesContext, out4, new Double(2.0 / 3.0)));
- Assertions.assertEquals("67%", out5.getConverter().getAsString(
+ assertEquals("67%", out5.getConverter().getAsString(
facesContext, out5, new Double(0.67)));
}
@Test
- public void testFacetHandler() throws Exception
+ void facetHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "facet.xml");
UIData data = (UIData) root.findComponent("table");
- Assertions.assertNotNull(data);
+ assertNotNull(data);
UIComponent footer = data.getFooter();
- Assertions.assertNotNull(footer);
+ assertNotNull(footer);
}
@Test
- public void testLoadBundleHandler() throws Exception
+ void loadBundleHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "loadBundle.xml");
Object value = facesContext.getExternalContext().getRequestMap().get("foo");
- Assertions.assertNotNull(value);
- Assertions.assertTrue(value instanceof Map);
+ assertNotNull(value);
+ assertInstanceOf(Map.class, value);
String result = (String) ((Map) value).get("some.not.found.key");
- Assertions.assertTrue(result.contains("???"));
+ assertTrue(result.contains("???"));
}
/**
@@ -320,35 +323,35 @@ public void testLoadBundleHandler() throws Exception
* buildView time; changing the locale afterwards had no effect.
*/
@Test
- public void testLoadBundleHandlerRefreshesOnLocaleChange() throws Exception
+ void loadBundleHandlerRefreshesOnLocaleChange() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
root.setLocale(Locale.ENGLISH);
vdl.buildView(facesContext, root, "loadBundle.xml");
Map, ?> bundle = (Map, ?>) facesContext.getExternalContext().getRequestMap().get("foo");
- Assertions.assertNotNull(bundle);
- Assertions.assertEquals("bar_en", bundle.get("foo"),
+ assertNotNull(bundle);
+ assertEquals("bar_en", bundle.get("foo"),
"English locale should return 'bar_en' (from bundle_en.properties)");
// Simulate locale change during invoke-application (MYFACES-4426).
root.setLocale(Locale.GERMAN);
- Assertions.assertEquals("baz_de", bundle.get("foo"),
+ assertEquals("baz_de", bundle.get("foo"),
"After setLocale(GERMAN) the bundle map must return the German value without rebuildView");
}
@Test
- public void testValidateDelegateHandler() throws Exception
+ void validateDelegateHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "validator.xml");
UIInput input = (UIInput) root.findComponent("form:input");
- Assertions.assertNotNull(input);
+ assertNotNull(input);
- Assertions.assertEquals(1, input.getValidators().length);
+ assertEquals(1, input.getValidators().length);
Validator v = input.getValidators()[0];
@@ -356,16 +359,16 @@ public void testValidateDelegateHandler() throws Exception
}
@Test
- public void testValidateDoubleRangeHandler() throws Exception
+ void validateDoubleRangeHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "validateDoubleRange.xml");
UIInput input = (UIInput) root.findComponent("form:input");
- Assertions.assertNotNull(input);
+ assertNotNull(input);
- Assertions.assertEquals(1, input.getValidators().length);
+ assertEquals(1, input.getValidators().length);
Validator v = input.getValidators()[0];
@@ -373,16 +376,16 @@ public void testValidateDoubleRangeHandler() throws Exception
}
@Test
- public void testValidateLengthHandler() throws Exception
+ void validateLengthHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "validateLength.xml");
UIInput input = (UIInput) root.findComponent("form:input");
- Assertions.assertNotNull(input);
+ assertNotNull(input);
- Assertions.assertEquals(1, input.getValidators().length);
+ assertEquals(1, input.getValidators().length);
Validator v = input.getValidators()[0];
@@ -390,16 +393,16 @@ public void testValidateLengthHandler() throws Exception
}
@Test
- public void testValidateLongRangeHandler() throws Exception
+ void validateLongRangeHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "validateLongRange.xml");
UIInput input = (UIInput) root.findComponent("form:input");
- Assertions.assertNotNull(input);
+ assertNotNull(input);
- Assertions.assertEquals(1, input.getValidators().length);
+ assertEquals(1, input.getValidators().length);
Validator v = input.getValidators()[0];
@@ -407,30 +410,30 @@ public void testValidateLongRangeHandler() throws Exception
}
@Test
- public void testValueChangeListenerHandler() throws Exception
+ void valueChangeListenerHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "valueChangeListener.xml");
UIInput input = (UIInput) root.findComponent("form:input");
- Assertions.assertNotNull(input);
+ assertNotNull(input);
- Assertions.assertEquals(1,
+ assertEquals(1,
input.getValueChangeListeners().length);
}
@Test
- public void testViewHandler() throws Exception
+ void viewHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "view.xml");
- Assertions.assertEquals(Locale.GERMAN, root.getLocale());
+ assertEquals(Locale.GERMAN, root.getLocale());
}
-
+
@Test
- public void testResetValuesActionListenerHandler() throws Exception
+ void resetValuesActionListenerHandler() throws Exception
{
ResetValuesBean bean = new ResetValuesBean();
@@ -443,14 +446,14 @@ public void testResetValuesActionListenerHandler() throws Exception
UICommand action1 = (UICommand) root.findComponent("mainForm:submit");
- Assertions.assertNotNull(action1);
+ assertNotNull(action1);
- Assertions.assertEquals(1, action1.getActionListeners().length);
+ assertEquals(1, action1.getActionListeners().length);
UIInput field1 = (UIInput) root.findComponent("mainForm:field1");
field1.setValue("xxx");
- Assertions.assertEquals("xxx", field1.getValue());
- Assertions.assertTrue(field1.isLocalValueSet());
+ assertEquals("xxx", field1.getValue());
+ assertTrue(field1.isLocalValueSet());
UIInput field2 = (UIInput) root.findComponent("mainForm:field2");
field2.setSubmittedValue("1");
@@ -459,10 +462,10 @@ public void testResetValuesActionListenerHandler() throws Exception
action1.getActionListeners()[0].processAction(new ActionEvent(action1));
// If resetValues() was activated,
- Assertions.assertEquals("Hello",field1.getValue());
- Assertions.assertFalse(field1.isLocalValueSet());
- Assertions.assertNull(field2.getSubmittedValue());
- Assertions.assertTrue(field2.isValid());
+ assertEquals("Hello",field1.getValue());
+ assertFalse(field1.isLocalValueSet());
+ assertNull(field2.getSubmittedValue());
+ assertTrue(field2.isValid());
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/ValidateBeanTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/ValidateBeanTestCase.java
index c7e8ccd2bf..f1f4345cf5 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/ValidateBeanTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/ValidateBeanTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.faces.core;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.IOException;
import java.lang.reflect.Field;
@@ -29,7 +31,6 @@
import org.apache.myfaces.util.ExternalSpecifications;
import org.apache.myfaces.util.lang.Lazy;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -39,7 +40,7 @@
* @author Jakob Korherr (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class ValidateBeanTestCase extends AbstractFaceletTestCase
+class ValidateBeanTestCase extends AbstractFaceletTestCase
{
@Override
@@ -136,7 +137,7 @@ private String _getValidationGroups(UIInput input)
*/
@Test
@SuppressWarnings("unchecked")
- public void testBeanValidatorInstalledManually() throws IOException
+ void beanValidatorInstalledManually() throws Exception
{
// put the disabled value on the request scope
externalContext.getRequestMap().put("validateBeanDisabled", Boolean.FALSE);
@@ -149,9 +150,9 @@ public void testBeanValidatorInstalledManually() throws IOException
UIInput input = (UIInput) root.findComponent("form:input");
// the UIInput has to have the BeanValidator installed
- Assertions.assertTrue(_hasValidator(input, BeanValidator.class));
+ assertTrue(_hasValidator(input, BeanValidator.class));
}
-
+
/**
* Tests the case that the UIInput has no nested
* on the facelet, but the BeanValidator is a default validator.
@@ -159,7 +160,7 @@ public void testBeanValidatorInstalledManually() throws IOException
* @throws IOException
*/
@Test
- public void testBeanValidatorInstalledAutomatically() throws IOException
+ void beanValidatorInstalledAutomatically() throws Exception
{
// add the BeanValidator as default-validator
application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
@@ -172,9 +173,9 @@ public void testBeanValidatorInstalledAutomatically() throws IOException
UIInput input = (UIInput) root.findComponent("form:input");
// the UIInput has to have the BeanValidator installed
- Assertions.assertTrue(_hasValidator(input, BeanValidator.class));
+ assertTrue(_hasValidator(input, BeanValidator.class));
}
-
+
/**
* Tests the case that the BeanValidator is a default validator, but the
* UIInput has a nested on the facelet.
@@ -183,7 +184,7 @@ public void testBeanValidatorInstalledAutomatically() throws IOException
*/
@Test
@SuppressWarnings("unchecked")
- public void testDisabledBeanValidatorNotInstalled() throws IOException
+ void disabledBeanValidatorNotInstalled() throws Exception
{
// add the BeanValidator as default-validator
application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
@@ -199,9 +200,9 @@ public void testDisabledBeanValidatorNotInstalled() throws IOException
UIInput input = (UIInput) root.findComponent("form:input");
// the UIInput must not have the BeanValidator installed
- Assertions.assertFalse(_hasValidator(input, BeanValidator.class));
+ assertFalse(_hasValidator(input, BeanValidator.class));
}
-
+
/**
* Tests the case when is used in wrapping mode
* and the BeanValidator is not a default-validator.
@@ -212,7 +213,7 @@ public void testDisabledBeanValidatorNotInstalled() throws IOException
*/
@Test
@SuppressWarnings("unchecked")
- public void testNestingValidateBean() throws IOException
+ void nestingValidateBean() throws Exception
{
// put the disabled value on the request scope
externalContext.getRequestMap().put("validateBeanDisabled", Boolean.FALSE);
@@ -228,12 +229,12 @@ public void testNestingValidateBean() throws IOException
UIInput nonnestedinput = (UIInput) root.findComponent("form:nonnestedinput");
// all wrapped UIInputs have to have the BeanValidator installed
- Assertions.assertTrue(_hasValidator(nestedinput, BeanValidator.class));
- Assertions.assertTrue(_hasValidator(doublenestedinput, BeanValidator.class));
- Assertions.assertTrue(_hasValidator(nestedinput2, BeanValidator.class));
- Assertions.assertFalse(_hasValidator(nonnestedinput, BeanValidator.class));
+ assertTrue(_hasValidator(nestedinput, BeanValidator.class));
+ assertTrue(_hasValidator(doublenestedinput, BeanValidator.class));
+ assertTrue(_hasValidator(nestedinput2, BeanValidator.class));
+ assertFalse(_hasValidator(nonnestedinput, BeanValidator.class));
}
-
+
/**
* Tests the case when is used in wrapping mode,
* its disabled attribute is true and the BeanValidator is a default-validator.
@@ -244,7 +245,7 @@ public void testNestingValidateBean() throws IOException
*/
@Test
@SuppressWarnings("unchecked")
- public void testNestingValidateBeanDisabled() throws IOException
+ void nestingValidateBeanDisabled() throws Exception
{
// put the disabled value on the request scope
externalContext.getRequestMap().put("validateBeanDisabled", Boolean.TRUE);
@@ -263,12 +264,12 @@ public void testNestingValidateBeanDisabled() throws IOException
UIInput nonnestedinput = (UIInput) root.findComponent("form:nonnestedinput");
// all wrapped UIInputs have to have the BeanValidator installed
- Assertions.assertFalse(_hasValidator(nestedinput, BeanValidator.class));
- Assertions.assertFalse(_hasValidator(doublenestedinput, BeanValidator.class));
- Assertions.assertFalse(_hasValidator(nestedinput2, BeanValidator.class));
- Assertions.assertTrue(_hasValidator(nonnestedinput, BeanValidator.class));
+ assertFalse(_hasValidator(nestedinput, BeanValidator.class));
+ assertFalse(_hasValidator(doublenestedinput, BeanValidator.class));
+ assertFalse(_hasValidator(nestedinput2, BeanValidator.class));
+ assertTrue(_hasValidator(nonnestedinput, BeanValidator.class));
}
-
+
/**
* Tests the case that there are two tags, one disabled and
* one not. The disabled one should add the validator id of the BeanValidator
@@ -278,7 +279,7 @@ public void testNestingValidateBeanDisabled() throws IOException
* @throws IOException
*/
@Test
- public void testValidateBeanDisabledAndEnabled() throws IOException
+ void validateBeanDisabledAndEnabled() throws Exception
{
// build testValidateBeanDisabledAndEnabled.xhtml
UIViewRoot root = facesContext.getViewRoot();
@@ -288,9 +289,9 @@ public void testValidateBeanDisabledAndEnabled() throws IOException
UIInput input = (UIInput) root.findComponent("form:input");
// the UIInput has to have the BeanValidator installed
- Assertions.assertTrue(_hasValidator(input, BeanValidator.class));
+ assertTrue(_hasValidator(input, BeanValidator.class));
}
-
+
/**
* Tests the case that there are a wrapping f:validateBean with disabled
* set to true and one nested f:validateBean. Also the BeanValidator is
@@ -302,7 +303,7 @@ public void testValidateBeanDisabledAndEnabled() throws IOException
*/
@Test
@SuppressWarnings("unchecked")
- public void testValidateBeanNestingAndNested() throws IOException
+ void validateBeanNestingAndNested() throws Exception
{
// add the BeanValidator as default-validator
application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
@@ -321,18 +322,18 @@ public void testValidateBeanNestingAndNested() throws IOException
// no wrapped UIInput has to have the BeanValidator installed,
// except the one nesting itself.
- Assertions.assertFalse(_hasValidator(nestedinput, BeanValidator.class));
- Assertions.assertTrue(_hasValidator(nestedinputWithValidator, BeanValidator.class));
- Assertions.assertTrue(_hasValidator(nonnestedinput, BeanValidator.class));
+ assertFalse(_hasValidator(nestedinput, BeanValidator.class));
+ assertTrue(_hasValidator(nestedinputWithValidator, BeanValidator.class));
+ assertTrue(_hasValidator(nonnestedinput, BeanValidator.class));
}
-
+
/**
* Tests if the validationGroups are set correctly.
* @throws IOException
*/
@Test
@SuppressWarnings("unchecked")
- public void testValidateBeanValidationGroups() throws IOException
+ void validateBeanValidationGroups() throws Exception
{
final String validationGroups = "org.apache.myfaces.beanvalidation.Group1," +
"org.apache.myfaces.beanvalidation.Group2";
@@ -348,9 +349,9 @@ public void testValidateBeanValidationGroups() throws IOException
UIInput input = (UIInput) root.findComponent("form:input");
// the validationGroups have to match
- Assertions.assertEquals(validationGroups, _getValidationGroups(input));
+ assertEquals(validationGroups, _getValidationGroups(input));
}
-
+
/**
* Tests the case that the BeanValidator is a default validator and the
* UIInput on the facelet does not have a custom tag.
@@ -358,7 +359,7 @@ public void testValidateBeanValidationGroups() throws IOException
* @throws IOException
*/
@Test
- public void testValidateBeanDefaultValidationGroup() throws IOException
+ void validateBeanDefaultValidationGroup() throws Exception
{
// add the BeanValidator as default-validator
application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
@@ -371,10 +372,10 @@ public void testValidateBeanDefaultValidationGroup() throws IOException
UIInput input = (UIInput) root.findComponent("form:input");
// the validationGroups have to match the Default ones
- Assertions.assertEquals(jakarta.validation.groups.Default.class.getName(),
+ assertEquals(jakarta.validation.groups.Default.class.getName(),
_getValidationGroups(input));
}
-
+
/**
* Tests the case that there is a wrapping on the facelet
* with some validationGroups. These validationGroups should be applied to
@@ -385,7 +386,7 @@ public void testValidateBeanDefaultValidationGroup() throws IOException
*/
@Test
@SuppressWarnings("unchecked")
- public void testValidateBeanValidationGroupsNested() throws IOException
+ void validateBeanValidationGroupsNested() throws Exception
{
final String validationGroups = "org.apache.myfaces.beanvalidation.Group1";
@@ -408,13 +409,13 @@ public void testValidateBeanValidationGroupsNested() throws IOException
// the validationGroups in the wrapped components have to match
// org.apache.myfaces.beanvalidation.Group1 and the non-nested ones
// have to match the Default group.
- Assertions.assertEquals(validationGroups, _getValidationGroups(nestedinput));
- Assertions.assertEquals(validationGroups, _getValidationGroups(doublenestedinput));
- Assertions.assertEquals(validationGroups, _getValidationGroups(nestedinput2));
- Assertions.assertEquals(jakarta.validation.groups.Default.class.getName(),
+ assertEquals(validationGroups, _getValidationGroups(nestedinput));
+ assertEquals(validationGroups, _getValidationGroups(doublenestedinput));
+ assertEquals(validationGroups, _getValidationGroups(nestedinput2));
+ assertEquals(jakarta.validation.groups.Default.class.getName(),
_getValidationGroups(nonnestedinput));
}
-
+
/**
* Tests the case that there is a wrapping with some validationGroups
* and one nested component has its own with different validationGroups.
@@ -425,7 +426,7 @@ public void testValidateBeanValidationGroupsNested() throws IOException
*/
@Test
@SuppressWarnings("unchecked")
- public void testValidateBeanValidationGroupsNestingAndNested() throws IOException
+ void validateBeanValidationGroupsNestingAndNested() throws Exception
{
final String wrappingValidationGroups = "org.apache.myfaces.beanvalidation.Group1";
final String componentValidationGroups = "org.apache.myfaces.beanvalidation.ACompletelyOtherGroup";
@@ -452,12 +453,12 @@ public void testValidateBeanValidationGroupsNestingAndNested() throws IOExceptio
// the nested component without a validator must get the wrapping validationGroups,
// the nested component with the validator must get the validationGroups from the
// validator and the non-nested component must get the Default validationGroups.
- Assertions.assertEquals(wrappingValidationGroups, _getValidationGroups(nestedinput));
- Assertions.assertEquals(componentValidationGroups, _getValidationGroups(nestedinputWithValidator));
- Assertions.assertEquals(jakarta.validation.groups.Default.class.getName(),
+ assertEquals(wrappingValidationGroups, _getValidationGroups(nestedinput));
+ assertEquals(componentValidationGroups, _getValidationGroups(nestedinputWithValidator));
+ assertEquals(jakarta.validation.groups.Default.class.getName(),
_getValidationGroups(nonnestedinput));
}
-
+
/**
* Tests the case that there are two wrapping with different
* validationGroups.
@@ -468,7 +469,7 @@ public void testValidateBeanValidationGroupsNestingAndNested() throws IOExceptio
*/
@Test
@SuppressWarnings("unchecked")
- public void testValidateBeanValidationGroupsDoubleNesting() throws IOException
+ void validateBeanValidationGroupsDoubleNesting() throws Exception
{
final String validationGroupsOuter = "org.apache.myfaces.beanvalidation.OuterGroup";
final String validationGroupsInner = "org.apache.myfaces.beanvalidation.InnerGroup";
@@ -492,12 +493,12 @@ public void testValidateBeanValidationGroupsDoubleNesting() throws IOException
// the nested component must get the outer wrapping validationGroups,
// the double-nested component must get the inner wrapping validationGroups
// and the non-nested component must get the Default validationGroups.
- Assertions.assertEquals(validationGroupsOuter, _getValidationGroups(nestedinput));
- Assertions.assertEquals(validationGroupsInner, _getValidationGroups(doublenestedinput));
- Assertions.assertEquals(jakarta.validation.groups.Default.class.getName(),
+ assertEquals(validationGroupsOuter, _getValidationGroups(nestedinput));
+ assertEquals(validationGroupsInner, _getValidationGroups(doublenestedinput));
+ assertEquals(jakarta.validation.groups.Default.class.getName(),
_getValidationGroups(nonnestedinput));
}
-
+
/**
* Tests the case that the BeanValidator is installed as a default-validator,
* but bean validation is not available in the classpath.
@@ -506,7 +507,7 @@ public void testValidateBeanValidationGroupsDoubleNesting() throws IOException
* @throws IOException
*/
@Test
- public void testValidateBeanWithBeanValidationNotAvailable() throws IOException
+ void validateBeanWithBeanValidationNotAvailable() throws Exception
{
// add the BeanValidator as default-validator
application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
@@ -523,7 +524,7 @@ public void testValidateBeanWithBeanValidationNotAvailable() throws IOException
// the UIInput must not have the BeanValidator installed,
// because bean validation is not available
- Assertions.assertFalse(_hasValidator(input, BeanValidator.class));
+ assertFalse(_hasValidator(input, BeanValidator.class));
}
/**
@@ -532,7 +533,7 @@ public void testValidateBeanWithBeanValidationNotAvailable() throws IOException
*/
@Test
@SuppressWarnings("unchecked")
- public void testValidateBeanValidationDisabledDoubleNesting() throws IOException
+ void validateBeanValidationDisabledDoubleNesting() throws Exception
{
final String validationGroupsOuter = "org.apache.myfaces.beanvalidation.OuterGroup";
final String validationGroupsInner = "org.apache.myfaces.beanvalidation.InnerGroup";
@@ -557,10 +558,10 @@ public void testValidateBeanValidationDisabledDoubleNesting() throws IOException
// the nested component must get the outer wrapping validationGroups,
// the double-nested component must get the inner wrapping validationGroups
// and the non-nested component must get the Default validationGroups.
- Assertions.assertEquals(validationGroupsOuter, _getValidationGroups(nestedinput));
- Assertions.assertFalse(_hasValidator(doublenestedinput, BeanValidator.class));
- Assertions.assertEquals(validationGroupsInner, _getValidationGroups(nesteouterdisabledinput));
- Assertions.assertEquals(jakarta.validation.groups.Default.class.getName(),
+ assertEquals(validationGroupsOuter, _getValidationGroups(nestedinput));
+ assertFalse(_hasValidator(doublenestedinput, BeanValidator.class));
+ assertEquals(validationGroupsInner, _getValidationGroups(nesteouterdisabledinput));
+ assertEquals(jakarta.validation.groups.Default.class.getName(),
_getValidationGroups(nonnestedinput));
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/ViewMetadataTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/ViewMetadataTestCase.java
index e5aa3e1bd8..de7044e9c7 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/ViewMetadataTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/ViewMetadataTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.faces.core;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.io.StringWriter;
import java.util.Collection;
import java.util.HashMap;
@@ -37,11 +39,10 @@
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.view.facelets.bean.HelloWorld;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class ViewMetadataTestCase extends AbstractFaceletTestCase
+class ViewMetadataTestCase extends AbstractFaceletTestCase
{
protected NavigationHandler navigationHandler;
@@ -107,9 +108,9 @@ public void tearDown() throws Exception
super.tearDown();
navigationHandler = null;
}
-
+
@Test
- public void testSimpleViewMetadata() throws Exception
+ void simpleViewMetadata() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -128,7 +129,7 @@ public void testSimpleViewMetadata() throws Exception
Collection viewParameters = metadata.getViewParameters(root);
- Assertions.assertEquals(1, viewParameters.size());
+ assertEquals(1, viewParameters.size());
//root.setViewId("viewMetadata.xhtml");
vdl.buildView(facesContext, root, "viewMetadata.xhtml");
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/reset/ResetValuesTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/reset/ResetValuesTestCase.java
index a838281533..59f4f6c5f2 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/reset/ResetValuesTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/reset/ResetValuesTestCase.java
@@ -18,9 +18,10 @@
*/
package org.apache.myfaces.view.facelets.tag.faces.core.reset;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIInput;
-import org.junit.jupiter.api.Assertions;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
import org.junit.jupiter.api.Test;
@@ -28,7 +29,7 @@
*
* @author lu4242
*/
-public class ResetValuesTestCase extends AbstractMyFacesCDIRequestTestCase
+class ResetValuesTestCase extends AbstractMyFacesCDIRequestTestCase
{
@Override
protected void setUpWebConfigParams() throws Exception
@@ -38,7 +39,7 @@ protected void setUpWebConfigParams() throws Exception
}
@Test
- public void testResetValuesActionListenerHandler2() throws Exception
+ void resetValuesActionListenerHandler2() throws Exception
{
startViewRequest("/resetValuesActionListener_2.xhtml");
@@ -84,13 +85,13 @@ public void testResetValuesActionListenerHandler2() throws Exception
UIInput field1_2 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field1");
UIInput field2_2 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field2");
- Assertions.assertEquals("Hello", field1_2.getValue());
- Assertions.assertEquals(1, field2_2.getValue());
- Assertions.assertNull(field1_2.getSubmittedValue());
- Assertions.assertNull(field2_2.getSubmittedValue());
+ assertEquals("Hello", field1_2.getValue());
+ assertEquals(1, field2_2.getValue());
+ assertNull(field1_2.getSubmittedValue());
+ assertNull(field2_2.getSubmittedValue());
- Assertions.assertEquals("Hello", bean.getField1());
- Assertions.assertEquals(Integer.valueOf(1), bean.getField2());
+ assertEquals("Hello", bean.getField1());
+ assertEquals(Integer.valueOf(1), bean.getField2());
//Now let's try the normal way with no resetValues
client.inputText(field1_2, "xxx");
@@ -112,17 +113,17 @@ public void testResetValuesActionListenerHandler2() throws Exception
// The values in the model are kept but the submitted values are there
// and the renderer takes them.
- Assertions.assertEquals("Hello", field1_3.getValue());
+ assertEquals("Hello", field1_3.getValue());
// the second field doesn't have validation error!, but the local value
// is set with 2, but the model still is 1 because update model phase
// was not executed.
- Assertions.assertEquals(2, field2_3.getValue());
- Assertions.assertTrue(field2_3.isLocalValueSet());
- Assertions.assertEquals("xxx", field1_3.getSubmittedValue());
- Assertions.assertNull(field2_3.getSubmittedValue());
+ assertEquals(2, field2_3.getValue());
+ assertTrue(field2_3.isLocalValueSet());
+ assertEquals("xxx", field1_3.getSubmittedValue());
+ assertNull(field2_3.getSubmittedValue());
- Assertions.assertEquals("Hello", bean.getField1());
- Assertions.assertEquals(Integer.valueOf(1), bean.getField2());
+ assertEquals("Hello", bean.getField1());
+ assertEquals(Integer.valueOf(1), bean.getField2());
// Now let's try a valid one, in this case the model is updated
client.inputText(field1_3, "xxxx");
@@ -142,17 +143,17 @@ public void testResetValuesActionListenerHandler2() throws Exception
UIInput field1_4 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field1");
UIInput field2_4 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field2");
- Assertions.assertEquals("xxxx", field1_4.getValue());
- Assertions.assertEquals(3, field2_4.getValue());
- Assertions.assertNull(field1_4.getSubmittedValue());
- Assertions.assertNull(field2_4.getSubmittedValue());
+ assertEquals("xxxx", field1_4.getValue());
+ assertEquals(3, field2_4.getValue());
+ assertNull(field1_4.getSubmittedValue());
+ assertNull(field2_4.getSubmittedValue());
- Assertions.assertEquals("xxxx", bean.getField1());
- Assertions.assertEquals(Integer.valueOf(3), bean.getField2());
+ assertEquals("xxxx", bean.getField1());
+ assertEquals(Integer.valueOf(3), bean.getField2());
}
@Test
- public void testResetValuesActionListenerHandler3() throws Exception
+ void resetValuesActionListenerHandler3() throws Exception
{
startViewRequest("/resetValuesActionListener_3.xhtml");
@@ -186,13 +187,13 @@ public void testResetValuesActionListenerHandler3() throws Exception
field1 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field1");
field2 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field2");
- Assertions.assertEquals("Hello", field1.getValue());
- Assertions.assertEquals(1, field2.getValue());
+ assertEquals("Hello", field1.getValue());
+ assertEquals(1, field2.getValue());
}
@Test
- public void testResetValuesActionListenerHandler4() throws Exception
+ void resetValuesActionListenerHandler4() throws Exception
{
startViewRequest("/resetValuesActionListener_4.xhtml");
@@ -237,13 +238,13 @@ public void testResetValuesActionListenerHandler4() throws Exception
UIInput field1_2 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field1");
UIInput field2_2 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field2");
- Assertions.assertEquals("Hello", field1_2.getValue());
- Assertions.assertEquals(1, field2_2.getValue());
- Assertions.assertNull(field1_2.getSubmittedValue());
- Assertions.assertNull(field2_2.getSubmittedValue());
+ assertEquals("Hello", field1_2.getValue());
+ assertEquals(1, field2_2.getValue());
+ assertNull(field1_2.getSubmittedValue());
+ assertNull(field2_2.getSubmittedValue());
- Assertions.assertEquals("Hello", bean.getField1());
- Assertions.assertEquals(Integer.valueOf(1), bean.getField2());
+ assertEquals("Hello", bean.getField1());
+ assertEquals(Integer.valueOf(1), bean.getField2());
//Now let's try the normal way with no resetValues
client.inputText(field1_2, "xxx");
@@ -264,17 +265,17 @@ public void testResetValuesActionListenerHandler4() throws Exception
// The values in the model are kept but the submitted values are there
// and the renderer takes them.
- Assertions.assertEquals("Hello", field1_3.getValue());
+ assertEquals("Hello", field1_3.getValue());
// the second field doesn't have validation error!, but the local value
// is set with 2, but the model still is 1 because update model phase
// was not executed.
- Assertions.assertEquals(2, field2_3.getValue());
- Assertions.assertTrue(field2_3.isLocalValueSet());
- Assertions.assertEquals("xxx", field1_3.getSubmittedValue());
- Assertions.assertNull(field2_3.getSubmittedValue());
+ assertEquals(2, field2_3.getValue());
+ assertTrue(field2_3.isLocalValueSet());
+ assertEquals("xxx", field1_3.getSubmittedValue());
+ assertNull(field2_3.getSubmittedValue());
- Assertions.assertEquals("Hello", bean.getField1());
- Assertions.assertEquals(Integer.valueOf(1), bean.getField2());
+ assertEquals("Hello", bean.getField1());
+ assertEquals(Integer.valueOf(1), bean.getField2());
// Now let's try a valid one, in this case the model is updated
client.inputText(field1_3, "xxxx");
@@ -293,17 +294,17 @@ public void testResetValuesActionListenerHandler4() throws Exception
UIInput field1_4 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field1");
UIInput field2_4 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field2");
- Assertions.assertEquals("xxxx", field1_4.getValue());
- Assertions.assertEquals(3, field2_4.getValue());
- Assertions.assertNull(field1_4.getSubmittedValue());
- Assertions.assertNull(field2_4.getSubmittedValue());
+ assertEquals("xxxx", field1_4.getValue());
+ assertEquals(3, field2_4.getValue());
+ assertNull(field1_4.getSubmittedValue());
+ assertNull(field2_4.getSubmittedValue());
- Assertions.assertEquals("xxxx", bean.getField1());
- Assertions.assertEquals(Integer.valueOf(3), bean.getField2());
+ assertEquals("xxxx", bean.getField1());
+ assertEquals(Integer.valueOf(3), bean.getField2());
}
@Test
- public void testResetValuesActionListenerHandler5() throws Exception
+ void resetValuesActionListenerHandler5() throws Exception
{
startViewRequest("/resetValuesActionListener_5.xhtml");
@@ -348,13 +349,13 @@ public void testResetValuesActionListenerHandler5() throws Exception
UIInput field1_2 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field1");
UIInput field2_2 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field2");
- Assertions.assertEquals("Hello", field1_2.getValue());
- Assertions.assertEquals(1, field2_2.getValue());
- Assertions.assertNull(field1_2.getSubmittedValue());
- Assertions.assertNull(field2_2.getSubmittedValue());
+ assertEquals("Hello", field1_2.getValue());
+ assertEquals(1, field2_2.getValue());
+ assertNull(field1_2.getSubmittedValue());
+ assertNull(field2_2.getSubmittedValue());
- Assertions.assertEquals("Hello", bean.getField1());
- Assertions.assertEquals(Integer.valueOf(1), bean.getField2());
+ assertEquals("Hello", bean.getField1());
+ assertEquals(Integer.valueOf(1), bean.getField2());
//Now let's try the normal way with no resetValues
client.inputText(field1_2, "xxx");
@@ -375,17 +376,17 @@ public void testResetValuesActionListenerHandler5() throws Exception
// The values in the model are kept but the submitted values are there
// and the renderer takes them.
- Assertions.assertEquals("Hello", field1_3.getValue());
+ assertEquals("Hello", field1_3.getValue());
// the second field doesn't have validation error!, but the local value
// is set with 2, but the model still is 1 because update model phase
// was not executed.
- Assertions.assertEquals(2, field2_3.getValue());
- Assertions.assertTrue(field2_3.isLocalValueSet());
- Assertions.assertEquals("xxx", field1_3.getSubmittedValue());
- Assertions.assertNull(field2_3.getSubmittedValue());
+ assertEquals(2, field2_3.getValue());
+ assertTrue(field2_3.isLocalValueSet());
+ assertEquals("xxx", field1_3.getSubmittedValue());
+ assertNull(field2_3.getSubmittedValue());
- Assertions.assertEquals("Hello", bean.getField1());
- Assertions.assertEquals(Integer.valueOf(1), bean.getField2());
+ assertEquals("Hello", bean.getField1());
+ assertEquals(Integer.valueOf(1), bean.getField2());
// Now let's try a valid one, in this case the model is updated
client.inputText(field1_3, "xxxx");
@@ -404,12 +405,12 @@ public void testResetValuesActionListenerHandler5() throws Exception
UIInput field1_4 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field1");
UIInput field2_4 = (UIInput) facesContext.getViewRoot().findComponent("mainForm:field2");
- Assertions.assertEquals("xxxx", field1_4.getValue());
- Assertions.assertEquals(3, field2_4.getValue());
- Assertions.assertNull(field1_4.getSubmittedValue());
- Assertions.assertNull(field2_4.getSubmittedValue());
+ assertEquals("xxxx", field1_4.getValue());
+ assertEquals(3, field2_4.getValue());
+ assertNull(field1_4.getSubmittedValue());
+ assertNull(field2_4.getSubmittedValue());
- Assertions.assertEquals("xxxx", bean.getField1());
- Assertions.assertEquals(Integer.valueOf(3), bean.getField2());
+ assertEquals("xxxx", bean.getField1());
+ assertEquals(Integer.valueOf(3), bean.getField2());
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/validation/BeanValidationCDIRequestTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/validation/BeanValidationCDIRequestTestCase.java
index a0cdbab3a2..becbc372a1 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/validation/BeanValidationCDIRequestTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/core/validation/BeanValidationCDIRequestTestCase.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.view.facelets.tag.faces.core.validation;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import jakarta.faces.application.StateManager;
import jakarta.faces.component.UIInput;
import jakarta.faces.validator.BeanValidator;
@@ -25,14 +28,13 @@
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* This test is the same as FlowMyFacesRequestTestCase with the difference that
* in this case CDI is enabled and the other alternative is used.
*/
-public class BeanValidationCDIRequestTestCase extends AbstractMyFacesCDIRequestTestCase
+class BeanValidationCDIRequestTestCase extends AbstractMyFacesCDIRequestTestCase
{
@Override
protected void setUpWebConfigParams() throws Exception
@@ -45,9 +47,9 @@ protected void setUpWebConfigParams() throws Exception
servletContext.addInitParameter("jakarta.faces.CLIENT_WINDOW_MODE", "url");
servletContext.addInitParameter("org.apache.myfaces.validator.BEAN_BEFORE_JSF_VALIDATION", "true");
}
-
+
@Test
- public void testBeanValidation_1() throws Exception
+ void beanValidation1() throws Exception
{
startViewRequest("/testBeanValidation_1.xhtml");
@@ -60,13 +62,13 @@ public void testBeanValidation_1() throws Exception
processLifecycleExecute();
UIInput username = (UIInput) facesContext.getViewRoot().findComponent("mainForm:username");
- Assertions.assertNotNull(username);
+ assertNotNull(username);
Validator[] array = username.getValidators();
- Assertions.assertTrue(array[0] instanceof BeanValidator);
+ assertInstanceOf(BeanValidator.class, array[0]);
}
-
+
@Test
- public void testBeanValidation_2() throws Exception
+ void beanValidation2() throws Exception
{
startViewRequest("/testBeanValidation_2.xhtml");
@@ -79,8 +81,8 @@ public void testBeanValidation_2() throws Exception
processLifecycleExecute();
UIInput username = (UIInput) facesContext.getViewRoot().findComponent("mainForm:username");
- Assertions.assertNotNull(username);
+ assertNotNull(username);
Validator[] array = username.getValidators();
- Assertions.assertTrue(array[0] instanceof BeanValidator);
+ assertInstanceOf(BeanValidator.class, array[0]);
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/AdditionalHtmlEventsTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/AdditionalHtmlEventsTestCase.java
index bc82588ea2..ee250c6e04 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/AdditionalHtmlEventsTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/AdditionalHtmlEventsTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.faces.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.faces.component.UIComponent;
@@ -32,14 +34,13 @@
import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* Spec issue 1507, end to end: an on* attribute without a matching component property has to survive the facelet
* tag handling and end up in the rendered markup, on its own as well as chained with an f:ajax on the same event.
*/
-public class AdditionalHtmlEventsTestCase extends AbstractFaceletTestCase
+class AdditionalHtmlEventsTestCase extends AbstractFaceletTestCase
{
@Override
@@ -65,7 +66,7 @@ protected void setupRenderers() throws Exception
}
@Test
- public void testAdditionalHtmlEvents() throws Exception
+ void additionalHtmlEvents() throws Exception
{
externalContext.getRequestMap().put("inputScript", "doEl()");
@@ -74,30 +75,30 @@ public void testAdditionalHtmlEvents() throws Exception
// a literal on* attribute without matching property
String plain = encode(root, "plain");
- Assertions.assertTrue(plain.contains("oninput=\"doPlain()\""), plain);
+ assertTrue(plain.contains("oninput=\"doPlain()\""), plain);
// the same, but bound to a ValueExpression
String el = encode(root, "el");
- Assertions.assertTrue(el.contains("oninput=\"doEl()\""), el);
+ assertTrue(el.contains("oninput=\"doEl()\""), el);
// on a component which has no oninput property
- Assertions.assertEquals("[input]",
+ assertEquals("[input]",
((ClientBehaviorHolder) root.findComponent("ajax")).getClientBehaviors().keySet().toString());
String ajax = encode(root, "ajax");
- Assertions.assertTrue(ajax.contains("oninput=\""), ajax);
- Assertions.assertTrue(ajax.contains("myfaces.ab("), ajax);
+ assertTrue(ajax.contains("oninput=\""), ajax);
+ assertTrue(ajax.contains("myfaces.ab("), ajax);
// both of them on the same component must be chained
String both = encode(root, "both");
- Assertions.assertTrue(both.contains("faces.util.chain("), both);
- Assertions.assertTrue(both.contains("doBoth()"), both);
- Assertions.assertTrue(both.contains("myfaces.ab("), both);
+ assertTrue(both.contains("faces.util.chain("), both);
+ assertTrue(both.contains("doBoth()"), both);
+ assertTrue(both.contains("myfaces.ab("), both);
}
private String encode(UIViewRoot root, String id) throws Exception
{
UIComponent component = root.findComponent(id);
- Assertions.assertNotNull(component, "component " + id + " not found");
+ assertNotNull(component, "component " + id + " not found");
StringWriter sw = new StringWriter();
facesContext.setResponseWriter(new MockResponseWriter(sw));
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DataTableTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DataTableTestCase.java
index d9ed2e7da8..c2ceaa9033 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DataTableTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DataTableTestCase.java
@@ -36,7 +36,7 @@
import org.apache.myfaces.util.lang.FastWriter;
import org.junit.jupiter.api.Test;
-public class DataTableTestCase extends AbstractFaceletTestCase
+class DataTableTestCase extends AbstractFaceletTestCase
{
@Override
@@ -71,7 +71,7 @@ protected void setupRenderers() throws Exception
}
@Test
- public void testDataTable() throws Exception
+ void dataTable() throws Exception
{
facesContext.getExternalContext().getRequestMap().put("company",
Example.createCompany());
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DataTableTestCaseUrn.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DataTableTestCaseUrn.java
index 5d0c6545ba..e7d36f63fd 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DataTableTestCaseUrn.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DataTableTestCaseUrn.java
@@ -36,7 +36,7 @@
import org.apache.myfaces.util.lang.FastWriter;
import org.junit.jupiter.api.Test;
-public class DataTableTestCaseUrn extends AbstractFaceletTestCase
+class DataTableTestCaseUrn extends AbstractFaceletTestCase
{
@Override
@@ -71,7 +71,7 @@ protected void setupRenderers() throws Exception
}
@Test
- public void testDataTable() throws Exception
+ void dataTable() throws Exception
{
facesContext.getExternalContext().getRequestMap().put("company",
Example.createCompany());
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultHtmlDecoratorTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultHtmlDecoratorTestCase.java
index ca528599e2..b4ace9bfde 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultHtmlDecoratorTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultHtmlDecoratorTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.faces.html;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIForm;
@@ -56,14 +58,13 @@
import org.apache.myfaces.view.facelets.tag.TagAttributeImpl;
import org.apache.myfaces.view.facelets.tag.TagAttributesImpl;
import org.apache.myfaces.view.facelets.tag.faces.JsfLibrary;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
*
* @author Leonardo Uribe
*/
-public class DefaultHtmlDecoratorTestCase extends AbstractFaceletTestCase
+class DefaultHtmlDecoratorTestCase extends AbstractFaceletTestCase
{
@Override
@@ -77,7 +78,7 @@ protected void setUpServletObjects() throws Exception
}
@Test
- public void testHtmlPassthrough1() throws Exception
+ void htmlPassthrough1() throws Exception
{
request.getSession().setAttribute("test", new MockBean());
@@ -91,9 +92,9 @@ public void testHtmlPassthrough1() throws Exception
//facesContext.setResponseWriter(mrw);
//sw.flush();
}
-
+
@Test
- public void testHtmlPassthrough2() throws Exception
+ void htmlPassthrough2() throws Exception
{
request.getSession().setAttribute("test", new MockBean());
@@ -121,12 +122,12 @@ private void checkTags() throws Exception
{
if (ResourceUtils.DEFAULT_SCRIPT_RENDERER_TYPE.equals(child.getRendererType()))
{
- Assertions.assertEquals("osc", child.getId());
+ assertEquals("osc", child.getId());
scriptsFound++;
}
if (ResourceUtils.DEFAULT_STYLESHEET_RENDERER_TYPE.equals(child.getRendererType()))
{
- Assertions.assertEquals("osh", child.getId());
+ assertEquals("osh", child.getId());
linksFound++;
}
}
@@ -135,123 +136,123 @@ private void checkTags() throws Exception
{
if ("jakarta.faces.resource.Stylesheet".equals(child.getRendererType()))
{
- Assertions.assertEquals("osh", child.getId());
+ assertEquals("osh", child.getId());
linksFound++;
}
}
- Assertions.assertEquals(1, linksFound);
- Assertions.assertEquals(1, scriptsFound);
+ assertEquals(1, linksFound);
+ assertEquals(1, scriptsFound);
HtmlBody body = (HtmlBody) root.findComponent("idBody");
- Assertions.assertNotNull(body);
+ assertNotNull(body);
UIForm form = (UIForm) root.findComponent("myForm");
- Assertions.assertNotNull(form);
+ assertNotNull(form);
HtmlCommandLink link1 = (HtmlCommandLink) form.findComponent("link1");
- Assertions.assertNotNull(link1);
- Assertions.assertEquals("#{test.testAction}", link1.getActionExpression().getExpressionString());
+ assertNotNull(link1);
+ assertEquals("#{test.testAction}", link1.getActionExpression().getExpressionString());
HtmlCommandLink link2 = (HtmlCommandLink) form.findComponent("link2");
- Assertions.assertNotNull(link2);
- Assertions.assertEquals(1, link2.getActionListeners().length);
+ assertNotNull(link2);
+ assertEquals(1, link2.getActionListeners().length);
HtmlOutputLink link3 = (HtmlOutputLink) form.findComponent("link3");
- Assertions.assertNotNull(link3);
- Assertions.assertEquals("/my/new/location.txt", link3.getValue());
+ assertNotNull(link3);
+ assertEquals("/my/new/location.txt", link3.getValue());
HtmlOutcomeTargetLink link4 = (HtmlOutcomeTargetLink) form.findComponent("link4");
- Assertions.assertNotNull(link4);
- Assertions.assertEquals("rollback", link4.getOutcome());
+ assertNotNull(link4);
+ assertEquals("rollback", link4.getOutcome());
HtmlCommandButton button = (HtmlCommandButton) form.findComponent("button1");
- Assertions.assertNotNull(button);
- Assertions.assertEquals("#{test.testAction}", button.getActionExpression().getExpressionString());
+ assertNotNull(button);
+ assertEquals("#{test.testAction}", button.getActionExpression().getExpressionString());
HtmlOutcomeTargetButton button2 = (HtmlOutcomeTargetButton) form.findComponent("button2");
- Assertions.assertNotNull(button2);
- Assertions.assertEquals("rollback", button2.getOutcome());
+ assertNotNull(button2);
+ assertEquals("rollback", button2.getOutcome());
HtmlGraphicImage img1 = (HtmlGraphicImage) form.findComponent("img1");
- Assertions.assertNotNull(img1);
- Assertions.assertEquals("/my/image.png", img1.getUrl());
+ assertNotNull(img1);
+ assertEquals("/my/image.png", img1.getUrl());
HtmlCommandButton input1 = (HtmlCommandButton) form.findComponent("input1");
- Assertions.assertNotNull(input1);
+ assertNotNull(input1);
HtmlSelectBooleanCheckbox input2 = (HtmlSelectBooleanCheckbox) form.findComponent("input2");
- Assertions.assertNotNull(input2);
+ assertNotNull(input2);
HtmlInputText input3 = (HtmlInputText) form.findComponent("input3");
- Assertions.assertNotNull(input3);
+ assertNotNull(input3);
HtmlInputText input4 = (HtmlInputText) form.findComponent("input4");
- Assertions.assertNotNull(input4);
+ assertNotNull(input4);
HtmlInputText input5 = (HtmlInputText) form.findComponent("input5");
- Assertions.assertNotNull(input5);
+ assertNotNull(input5);
HtmlInputText input6 = (HtmlInputText) form.findComponent("input6");
- Assertions.assertNotNull(input6);
+ assertNotNull(input6);
HtmlInputText input7 = (HtmlInputText) form.findComponent("input7");
- Assertions.assertNotNull(input7);
+ assertNotNull(input7);
HtmlInputText input8 = (HtmlInputText) form.findComponent("input8");
- Assertions.assertNotNull(input8);
+ assertNotNull(input8);
HtmlInputText input9 = (HtmlInputText) form.findComponent("input9");
- Assertions.assertNotNull(input9);
+ assertNotNull(input9);
HtmlInputText input10 = (HtmlInputText) form.findComponent("input10");
- Assertions.assertNotNull(input10);
+ assertNotNull(input10);
HtmlInputText input11 = (HtmlInputText) form.findComponent("input11");
- Assertions.assertNotNull(input11);
+ assertNotNull(input11);
HtmlInputText input12 = (HtmlInputText) form.findComponent("input12");
- Assertions.assertNotNull(input12);
+ assertNotNull(input12);
HtmlInputText input13 = (HtmlInputText) form.findComponent("input13");
- Assertions.assertNotNull(input13);
+ assertNotNull(input13);
HtmlInputText input14 = (HtmlInputText) form.findComponent("input14");
- Assertions.assertNotNull(input14);
+ assertNotNull(input14);
HtmlInputFile input15 = (HtmlInputFile) form.findComponent("input15");
- Assertions.assertNotNull(input15);
+ assertNotNull(input15);
HtmlInputHidden input16 = (HtmlInputHidden) form.findComponent("input16");
- Assertions.assertNotNull(input16);
+ assertNotNull(input16);
HtmlInputSecret input17 = (HtmlInputSecret) form.findComponent("input17");
- Assertions.assertNotNull(input17);
+ assertNotNull(input17);
HtmlCommandButton input18 = (HtmlCommandButton) form.findComponent("input18");
- Assertions.assertNotNull(input18);
+ assertNotNull(input18);
HtmlCommandButton input19 = (HtmlCommandButton) form.findComponent("input19");
- Assertions.assertNotNull(input19);
+ assertNotNull(input19);
HtmlInputText input20 = (HtmlInputText) form.findComponent("input20");
- Assertions.assertNotNull(input20);
+ assertNotNull(input20);
HtmlOutputLabel label1 = (HtmlOutputLabel) form.findComponent("label1");
- Assertions.assertNotNull(label1);
+ assertNotNull(label1);
HtmlSelectOneListbox select1 = (HtmlSelectOneListbox) form.findComponent("select1");
- Assertions.assertNotNull(select1);
+ assertNotNull(select1);
HtmlSelectManyListbox select2 = (HtmlSelectManyListbox) form.findComponent("select2");
- Assertions.assertNotNull(select2);
+ assertNotNull(select2);
HtmlInputTextarea textarea1 = (HtmlInputTextarea) form.findComponent("textarea1");
- Assertions.assertNotNull(textarea1);
+ assertNotNull(textarea1);
}
@Test
- public void testDefaultTagDecorator1() throws Exception
+ void defaultTagDecorator1() throws Exception
{
Location location = new Location("/test.xhtml", 20, 5);
Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "body", "body",
@@ -264,11 +265,11 @@ public void testDefaultTagDecorator1() throws Exception
TagDecorator tagDecorator = new DefaultTagDecorator();
Tag decoratedTag = tagDecorator.decorate(tag);
- Assertions.assertNotNull(decoratedTag);
+ assertNotNull(decoratedTag);
}
-
+
@Test
- public void testDefaultTagDecorator2() throws Exception
+ void defaultTagDecorator2() throws Exception
{
Location location = new Location("/test.xhtml", 20, 5);
Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "a", "a",
@@ -281,11 +282,11 @@ public void testDefaultTagDecorator2() throws Exception
TagDecorator tagDecorator = new DefaultTagDecorator();
Tag decoratedTag = tagDecorator.decorate(tag);
- Assertions.assertNotNull(decoratedTag);
+ assertNotNull(decoratedTag);
}
-
+
@Test
- public void testDefaultTagDecorator3() throws Exception
+ void defaultTagDecorator3() throws Exception
{
Location location = new Location("/test.xhtml", 20, 5);
Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "body", "body",
@@ -298,11 +299,11 @@ public void testDefaultTagDecorator3() throws Exception
TagDecorator tagDecorator = new DefaultTagDecorator();
Tag decoratedTag = tagDecorator.decorate(tag);
- Assertions.assertNotNull(decoratedTag);
+ assertNotNull(decoratedTag);
}
-
+
@Test
- public void testDefaultTagDecorator4() throws Exception
+ void defaultTagDecorator4() throws Exception
{
Location location = new Location("/test.xhtml", 20, 5);
Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "a", "a",
@@ -315,11 +316,11 @@ public void testDefaultTagDecorator4() throws Exception
TagDecorator tagDecorator = new DefaultTagDecorator();
Tag decoratedTag = tagDecorator.decorate(tag);
- Assertions.assertNotNull(decoratedTag);
+ assertNotNull(decoratedTag);
}
-
+
@Test
- public void testNoMatchJSFElement1() throws Exception
+ void noMatchJSFElement1() throws Exception
{
request.getSession().setAttribute("test", new MockBean());
@@ -327,17 +328,17 @@ public void testNoMatchJSFElement1() throws Exception
vdl.buildView(facesContext, root, "testNoMatchJSFElement1.xhtml");
UIComponent box1 = root.findComponent("myForm:box1");
- Assertions.assertNotNull(box1);
- Assertions.assertEquals(box1.getRendererType(), "jakarta.faces.passthrough.Element");
+ assertNotNull(box1);
+ assertEquals("jakarta.faces.passthrough.Element", box1.getRendererType());
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
//facesContext.setResponseWriter(mrw);
//sw.flush();
- }
-
+ }
+
@Test
- public void testConvertTagAttributes1() throws Exception
+ void convertTagAttributes1() throws Exception
{
request.getSession().setAttribute("test", new MockBean());
@@ -350,25 +351,25 @@ public void testConvertTagAttributes1() throws Exception
// placeholder="Enter text"
// pt:data_up="Going Up"/>
UIInput input1 = (UIInput) root.findComponent("myForm:box1");
- Assertions.assertNotNull(input1);
-
- Assertions.assertEquals(input1.getPassThroughAttributes().get("placeholder"), "Enter text");
- Assertions.assertNull(input1.getAttributes().get("placeholder"));
-
-
- Assertions.assertEquals(input1.getAttributes().get("customAttr"), "SomeValue");
+ assertNotNull(input1);
+
+ assertEquals("Enter text", input1.getPassThroughAttributes().get("placeholder"));
+ assertNull(input1.getAttributes().get("placeholder"));
+
+
+ assertEquals("SomeValue", input1.getAttributes().get("customAttr"));
// Attributes outside "id", "binding", "rendered" or "transient" can be
// copied on passthrough attribute map.
- Assertions.assertNull(input1.getPassThroughAttributes().get("customAttr"));
-
- Assertions.assertEquals(input1.getPassThroughAttributes().get("data_up"), "Going Up");
- Assertions.assertNull(input1.getAttributes().get("data_up"));
+ assertNull(input1.getPassThroughAttributes().get("customAttr"));
+
+ assertEquals("Going Up", input1.getPassThroughAttributes().get("data_up"));
+ assertNull(input1.getAttributes().get("data_up"));
- Assertions.assertNotNull(input1.getValueExpression("value"));
+ assertNotNull(input1.getValueExpression("value"));
//Assertions.assertNotNull(input1.getPassThroughAttributes().get("value"));
- Assertions.assertNull(input1.getPassThroughAttributes().get("value"));
- Assertions.assertEquals(input1.getValue(), "value1");
- Assertions.assertEquals(input1.getAttributes().get("value"), "value1");
+ assertNull(input1.getPassThroughAttributes().get("value"));
+ assertEquals("value1", input1.getValue());
+ assertEquals("value1", input1.getAttributes().get("value"));
//Hello World!
UIComponent input2 = root.findComponent("myForm:box2");
- Assertions.assertFalse(input2 instanceof UIInput);
- Assertions.assertEquals(input2.getRendererType(), "jakarta.faces.passthrough.Element");
-
- Assertions.assertEquals(input2.getPassThroughAttributes().get("placeholder"), "Enter text");
+ assertFalse(input2 instanceof UIInput);
+ assertEquals("jakarta.faces.passthrough.Element", input2.getRendererType());
+
+ assertEquals("Enter text", input2.getPassThroughAttributes().get("placeholder"));
//Assertions.assertEquals(input2.getAttributes().get("placeholder"), "Enter text");
- Assertions.assertNull(input2.getAttributes().get("placeholder"));
-
- Assertions.assertEquals(input2.getAttributes().get("customAttr"), "SomeValue");
+ assertNull(input2.getAttributes().get("placeholder"));
+
+ assertEquals("SomeValue", input2.getAttributes().get("customAttr"));
//Assertions.assertNull(input2.getAttributes().get("customAttr"));
//Assertions.assertEquals(input2.getPassThroughAttributes().get("customAttr"), "SomeValue");
- Assertions.assertNull(input2.getPassThroughAttributes().get("customAttr"));
-
- Assertions.assertEquals(input2.getPassThroughAttributes().get("data_up"), "Going Up");
- Assertions.assertNull(input2.getAttributes().get("data_up"));
+ assertNull(input2.getPassThroughAttributes().get("customAttr"));
+
+ assertEquals("Going Up", input2.getPassThroughAttributes().get("data_up"));
+ assertNull(input2.getAttributes().get("data_up"));
// note there is no type attribute, so it is translated into a jsf:element, and in that
// component, "value" is not defined, so it is set as passthrough
- Assertions.assertNotNull(input2.getValueExpression("value"));
- Assertions.assertNull(input2.getPassThroughAttributes().get("value"));
- Assertions.assertNotNull(input2.getAttributes().get("value"));
+ assertNotNull(input2.getValueExpression("value"));
+ assertNull(input2.getPassThroughAttributes().get("value"));
+ assertNotNull(input2.getAttributes().get("value"));
//
UIComponent input3 = root.findComponent("myForm:box3");
- Assertions.assertFalse(input3 instanceof UIInput);
- Assertions.assertEquals(input3.getRendererType(), "jakarta.faces.passthrough.Element");
+ assertFalse(input3 instanceof UIInput);
+ assertEquals("jakarta.faces.passthrough.Element", input3.getRendererType());
- Assertions.assertEquals(input3.getAttributes().get("placeholder"), "Enter text");
- Assertions.assertNull(input3.getPassThroughAttributes().get("placeholder"));
-
- Assertions.assertNull(input3.getPassThroughAttributes().get("customAttr"));
- Assertions.assertEquals(input3.getAttributes().get("customAttr"), "SomeValue");
+ assertEquals("Enter text", input3.getAttributes().get("placeholder"));
+ assertNull(input3.getPassThroughAttributes().get("placeholder"));
- Assertions.assertEquals(input3.getPassThroughAttributes().get("data_up"), "Going Up");
- Assertions.assertNull(input3.getAttributes().get("data_up"));
+ assertNull(input3.getPassThroughAttributes().get("customAttr"));
+ assertEquals("SomeValue", input3.getAttributes().get("customAttr"));
+
+ assertEquals("Going Up", input3.getPassThroughAttributes().get("data_up"));
+ assertNull(input3.getAttributes().get("data_up"));
- Assertions.assertNotNull(input3.getValueExpression("value"));
- Assertions.assertNull(input3.getPassThroughAttributes().get("value"));
- Assertions.assertNotNull(input3.getAttributes().get("value"));
+ assertNotNull(input3.getValueExpression("value"));
+ assertNull(input3.getPassThroughAttributes().get("value"));
+ assertNotNull(input3.getAttributes().get("value"));
//Assertions.assertEquals(input2.getPassThroughAttributes().get("elementName"), "meter");
@@ -429,12 +430,12 @@ public void testConvertTagAttributes1() throws Exception
//
//
UIComponent box4 = root.findComponent("myForm:box4");
- Assertions.assertNotNull(box4);
+ assertNotNull(box4);
UIComponent boxDiv4 = box4.getChildren().get(0);
- Assertions.assertNotNull(boxDiv4);
- Assertions.assertEquals(boxDiv4.getAttributes().get("styleClass"), "noprint");
+ assertNotNull(boxDiv4);
+ assertEquals("noprint", boxDiv4.getAttributes().get("styleClass"));
//Assertions.assertEquals(boxDiv4.getPassThroughAttributes().get("class"), "noprint");
- Assertions.assertNull(boxDiv4.getPassThroughAttributes().get("class"));
+ assertNull(boxDiv4.getPassThroughAttributes().get("class"));
//
//
@@ -442,12 +443,12 @@ public void testConvertTagAttributes1() throws Exception
//
//
UIComponent box5 = root.findComponent("myForm:box5");
- Assertions.assertNotNull(box5);
+ assertNotNull(box5);
UIComponent boxDiv5 = box5.getChildren().get(0);
- Assertions.assertNotNull(boxDiv5);
- Assertions.assertNotNull(boxDiv5.getAttributes().get("style"));
+ assertNotNull(boxDiv5);
+ assertNotNull(boxDiv5.getAttributes().get("style"));
//Assertions.assertEquals(boxDiv5.getPassThroughAttributes().get("style"), "noprint");
- Assertions.assertNull(boxDiv5.getPassThroughAttributes().get("style"));
+ assertNull(boxDiv5.getPassThroughAttributes().get("style"));
StringWriter sw = new StringWriter();
@@ -469,7 +470,7 @@ public void testConvertTagAttributes1() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
sw = new StringWriter();
@@ -490,10 +491,10 @@ public void testConvertTagAttributes1() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains(""));
+ assertTrue(sw.toString().contains(""));
sw = new StringWriter();
mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
@@ -514,10 +515,10 @@ public void testConvertTagAttributes1() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains(""));
+ assertTrue(sw.toString().contains(""));
// TEST 4
sw = new StringWriter();
@@ -535,11 +536,11 @@ public void testConvertTagAttributes1() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains("MYBOX4"));
- Assertions.assertTrue(sw.toString().contains(""));
+ assertTrue(sw.toString().contains("MYBOX4"));
+ assertTrue(sw.toString().contains("
"));
// TEST 5
sw = new StringWriter();
@@ -557,15 +558,15 @@ public void testConvertTagAttributes1() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains("MYBOX5"));
- Assertions.assertTrue(sw.toString().contains("
"));
- }
-
+ assertTrue(sw.toString().contains("MYBOX5"));
+ assertTrue(sw.toString().contains("
"));
+ }
+
@Test
- public void testConvertTagAttributes6() throws Exception
+ void convertTagAttributes6() throws Exception
{
request.getSession().setAttribute("test", new MockBean());
@@ -578,8 +579,8 @@ public void testConvertTagAttributes6() throws Exception
//
// Try second time, to avoid the script section by f:ajax effect
UIComponent box6 = root.findComponent("myForm:box6");
- Assertions.assertNotNull(box6);
- Assertions.assertEquals(box6.getAttributes().get("onclick"), "alert('hello')");
+ assertNotNull(box6);
+ assertEquals("alert('hello')", box6.getAttributes().get("onclick"));
StringWriter sw = new StringWriter();
ResponseWriter mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
@@ -597,15 +598,15 @@ public void testConvertTagAttributes6() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains("MYBOX6"));
- Assertions.assertTrue(sw.toString().contains("
"));
- }
-
+ assertTrue(sw.toString().contains("MYBOX6"));
+ assertTrue(sw.toString().contains("
"));
+ }
+
@Test
- public void testConvertTagAttributes7() throws Exception
+ void convertTagAttributes7() throws Exception
{
request.getSession().setAttribute("test", new MockBean());
@@ -617,9 +618,9 @@ public void testConvertTagAttributes7() throws Exception
//
UIComponent box7 = root.findComponent("myForm:box7");
- Assertions.assertNotNull(box7);
+ assertNotNull(box7);
UIComponent boxDiv7 = box7.getChildren().get(0);
- Assertions.assertNotNull(boxDiv7);
+ assertNotNull(boxDiv7);
StringWriter sw = new StringWriter();
@@ -636,9 +637,9 @@ public void testConvertTagAttributes7() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains("
![]()
UIInput input1 = (UIInput) root.findComponent("myForm:box1");
- Assertions.assertNotNull(input1);
-
- Assertions.assertEquals(input1.getPassThroughAttributes().get("placeholder"), "Enter text");
- Assertions.assertNull(input1.getAttributes().get("placeholder"));
-
-
- Assertions.assertEquals(input1.getAttributes().get("customAttr"), "SomeValue");
+ assertNotNull(input1);
+
+ assertEquals("Enter text", input1.getPassThroughAttributes().get("placeholder"));
+ assertNull(input1.getAttributes().get("placeholder"));
+
+
+ assertEquals("SomeValue", input1.getAttributes().get("customAttr"));
// Attributes outside "id", "binding", "rendered" or "transient" can be
// copied on passthrough attribute map.
- Assertions.assertNull(input1.getPassThroughAttributes().get("customAttr"));
-
- Assertions.assertEquals(input1.getPassThroughAttributes().get("data_up"), "Going Up");
- Assertions.assertNull(input1.getAttributes().get("data_up"));
+ assertNull(input1.getPassThroughAttributes().get("customAttr"));
+
+ assertEquals("Going Up", input1.getPassThroughAttributes().get("data_up"));
+ assertNull(input1.getAttributes().get("data_up"));
- Assertions.assertNotNull(input1.getValueExpression("value"));
+ assertNotNull(input1.getValueExpression("value"));
//Assertions.assertNotNull(input1.getPassThroughAttributes().get("value"));
- Assertions.assertNull(input1.getPassThroughAttributes().get("value"));
- Assertions.assertEquals(input1.getValue(), "value1");
- Assertions.assertEquals(input1.getAttributes().get("value"), "value1");
+ assertNull(input1.getPassThroughAttributes().get("value"));
+ assertEquals("value1", input1.getValue());
+ assertEquals("value1", input1.getAttributes().get("value"));
//
Hello World!
UIComponent input2 = root.findComponent("myForm:box2");
- Assertions.assertFalse(input2 instanceof UIInput);
- Assertions.assertEquals(input2.getRendererType(), "jakarta.faces.passthrough.Element");
-
- Assertions.assertEquals(input2.getPassThroughAttributes().get("placeholder"), "Enter text");
+ assertFalse(input2 instanceof UIInput);
+ assertEquals("jakarta.faces.passthrough.Element", input2.getRendererType());
+
+ assertEquals("Enter text", input2.getPassThroughAttributes().get("placeholder"));
//Assertions.assertEquals(input2.getAttributes().get("placeholder"), "Enter text");
- Assertions.assertNull(input2.getAttributes().get("placeholder"));
-
- Assertions.assertEquals(input2.getAttributes().get("customAttr"), "SomeValue");
+ assertNull(input2.getAttributes().get("placeholder"));
+
+ assertEquals("SomeValue", input2.getAttributes().get("customAttr"));
//Assertions.assertNull(input2.getAttributes().get("customAttr"));
//Assertions.assertEquals(input2.getPassThroughAttributes().get("customAttr"), "SomeValue");
- Assertions.assertNull(input2.getPassThroughAttributes().get("customAttr"));
-
- Assertions.assertEquals(input2.getPassThroughAttributes().get("data_up"), "Going Up");
- Assertions.assertNull(input2.getAttributes().get("data_up"));
+ assertNull(input2.getPassThroughAttributes().get("customAttr"));
+
+ assertEquals("Going Up", input2.getPassThroughAttributes().get("data_up"));
+ assertNull(input2.getAttributes().get("data_up"));
// note there is no type attribute, so it is translated into a jsf:element, and in that
// component, "value" is not defined, so it is set as passthrough
- Assertions.assertNotNull(input2.getValueExpression("value"));
- Assertions.assertNull(input2.getPassThroughAttributes().get("value"));
- Assertions.assertNotNull(input2.getAttributes().get("value"));
+ assertNotNull(input2.getValueExpression("value"));
+ assertNull(input2.getPassThroughAttributes().get("value"));
+ assertNotNull(input2.getAttributes().get("value"));
//
UIComponent input3 = root.findComponent("myForm:box3");
- Assertions.assertFalse(input3 instanceof UIInput);
- Assertions.assertEquals(input3.getRendererType(), "jakarta.faces.passthrough.Element");
+ assertFalse(input3 instanceof UIInput);
+ assertEquals("jakarta.faces.passthrough.Element", input3.getRendererType());
- Assertions.assertEquals(input3.getAttributes().get("placeholder"), "Enter text");
- Assertions.assertNull(input3.getPassThroughAttributes().get("placeholder"));
-
- Assertions.assertNull(input3.getPassThroughAttributes().get("customAttr"));
- Assertions.assertEquals(input3.getAttributes().get("customAttr"), "SomeValue");
+ assertEquals("Enter text", input3.getAttributes().get("placeholder"));
+ assertNull(input3.getPassThroughAttributes().get("placeholder"));
- Assertions.assertEquals(input3.getPassThroughAttributes().get("data_up"), "Going Up");
- Assertions.assertNull(input3.getAttributes().get("data_up"));
+ assertNull(input3.getPassThroughAttributes().get("customAttr"));
+ assertEquals("SomeValue", input3.getAttributes().get("customAttr"));
+
+ assertEquals("Going Up", input3.getPassThroughAttributes().get("data_up"));
+ assertNull(input3.getAttributes().get("data_up"));
- Assertions.assertNotNull(input3.getValueExpression("value"));
- Assertions.assertNull(input3.getPassThroughAttributes().get("value"));
- Assertions.assertNotNull(input3.getAttributes().get("value"));
+ assertNotNull(input3.getValueExpression("value"));
+ assertNull(input3.getPassThroughAttributes().get("value"));
+ assertNotNull(input3.getAttributes().get("value"));
//Assertions.assertEquals(input2.getPassThroughAttributes().get("elementName"), "meter");
@@ -429,12 +430,12 @@ public void testConvertTagAttributes1() throws Exception
//
//
UIComponent box4 = root.findComponent("myForm:box4");
- Assertions.assertNotNull(box4);
+ assertNotNull(box4);
UIComponent boxDiv4 = box4.getChildren().get(0);
- Assertions.assertNotNull(boxDiv4);
- Assertions.assertEquals(boxDiv4.getAttributes().get("styleClass"), "noprint");
+ assertNotNull(boxDiv4);
+ assertEquals("noprint", boxDiv4.getAttributes().get("styleClass"));
//Assertions.assertEquals(boxDiv4.getPassThroughAttributes().get("class"), "noprint");
- Assertions.assertNull(boxDiv4.getPassThroughAttributes().get("class"));
+ assertNull(boxDiv4.getPassThroughAttributes().get("class"));
//
//
@@ -442,12 +443,12 @@ public void testConvertTagAttributes1() throws Exception
//
//
UIComponent box5 = root.findComponent("myForm:box5");
- Assertions.assertNotNull(box5);
+ assertNotNull(box5);
UIComponent boxDiv5 = box5.getChildren().get(0);
- Assertions.assertNotNull(boxDiv5);
- Assertions.assertNotNull(boxDiv5.getAttributes().get("style"));
+ assertNotNull(boxDiv5);
+ assertNotNull(boxDiv5.getAttributes().get("style"));
//Assertions.assertEquals(boxDiv5.getPassThroughAttributes().get("style"), "noprint");
- Assertions.assertNull(boxDiv5.getPassThroughAttributes().get("style"));
+ assertNull(boxDiv5.getPassThroughAttributes().get("style"));
StringWriter sw = new StringWriter();
@@ -469,7 +470,7 @@ public void testConvertTagAttributes1() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
sw = new StringWriter();
@@ -490,10 +491,10 @@ public void testConvertTagAttributes1() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains("
"));
+ assertTrue(sw.toString().contains(""));
sw = new StringWriter();
mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
@@ -514,10 +515,10 @@ public void testConvertTagAttributes1() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains(""));
+ assertTrue(sw.toString().contains(""));
// TEST 4
sw = new StringWriter();
@@ -535,11 +536,11 @@ public void testConvertTagAttributes1() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains("MYBOX4"));
- Assertions.assertTrue(sw.toString().contains(""));
+ assertTrue(sw.toString().contains("MYBOX4"));
+ assertTrue(sw.toString().contains("
"));
// TEST 5
sw = new StringWriter();
@@ -557,15 +558,15 @@ public void testConvertTagAttributes1() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains("MYBOX5"));
- Assertions.assertTrue(sw.toString().contains("
"));
- }
-
+ assertTrue(sw.toString().contains("MYBOX5"));
+ assertTrue(sw.toString().contains("
"));
+ }
+
@Test
- public void testConvertTagAttributes6() throws Exception
+ void convertTagAttributes6() throws Exception
{
request.getSession().setAttribute("test", new MockBean());
@@ -578,8 +579,8 @@ public void testConvertTagAttributes6() throws Exception
//
// Try second time, to avoid the script section by f:ajax effect
UIComponent box6 = root.findComponent("myForm:box6");
- Assertions.assertNotNull(box6);
- Assertions.assertEquals(box6.getAttributes().get("onclick"), "alert('hello')");
+ assertNotNull(box6);
+ assertEquals("alert('hello')", box6.getAttributes().get("onclick"));
StringWriter sw = new StringWriter();
ResponseWriter mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
@@ -597,15 +598,15 @@ public void testConvertTagAttributes6() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains("MYBOX6"));
- Assertions.assertTrue(sw.toString().contains("
"));
- }
-
+ assertTrue(sw.toString().contains("MYBOX6"));
+ assertTrue(sw.toString().contains("
"));
+ }
+
@Test
- public void testConvertTagAttributes7() throws Exception
+ void convertTagAttributes7() throws Exception
{
request.getSession().setAttribute("test", new MockBean());
@@ -617,9 +618,9 @@ public void testConvertTagAttributes7() throws Exception
//
UIComponent box7 = root.findComponent("myForm:box7");
- Assertions.assertNotNull(box7);
+ assertNotNull(box7);
UIComponent boxDiv7 = box7.getChildren().get(0);
- Assertions.assertNotNull(boxDiv7);
+ assertNotNull(boxDiv7);
StringWriter sw = new StringWriter();
@@ -636,9 +637,9 @@ public void testConvertTagAttributes7() throws Exception
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
- Assertions.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
- Assertions.assertTrue(sw.toString().contains("
![]()
Component value: page test2"));
- Assertions.assertTrue(result.contains("
Inline EL value: page test2
"));
+ assertTrue(result.contains("
Component value: page test2
"));
+ assertTrue(result.contains("
Inline EL value: page test2
"));
//System.out.println(fw);
@@ -145,13 +147,13 @@ public void testCaching() throws Exception
result = fw.toString();
- Assertions.assertTrue(result.contains("
Component value: page test3
"));
- Assertions.assertTrue(result.contains("
Inline EL value: page test3
"));
+ assertTrue(result.contains("
Component value: page test3
"));
+ assertTrue(result.contains("
Inline EL value: page test3
"));
}
-
+
@Test
- public void testSimpleCompositionParam() throws Exception
+ void simpleCompositionParam() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "simpleCompositionParam.xhtml");
@@ -164,7 +166,7 @@ public void testSimpleCompositionParam() throws Exception
rw.flush();
String result = fw.toString();
- Assertions.assertTrue(result.contains("value1"));
+ assertTrue(result.contains("value1"));
}
/**
@@ -174,7 +176,7 @@ public void testSimpleCompositionParam() throws Exception
* @throws Exception
*/
@Test
- public void testUIParamTemplateScope1() throws Exception
+ void uIParamTemplateScope1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "uiparamtemplatescope1.xhtml");
@@ -187,10 +189,10 @@ public void testUIParamTemplateScope1() throws Exception
rw.flush();
String result = fw.toString();
- Assertions.assertTrue(result.contains("rightValue"));
- Assertions.assertFalse(result.contains("doNotPrintValue"));
+ assertTrue(result.contains("rightValue"));
+ assertFalse(result.contains("doNotPrintValue"));
}
-
+
/**
* ui:param defined outside should not pass through ui:include, because it occurs
* on another template context.
@@ -198,7 +200,7 @@ public void testUIParamTemplateScope1() throws Exception
* @throws Exception
*/
@Test
- public void testUIParamTemplateScope2() throws Exception
+ void uIParamTemplateScope2() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "uiparamtemplatescope2.xhtml");
@@ -211,9 +213,9 @@ public void testUIParamTemplateScope2() throws Exception
rw.flush();
String result = fw.toString();
- Assertions.assertFalse(result.contains("doNotPrintValue"));
+ assertFalse(result.contains("doNotPrintValue"));
}
-
+
/**
* ui:param inside ui:include applies only to the content of the tag and the
* referenced template.
@@ -221,7 +223,7 @@ public void testUIParamTemplateScope2() throws Exception
* @throws Exception
*/
@Test
- public void testUIParamTemplateScope3() throws Exception
+ void uIParamTemplateScope3() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "uiparamtemplatescope3.xhtml");
@@ -234,10 +236,10 @@ public void testUIParamTemplateScope3() throws Exception
rw.flush();
String result = fw.toString();
- Assertions.assertTrue(result.contains("rightValue"));
- Assertions.assertFalse(result.contains("doNotPrintValue"));
+ assertTrue(result.contains("rightValue"));
+ assertFalse(result.contains("doNotPrintValue"));
}
-
+
/**
* ui:param inside ui:composition applies only to the content of the tag and the
* referenced template.
@@ -245,7 +247,7 @@ public void testUIParamTemplateScope3() throws Exception
* @throws Exception
*/
@Test
- public void testUIParamTemplateScope4() throws Exception
+ void uIParamTemplateScope4() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "uiparamtemplatescope4.xhtml");
@@ -258,17 +260,17 @@ public void testUIParamTemplateScope4() throws Exception
rw.flush();
String result = fw.toString();
- Assertions.assertTrue(result.contains("rightValue"));
- Assertions.assertFalse(result.contains("doNotPrintValue"));
+ assertTrue(result.contains("rightValue"));
+ assertFalse(result.contains("doNotPrintValue"));
}
-
+
/**
* ui:param defined outside should only pass through ui:include if the param is declared.
*
* @throws Exception
*/
@Test
- public void testUIParamTemplateScope5() throws Exception
+ void uIParamTemplateScope5() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "uiparamtemplatescope5.xhtml");
@@ -281,11 +283,11 @@ public void testUIParamTemplateScope5() throws Exception
rw.flush();
String result = fw.toString();
- Assertions.assertTrue(result.contains("rightValue"));
- Assertions.assertTrue(result.contains("right2Value"));
- Assertions.assertFalse(result.contains("doNotPrintValue"));
+ assertTrue(result.contains("rightValue"));
+ assertTrue(result.contains("right2Value"));
+ assertFalse(result.contains("doNotPrintValue"));
}
-
+
/**
* ui:param defined outside should not pass through composite components, to do
* that the composite component provide a clean attribute interface.
@@ -293,7 +295,7 @@ public void testUIParamTemplateScope5() throws Exception
* @throws Exception
*/
@Test
- public void testUIParamTemplateScope6() throws Exception
+ void uIParamTemplateScope6() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "uiparamtemplatescope6.xhtml");
@@ -306,10 +308,10 @@ public void testUIParamTemplateScope6() throws Exception
rw.flush();
String result = fw.toString();
- Assertions.assertTrue(result.contains("rightValue"));
- Assertions.assertFalse(result.contains("doNotPrintValue"));
+ assertTrue(result.contains("rightValue"));
+ assertFalse(result.contains("doNotPrintValue"));
}
-
+
/**
* ui:param should pass through nested ui:decorate or ui:composition constructions, because it is the
* same template context. Additionally, ui:param declarations should follow the same ordering rules
@@ -318,7 +320,7 @@ public void testUIParamTemplateScope6() throws Exception
* @throws Exception
*/
@Test
- public void testUIParamTemplateScope7() throws Exception
+ void uIParamTemplateScope7() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "uiparamtemplatescope7.xhtml");
@@ -331,13 +333,13 @@ public void testUIParamTemplateScope7() throws Exception
rw.flush();
String result = fw.toString();
- Assertions.assertTrue(result.contains("value1"));
- Assertions.assertTrue(result.contains("value2"));
- Assertions.assertTrue(result.contains("value3"));
- Assertions.assertTrue(result.contains("value4"));
- Assertions.assertTrue(result.contains("value5"));
- Assertions.assertTrue(result.contains("valu1e5"));
- Assertions.assertTrue(result.contains("valu1e6"));
- Assertions.assertFalse(result.contains("value6"));
+ assertTrue(result.contains("value1"));
+ assertTrue(result.contains("value2"));
+ assertTrue(result.contains("value3"));
+ assertTrue(result.contains("value4"));
+ assertTrue(result.contains("value5"));
+ assertTrue(result.contains("valu1e5"));
+ assertTrue(result.contains("valu1e6"));
+ assertFalse(result.contains("value6"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RemoveTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RemoveTestCase.java
index 6e44857717..1dc53fdc1b 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RemoveTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RemoveTestCase.java
@@ -19,6 +19,9 @@
package org.apache.myfaces.view.facelets.tag.ui;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
import java.io.StringWriter;
import jakarta.faces.component.UIForm;
import jakarta.faces.component.UIOutput;
@@ -34,14 +37,13 @@
import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
*
* @author lu4242
*/
-public class RemoveTestCase extends AbstractFaceletTestCase
+class RemoveTestCase extends AbstractFaceletTestCase
{
@Override
protected void setupComponents() throws Exception
@@ -76,16 +78,16 @@ protected void setupRenderers() throws Exception
"jakarta.faces.Button", new HtmlButtonRenderer());
renderKit.addRenderer(HtmlPanelGrid.COMPONENT_FAMILY,
"jakarta.faces.Grid", new HtmlGridRenderer());
- }
-
+ }
+
@Test
- public void testRemoveMetadata() throws Exception {
+ void removeMetadata() throws Exception {
request.setAttribute("beanValue", "hello");
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testRemoveMetadata.xhtml");
- Assertions.assertNull(root.getFacet(UIViewRoot.METADATA_FACET_NAME));
+ assertNull(root.getFacet(UIViewRoot.METADATA_FACET_NAME));
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -95,9 +97,9 @@ public void testRemoveMetadata() throws Exception {
sw.flush();
//System.out.println(sw.toString());
- Assertions.assertFalse(sw.toString().contains("ui:remove"));
- Assertions.assertFalse(sw.toString().contains("f:metadata"));
- Assertions.assertFalse(sw.toString().contains("Should not be here"));
+ assertFalse(sw.toString().contains("ui:remove"));
+ assertFalse(sw.toString().contains("f:metadata"));
+ assertFalse(sw.toString().contains("Should not be here"));
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java
index ad2847957c..c107b673b9 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.ui;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -42,7 +44,6 @@
import org.apache.myfaces.view.facelets.bean.Example;
import org.apache.myfaces.view.facelets.component.UIRepeat;
import org.apache.myfaces.util.lang.FastWriter;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -51,11 +52,11 @@
* @author Jakob Korherr (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class RepeatTestCase extends AbstractFaceletTestCase
+class RepeatTestCase extends AbstractFaceletTestCase
{
@Test
- public void testRepeat() throws Exception
+ void repeat() throws Exception
{
Company c = Example.createCompany();
facesContext.getExternalContext().getRequestMap().put("company", c);
@@ -71,31 +72,31 @@ public void testRepeat() throws Exception
String content = fw.toString();
int hrIndex = content.indexOf("
HR");
- Assertions.assertNotSame(-1, hrIndex);
+ assertNotSame(-1, hrIndex);
int rdIndex = content.indexOf("
RD", hrIndex);
- Assertions.assertNotSame(-1, rdIndex);
+ assertNotSame(-1, rdIndex);
int empIndex1 = content.indexOf(
"
Ellen, SueScooner, Mary", hrIndex);
- Assertions.assertNotSame(-1, empIndex1);
+ assertNotSame(-1, empIndex1);
int empIndex2 = content.indexOf(
"
Burns, EdLubke, RyanKitain, Roger",
rdIndex);
- Assertions.assertNotSame(-1, empIndex2);
+ assertNotSame(-1, empIndex2);
int hrIndex2 = content.indexOf("
HR");
- Assertions.assertNotSame(-1, hrIndex2);
+ assertNotSame(-1, hrIndex2);
int rdIndex2 = content.indexOf("
RD", hrIndex2);
- Assertions.assertNotSame(-1, rdIndex2);
+ assertNotSame(-1, rdIndex2);
}
-
+
/**
* Tests UIRepeat.invokeOnComponent() including var and varStatus properties.
* @throws IOException
*/
@Test
@SuppressWarnings("unchecked")
- public void testInvokeOnComponent() throws IOException
+ void invokeOnComponent() throws Exception
{
// put the values for ui:repeat on the request map
final String[] repeatValues = new String[]{ "a", "b", "c" };
@@ -123,49 +124,49 @@ public void testInvokeOnComponent() throws IOException
// invokeOnComponent on UIRepeat itself
String invokeId = "form:repeat";
- Assertions.assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
- Assertions.assertEquals(repeat, callback._lastTarget);
- Assertions.assertEquals(varValue, callback._rowValue); // previous set varValue
- Assertions.assertEquals(statusValue, callback._repeatStatus); // previous set statusValue
+ assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
+ assertEquals(repeat, callback._lastTarget);
+ assertEquals(varValue, callback._rowValue); // previous set varValue
+ assertEquals(statusValue, callback._repeatStatus); // previous set statusValue
// invokeOnComponent on a child of UIRepeat in the first row
invokeId = "form:repeat:0:outputText";
- Assertions.assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
- Assertions.assertEquals(outputText, callback._lastTarget);
- Assertions.assertEquals(repeatValues[0], callback._rowValue);
- Assertions.assertEquals(0, callback._index);
- Assertions.assertEquals(true, callback._first);
- Assertions.assertEquals(false, callback._last);
- Assertions.assertEquals(true, callback._even);
+ assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
+ assertEquals(outputText, callback._lastTarget);
+ assertEquals(repeatValues[0], callback._rowValue);
+ assertEquals(0, callback._index);
+ assertEquals(true, callback._first);
+ assertEquals(false, callback._last);
+ assertEquals(true, callback._even);
// invokeOnComponent on a child of UIRepeat in the second row
invokeId = "form:repeat:1:outputText";
- Assertions.assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
- Assertions.assertEquals(outputText, callback._lastTarget);
- Assertions.assertEquals(repeatValues[1], callback._rowValue);
- Assertions.assertEquals(1, callback._index);
- Assertions.assertEquals(false, callback._first);
- Assertions.assertEquals(false, callback._last);
- Assertions.assertEquals(false, callback._even);
+ assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
+ assertEquals(outputText, callback._lastTarget);
+ assertEquals(repeatValues[1], callback._rowValue);
+ assertEquals(1, callback._index);
+ assertEquals(false, callback._first);
+ assertEquals(false, callback._last);
+ assertEquals(false, callback._even);
// invokeOnComponent on a child of UIRepeat in the third row
invokeId = "form:repeat:2:outputText";
- Assertions.assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
- Assertions.assertEquals(outputText, callback._lastTarget);
- Assertions.assertEquals(repeatValues[2], callback._rowValue);
- Assertions.assertEquals(2, callback._index);
- Assertions.assertEquals(false, callback._first);
- Assertions.assertEquals(true, callback._last);
- Assertions.assertEquals(true, callback._even);
+ assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
+ assertEquals(outputText, callback._lastTarget);
+ assertEquals(repeatValues[2], callback._rowValue);
+ assertEquals(2, callback._index);
+ assertEquals(false, callback._first);
+ assertEquals(true, callback._last);
+ assertEquals(true, callback._even);
// invokeOnComponent on a child of UIRepeat with invalid row (-1)
invokeId = "form:repeat:outputText";
- Assertions.assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
+ assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
// after all these calls to invokeOnComponent, row and status still
// have to be the same like before
- Assertions.assertEquals(varValue, externalContext.getRequestMap().get(var));
- Assertions.assertEquals(statusValue, externalContext.getRequestMap().get(varStatus));
+ assertEquals(varValue, externalContext.getRequestMap().get(var));
+ assertEquals(statusValue, externalContext.getRequestMap().get(varStatus));
// remove the values from the request map
externalContext.getRequestMap().remove("repeatValues");
@@ -231,14 +232,14 @@ public void invokeContextCallback(FacesContext context, UIComponent target)
}
}
-
+
/**
* Tests UIRepeat.visitTree().
* @throws IOException
*/
@Test
@SuppressWarnings("unchecked")
- public void testVisitTree() throws IOException
+ void visitTree() throws Exception
{
// put the values for ui:repeat on the request map
final String[] repeatValues = new String[]{ "a", "b", "c" };
@@ -274,12 +275,12 @@ public void testVisitTree() throws IOException
expectedClientIds.add("form:repeat:2:outputText");
// see if we got the expected result
- Assertions.assertEquals(expectedClientIds, testVisitCallback._visitedClientIds);
+ assertEquals(expectedClientIds, testVisitCallback._visitedClientIds);
// after the tree visit, row and status still
// have to be the same like before
- Assertions.assertEquals(varValue, externalContext.getRequestMap().get(var));
- Assertions.assertEquals(statusValue, externalContext.getRequestMap().get(varStatus));
+ assertEquals(varValue, externalContext.getRequestMap().get(var));
+ assertEquals(statusValue, externalContext.getRequestMap().get(varStatus));
// remove the values from the request map
externalContext.getRequestMap().remove("repeatValues");
@@ -314,7 +315,7 @@ public VisitResult visit(VisitContext context, UIComponent target)
final String clientId = target.getClientId(context.getFacesContext());
if (_visitedClientIds.contains(clientId))
{
- Assertions.fail("Component with clientId " + clientId + " visited twice!");
+ fail("Component with clientId " + clientId + " visited twice!");
}
else
{
@@ -327,15 +328,15 @@ public VisitResult visit(VisitContext context, UIComponent target)
Object indexObject = _indexValueExpression.getValue(elCtx);
// indexObject has to be an Integer
- Assertions.assertTrue(indexObject instanceof Integer);
+ assertInstanceOf(Integer.class, indexObject);
Integer index = (Integer) indexObject;
// the index has to be part of the clientId
- Assertions.assertTrue(clientId.contains("" + index));
+ assertTrue(clientId.contains("" + index));
Object rowValue = _rowValueExpression.getValue(elCtx);
// #{row} has to be the repeatValue for the current index
- Assertions.assertEquals(_repeatValues[index], rowValue);
+ assertEquals(_repeatValues[index], rowValue);
}
}
@@ -343,9 +344,9 @@ public VisitResult visit(VisitContext context, UIComponent target)
}
}
-
+
@Test
- public void testRepeatOffset() throws Exception
+ void repeatOffset() throws Exception
{
final String[] repeatValues = new String[] {"B1", "B2", "B3", "B4", "B5", "B6", "B7"};
facesContext.getExternalContext().getRequestMap().put("repeatValues", repeatValues);
@@ -354,7 +355,7 @@ public void testRepeatOffset() throws Exception
vdl.buildView(facesContext, root, "ui_repeat_offset.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -366,20 +367,20 @@ public void testRepeatOffset() throws Exception
// offset="2" size="1" should render only 1 row
int itemIndex1 = content.indexOf("B1");
- Assertions.assertEquals(-1, itemIndex1);
+ assertEquals(-1, itemIndex1);
int itemIndex2 = content.indexOf("B2");
- Assertions.assertEquals(-1, itemIndex2);
+ assertEquals(-1, itemIndex2);
String item1 = "B3";
int itemIndex3 = content.indexOf(item1);
- Assertions.assertNotSame(-1, itemIndex3);
+ assertNotSame(-1, itemIndex3);
String item2 = "B4";
// the second item should not be there
- Assertions.assertEquals(-1, content.indexOf(item2, itemIndex1+2));
+ assertEquals(-1, content.indexOf(item2, itemIndex1+2));
}
-
+
@Test
- public void testRepeatOffset_0() throws Exception
+ void repeatOffset0() throws Exception
{
final String[] repeatValues = new String[] {"B1", "B2", "B3", "B4", "B5", "B6", "B7"};
facesContext.getExternalContext().getRequestMap().put("repeatValues", repeatValues);
@@ -388,7 +389,7 @@ public void testRepeatOffset_0() throws Exception
vdl.buildView(facesContext, root, "ui_repeat_offset.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat0");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -400,15 +401,15 @@ public void testRepeatOffset_0() throws Exception
String content = fw.toString();
int itemIndex1 = content.indexOf("B1");
- Assertions.assertNotSame(-1, itemIndex1);
+ assertNotSame(-1, itemIndex1);
int itemIndex2 = content.indexOf("B2");
- Assertions.assertNotSame(-1, itemIndex2);
+ assertNotSame(-1, itemIndex2);
int itemIndex3 = content.indexOf("B3");
- Assertions.assertEquals(-1, itemIndex3);
+ assertEquals(-1, itemIndex3);
}
-
+
@Test
- public void testRepeatOffset_0_7() throws Exception
+ void repeatOffset07() throws Exception
{
final String[] repeatValues = new String[] {"B1", "B2", "B3", "B4", "B5", "B6", "B7"};
facesContext.getExternalContext().getRequestMap().put("repeatValues", repeatValues);
@@ -417,7 +418,7 @@ public void testRepeatOffset_0_7() throws Exception
vdl.buildView(facesContext, root, "ui_repeat_offset.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat0_7");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -429,25 +430,24 @@ public void testRepeatOffset_0_7() throws Exception
String content = fw.toString();
int itemIndex1 = content.indexOf("B1");
- Assertions.assertNotSame(-1, itemIndex1);
+ assertNotSame(-1, itemIndex1);
int itemIndex2 = content.indexOf("B2", itemIndex1);
- Assertions.assertNotSame(-1, itemIndex2);
+ assertNotSame(-1, itemIndex2);
int itemIndex3 = content.indexOf("B3", itemIndex2);
- Assertions.assertNotSame(-1, itemIndex3);
+ assertNotSame(-1, itemIndex3);
int itemIndex4 = content.indexOf("B4", itemIndex3);
- Assertions.assertNotSame(-1, itemIndex4);
+ assertNotSame(-1, itemIndex4);
int itemIndex5 = content.indexOf("B5", itemIndex4);
- Assertions.assertNotSame(-1, itemIndex5);
+ assertNotSame(-1, itemIndex5);
int itemIndex6 = content.indexOf("B6", itemIndex5);
- Assertions.assertNotSame(-1, itemIndex6);
+ assertNotSame(-1, itemIndex6);
int itemIndex7 = content.indexOf("B7", itemIndex6);
- Assertions.assertNotSame(-1, itemIndex7);
+ assertNotSame(-1, itemIndex7);
}
-
-
-
+
+
@Test
- public void testRepeatOffset_0_8() throws Exception
+ void repeatOffset08() throws Exception
{
final String[] repeatValues = new String[] {"B1", "B2", "B3", "B4", "B5", "B6", "B7"};
facesContext.getExternalContext().getRequestMap().put("repeatValues", repeatValues);
@@ -456,7 +456,7 @@ public void testRepeatOffset_0_8() throws Exception
vdl.buildView(facesContext, root, "ui_repeat_offset.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat0_8");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -466,17 +466,17 @@ public void testRepeatOffset_0_8() throws Exception
try
{
repeat.encodeAll(facesContext);
- Assertions.fail();
+ fail();
}
catch(FacesException e)
{
// size cannot be greater than collection size
}
}
-
-
+
+
@Test
- public void testRepeatOffset_1() throws Exception
+ void repeatOffset1() throws Exception
{
final String[] repeatValues = new String[] {"B1", "B2", "B3", "B4", "B5", "B6", "B7"};
facesContext.getExternalContext().getRequestMap().put("repeatValues", repeatValues);
@@ -485,7 +485,7 @@ public void testRepeatOffset_1() throws Exception
vdl.buildView(facesContext, root, "ui_repeat_offset.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat1");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -497,19 +497,19 @@ public void testRepeatOffset_1() throws Exception
String content = fw.toString();
int itemIndex1 = content.indexOf("B1");
- Assertions.assertEquals(-1, itemIndex1);
+ assertEquals(-1, itemIndex1);
int itemIndex2 = content.indexOf("B2");
- Assertions.assertNotSame(-1, itemIndex2);
+ assertNotSame(-1, itemIndex2);
int itemIndex3 = content.indexOf("B3", itemIndex2);
- Assertions.assertNotSame(-1, itemIndex3);
+ assertNotSame(-1, itemIndex3);
int itemIndex4 = content.indexOf("B4", itemIndex3);
- Assertions.assertNotSame(-1, itemIndex4);
+ assertNotSame(-1, itemIndex4);
int itemIndex5 = content.indexOf("B5", itemIndex4);
- Assertions.assertEquals(-1, itemIndex5);
+ assertEquals(-1, itemIndex5);
}
-
+
@Test
- public void testRepeatOffset_1_7() throws Exception
+ void repeatOffset17() throws Exception
{
final String[] repeatValues = new String[] {"B1", "B2", "B3", "B4", "B5", "B6", "B7"};
facesContext.getExternalContext().getRequestMap().put("repeatValues", repeatValues);
@@ -518,7 +518,7 @@ public void testRepeatOffset_1_7() throws Exception
vdl.buildView(facesContext, root, "ui_repeat_offset.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat1_7");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -530,24 +530,24 @@ public void testRepeatOffset_1_7() throws Exception
String content = fw.toString();
int itemIndex1 = content.indexOf("B1");
- Assertions.assertEquals(-1, itemIndex1);
+ assertEquals(-1, itemIndex1);
int itemIndex2 = content.indexOf("B2");
- Assertions.assertNotSame(-1, itemIndex2);
+ assertNotSame(-1, itemIndex2);
int itemIndex3 = content.indexOf("B3", itemIndex2);
- Assertions.assertNotSame(-1, itemIndex3);
+ assertNotSame(-1, itemIndex3);
int itemIndex4 = content.indexOf("B4", itemIndex3);
- Assertions.assertNotSame(-1, itemIndex4);
+ assertNotSame(-1, itemIndex4);
int itemIndex5 = content.indexOf("B5", itemIndex4);
- Assertions.assertNotSame(-1, itemIndex5);
+ assertNotSame(-1, itemIndex5);
int itemIndex6 = content.indexOf("B6", itemIndex5);
- Assertions.assertNotSame(-1, itemIndex6);
+ assertNotSame(-1, itemIndex6);
int itemIndex7 = content.indexOf("B7", itemIndex6);
- Assertions.assertNotSame(-1, itemIndex7);
+ assertNotSame(-1, itemIndex7);
}
-
-
+
+
@Test
- public void testRepeatOffset_1_8() throws Exception
+ void repeatOffset18() throws Exception
{
final String[] repeatValues = new String[] {"B1", "B2", "B3", "B4", "B5", "B6", "B7"};
facesContext.getExternalContext().getRequestMap().put("repeatValues", repeatValues);
@@ -556,7 +556,7 @@ public void testRepeatOffset_1_8() throws Exception
vdl.buildView(facesContext, root, "ui_repeat_offset.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat1_8");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -566,7 +566,7 @@ public void testRepeatOffset_1_8() throws Exception
try
{
repeat.encodeAll(facesContext);
- Assertions.fail();
+ fail();
}
catch(FacesException e)
{
@@ -575,7 +575,7 @@ public void testRepeatOffset_1_8() throws Exception
}
@Test
- public void testRepeatOffset2() throws Exception
+ void repeatOffset2() throws Exception
{
final String[] repeatValues = new String[] {"B1", "B2", "B3", "B4", "B5", "B6", "B7"};
facesContext.getExternalContext().getRequestMap().put("repeatValues", repeatValues);
@@ -584,7 +584,7 @@ public void testRepeatOffset2() throws Exception
vdl.buildView(facesContext, root, "ui_repeat_offset2.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -596,34 +596,33 @@ public void testRepeatOffset2() throws Exception
String content = fw.toString();
int itemIndex1 = content.indexOf("B1");
- Assertions.assertEquals(-1, itemIndex1);
+ assertEquals(-1, itemIndex1);
int itemIndex2 = content.indexOf("B2");
- Assertions.assertEquals(-1, itemIndex2);
+ assertEquals(-1, itemIndex2);
int itemIndex3 = content.indexOf("B3");
- Assertions.assertNotSame(-1, itemIndex3);
+ assertNotSame(-1, itemIndex3);
int itemIndex4 = content.indexOf("B4", itemIndex3);
- Assertions.assertNotSame(-1, itemIndex4);
+ assertNotSame(-1, itemIndex4);
int itemIndex5 = content.indexOf("B5", itemIndex4);
- Assertions.assertNotSame(-1, itemIndex5);
+ assertNotSame(-1, itemIndex5);
int itemIndex6 = content.indexOf("B6", itemIndex5);
- Assertions.assertNotSame(-1, itemIndex6);
+ assertNotSame(-1, itemIndex6);
int itemIndex7 = content.indexOf("B7", itemIndex6);
- Assertions.assertNotSame(-1, itemIndex7);
+ assertNotSame(-1, itemIndex7);
//System.out.println(fw);
}
-
-
-
+
+
@Test
@SuppressWarnings("unchecked")
- public void testInvokeOnComponentBeginEnd() throws IOException
+ void invokeOnComponentBeginEnd() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testUIRepeatBeginEnd.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -634,17 +633,17 @@ public void testInvokeOnComponentBeginEnd() throws IOException
String content = fw.toString();
- Assertions.assertTrue(content.contains("Hello 1"));
- Assertions.assertTrue(content.contains("Hello 2"));
- Assertions.assertTrue(content.contains("Hello 3"));
+ assertTrue(content.contains("Hello 1"));
+ assertTrue(content.contains("Hello 2"));
+ assertTrue(content.contains("Hello 3"));
- Assertions.assertFalse(content.contains("Hello 0"));
- Assertions.assertFalse(content.contains("Hello 4"));
+ assertFalse(content.contains("Hello 0"));
+ assertFalse(content.contains("Hello 4"));
}
@Test
@SuppressWarnings("unchecked")
- public void testInvokeOnNullModel() throws IOException
+ void invokeOnNullModel() throws Exception
{
final List
modelValues = null;
final List loadedModelValues = Arrays.asList("Claire", "Michael");
@@ -654,7 +653,7 @@ public void testInvokeOnNullModel() throws IOException
vdl.buildView(facesContext, root, "testUIRepeatEmpty.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -665,12 +664,12 @@ public void testInvokeOnNullModel() throws IOException
String content = fw.toString();
- Assertions.assertFalse(content.contains("Hello "));
+ assertFalse(content.contains("Hello "));
}
@Test
@SuppressWarnings("unchecked")
- public void testInvokeOnEmptyList() throws IOException
+ void invokeOnEmptyList() throws Exception
{
final List modelValues = Collections.emptyList();
final List loadedModelValues = Arrays.asList("Claire", "Michael");
@@ -680,7 +679,7 @@ public void testInvokeOnEmptyList() throws IOException
vdl.buildView(facesContext, root, "testUIRepeatEmpty.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -691,12 +690,12 @@ public void testInvokeOnEmptyList() throws IOException
String content = fw.toString();
- Assertions.assertFalse(content.contains("Hello "));
+ assertFalse(content.contains("Hello "));
}
@Test
@SuppressWarnings("unchecked")
- public void testInvokeModelStep_1() throws IOException
+ void invokeModelStep1() throws Exception
{
final List values = Arrays.asList("User #0", "User #1", "User #2", "User #3", "User #4", "User #5", "User #6", "User #7", "User #8", "User #9", "User #10");
IterationBean iterationBean = new IterationBean(1, 7, 1, values);
@@ -705,7 +704,7 @@ public void testInvokeModelStep_1() throws IOException
vdl.buildView(facesContext, root, "ui_repeat_model_step.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -716,22 +715,22 @@ public void testInvokeModelStep_1() throws IOException
String content = fw.toString();
- Assertions.assertTrue(content.contains("User #1"));
- Assertions.assertTrue(content.contains("User #2"));
- Assertions.assertTrue(content.contains("User #3"));
- Assertions.assertTrue(content.contains("User #4"));
- Assertions.assertTrue(content.contains("User #5"));
- Assertions.assertTrue(content.contains("User #6"));
- Assertions.assertTrue(content.contains("User #7"));
- Assertions.assertFalse(content.contains("User #0"));
- Assertions.assertFalse(content.contains("User #8"));
- Assertions.assertFalse(content.contains("User #9"));
- Assertions.assertFalse(content.contains("User #10"));
+ assertTrue(content.contains("User #1"));
+ assertTrue(content.contains("User #2"));
+ assertTrue(content.contains("User #3"));
+ assertTrue(content.contains("User #4"));
+ assertTrue(content.contains("User #5"));
+ assertTrue(content.contains("User #6"));
+ assertTrue(content.contains("User #7"));
+ assertFalse(content.contains("User #0"));
+ assertFalse(content.contains("User #8"));
+ assertFalse(content.contains("User #9"));
+ assertFalse(content.contains("User #10"));
}
-
+
@Test
@SuppressWarnings("unchecked")
- public void testInvokeModelStep_2() throws IOException
+ void invokeModelStep2() throws Exception
{
final List values = Arrays.asList("User #0", "User #1", "User #2", "User #3", "User #4", "User #5", "User #6", "User #7", "User #8", "User #9", "User #10");
IterationBean iterationBean = new IterationBean(1, 7, 2, values);
@@ -740,7 +739,7 @@ public void testInvokeModelStep_2() throws IOException
vdl.buildView(facesContext, root, "ui_repeat_model_step.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -751,22 +750,22 @@ public void testInvokeModelStep_2() throws IOException
String content = fw.toString();
- Assertions.assertTrue(content.contains("User #1"));
- Assertions.assertTrue(content.contains("User #3"));
- Assertions.assertTrue(content.contains("User #5"));
- Assertions.assertTrue(content.contains("User #7"));
- Assertions.assertFalse(content.contains("User #0"));
- Assertions.assertFalse(content.contains("User #2"));
- Assertions.assertFalse(content.contains("User #4"));
- Assertions.assertFalse(content.contains("User #6"));
- Assertions.assertFalse(content.contains("User #8"));
- Assertions.assertFalse(content.contains("User #9"));
- Assertions.assertFalse(content.contains("User #10"));
+ assertTrue(content.contains("User #1"));
+ assertTrue(content.contains("User #3"));
+ assertTrue(content.contains("User #5"));
+ assertTrue(content.contains("User #7"));
+ assertFalse(content.contains("User #0"));
+ assertFalse(content.contains("User #2"));
+ assertFalse(content.contains("User #4"));
+ assertFalse(content.contains("User #6"));
+ assertFalse(content.contains("User #8"));
+ assertFalse(content.contains("User #9"));
+ assertFalse(content.contains("User #10"));
}
-
+
@Test
@SuppressWarnings("unchecked")
- public void testInvokeModelStep_3() throws IOException
+ void invokeModelStep3() throws Exception
{
final List values = Arrays.asList("User #0", "User #1", "User #2", "User #3", "User #4", "User #5", "User #6", "User #7", "User #8", "User #9", "User #10");
IterationBean iterationBean = new IterationBean(2, 7, 3, values);
@@ -775,7 +774,7 @@ public void testInvokeModelStep_3() throws IOException
vdl.buildView(facesContext, root, "ui_repeat_model_step.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -786,22 +785,22 @@ public void testInvokeModelStep_3() throws IOException
String content = fw.toString();
- Assertions.assertTrue(content.contains("User #2"));
- Assertions.assertTrue(content.contains("User #5"));
- Assertions.assertFalse(content.contains("User #0"));
- Assertions.assertFalse(content.contains("User #1"));
- Assertions.assertFalse(content.contains("User #3"));
- Assertions.assertFalse(content.contains("User #4"));
- Assertions.assertFalse(content.contains("User #6"));
- Assertions.assertFalse(content.contains("User #7"));
- Assertions.assertFalse(content.contains("User #8"));
- Assertions.assertFalse(content.contains("User #9"));
- Assertions.assertFalse(content.contains("User #10"));
+ assertTrue(content.contains("User #2"));
+ assertTrue(content.contains("User #5"));
+ assertFalse(content.contains("User #0"));
+ assertFalse(content.contains("User #1"));
+ assertFalse(content.contains("User #3"));
+ assertFalse(content.contains("User #4"));
+ assertFalse(content.contains("User #6"));
+ assertFalse(content.contains("User #7"));
+ assertFalse(content.contains("User #8"));
+ assertFalse(content.contains("User #9"));
+ assertFalse(content.contains("User #10"));
}
@Test
@SuppressWarnings("unchecked")
- public void testInvokeModelChangeStep_3() throws IOException
+ void invokeModelChangeStep3() throws Exception
{
final List values = Arrays.asList("User #0", "User #1", "User #2", "User #3", "User #4", "User #5", "User #6", "User #7", "User #8", "User #9", "User #10");
IterationBean iterationBean = new IterationBean(2, 7, 3, values);
@@ -810,7 +809,7 @@ public void testInvokeModelChangeStep_3() throws IOException
vdl.buildView(facesContext, root, "ui_repeat_model_step.xhtml");
UIRepeat repeat = (UIRepeat) root.findComponent("form:repeat");
- Assertions.assertNotNull(repeat);
+ assertNotNull(repeat);
FastWriter fw = new FastWriter();
ResponseWriter rw = facesContext.getResponseWriter();
@@ -821,18 +820,18 @@ public void testInvokeModelChangeStep_3() throws IOException
String content = fw.toString();
- Assertions.assertTrue(content.contains("User #2"));
- Assertions.assertTrue(content.contains("User #5"));
-
- Assertions.assertFalse(content.contains("User #0"));
- Assertions.assertFalse(content.contains("User #1"));
- Assertions.assertFalse(content.contains("User #3"));
- Assertions.assertFalse(content.contains("User #4"));
- Assertions.assertFalse(content.contains("User #6"));
- Assertions.assertFalse(content.contains("User #7"));
- Assertions.assertFalse(content.contains("User #8"));
- Assertions.assertFalse(content.contains("User #9"));
- Assertions.assertFalse(content.contains("User #10"));
+ assertTrue(content.contains("User #2"));
+ assertTrue(content.contains("User #5"));
+
+ assertFalse(content.contains("User #0"));
+ assertFalse(content.contains("User #1"));
+ assertFalse(content.contains("User #3"));
+ assertFalse(content.contains("User #4"));
+ assertFalse(content.contains("User #6"));
+ assertFalse(content.contains("User #7"));
+ assertFalse(content.contains("User #8"));
+ assertFalse(content.contains("User #9"));
+ assertFalse(content.contains("User #10"));
}
public class IterationBean {
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java
index be13dffec3..747661933d 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java
@@ -18,13 +18,14 @@
*/
package org.apache.myfaces.view.facelets.tag.ui;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.context.ResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.util.lang.FastWriter;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -34,7 +35,7 @@
* @author Jakob Korherr (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class TemplateTestCase extends AbstractFaceletTestCase
+class TemplateTestCase extends AbstractFaceletTestCase
{
private FastWriter _writer;
@@ -66,7 +67,7 @@ public void tearDown() throws Exception
* @throws Exception
*/
@Test
- public void testInsertWithoutNameComposition() throws Exception
+ void insertWithoutNameComposition() throws Exception
{
_testInsertWithoutName("s_page_composition.xhtml");
}
@@ -77,7 +78,7 @@ public void testInsertWithoutNameComposition() throws Exception
* @throws Exception
*/
@Test
- public void testInsertWithoutNameDecorate() throws Exception
+ void insertWithoutNameDecorate() throws Exception
{
_testInsertWithoutName("s_page_decorate.xhtml");
}
@@ -92,8 +93,8 @@ private void _testInsertWithoutName(String page) throws Exception
final String output = _writer.toString();
// assertions
- Assertions.assertTrue(output.contains("BODY"));
- Assertions.assertTrue(output.contains(""));
+ assertTrue(output.contains("BODY"));
+ assertTrue(output.contains(""));
}
/**
@@ -102,7 +103,7 @@ private void _testInsertWithoutName(String page) throws Exception
* @throws Exception
*/
@Test
- public void testInsertWithDefinedNameDecorate() throws Exception
+ void insertWithDefinedNameDecorate() throws Exception
{
_testInsertWithDefinedName("decorate_with_template_and_define.xhtml");
}
@@ -113,7 +114,7 @@ public void testInsertWithDefinedNameDecorate() throws Exception
* @throws Exception
*/
@Test
- public void testInsertWithDefinedNameComposition() throws Exception
+ void insertWithDefinedNameComposition() throws Exception
{
_testInsertWithDefinedName("composition_with_template_and_define.xhtml");
}
@@ -128,7 +129,7 @@ private void _testInsertWithDefinedName(String page) throws Exception
final String output = _writer.toString();
// assertions
- Assertions.assertTrue(output.contains("defined content"));
+ assertTrue(output.contains("defined content"));
}
/**
@@ -138,7 +139,7 @@ private void _testInsertWithDefinedName(String page) throws Exception
* @throws Exception
*/
@Test
- public void testInsertWithoutDefinedNameDecorate() throws Exception
+ void insertWithoutDefinedNameDecorate() throws Exception
{
_testInsertWithoutDefinedName("decorate_with_template.xhtml");
}
@@ -150,7 +151,7 @@ public void testInsertWithoutDefinedNameDecorate() throws Exception
* @throws Exception
*/
@Test
- public void testInsertWithoutDefinedNameComposition() throws Exception
+ void insertWithoutDefinedNameComposition() throws Exception
{
_testInsertWithoutDefinedName("composition_with_template.xhtml");
}
@@ -165,7 +166,7 @@ private void _testInsertWithoutDefinedName(String page) throws Exception
final String output = _writer.toString();
// assertions
- Assertions.assertTrue(output
+ assertTrue(output
.contains("default ui:insert content"));
}
@@ -177,7 +178,7 @@ private void _testInsertWithoutDefinedName(String page) throws Exception
* @throws Exception
*/
@Test
- public void _testMultilevelTemplating() throws Exception
+ void _testMultilevelTemplating() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,
@@ -189,7 +190,7 @@ public void _testMultilevelTemplating() throws Exception
output = output.replaceAll("(?s)", ""); // remove license headers for clarity
// assertions
- Assertions.assertTrue(output.contains("inner content"));
+ assertTrue(output.contains("inner content"));
}
/**
@@ -201,7 +202,7 @@ public void _testMultilevelTemplating() throws Exception
* @throws Exception
*/
@Test
- public void _testMultilevelTemplatingInnerFallback() throws Exception
+ void _testMultilevelTemplatingInnerFallback() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,
@@ -213,7 +214,7 @@ public void _testMultilevelTemplatingInnerFallback() throws Exception
output = output.replaceAll("(?s)", ""); // remove license headers for clarity
// assertions
- Assertions.assertTrue(output
+ assertTrue(output
.contains("inner fallback content"));
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java
index 1a12fd5d02..5a3587d652 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.view.facelets.tag.ui;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.application.ViewHandler;
import jakarta.faces.component.UIOutput;
@@ -29,10 +32,9 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
import org.apache.myfaces.util.lang.FastWriter;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestUserTags extends AbstractFaceletTestCase {
+class TestUserTags extends AbstractFaceletTestCase {
@Override
protected void setUpServletObjects() throws Exception
@@ -70,9 +72,9 @@ protected void setupRenderers() throws Exception
renderKit.addRenderer(UIOutput.COMPONENT_FAMILY,
"jakarta.faces.Text", new HtmlTextRenderer());
}
-
+
@Test
- public void testClientClient() throws Exception {
+ void clientClient() throws Exception {
request.setAttribute("test", "foo");
UIViewRoot root = facesContext.getViewRoot();
@@ -91,7 +93,7 @@ public void testClientClient() throws Exception {
* @throws Exception
*/
@Test
- public void testUserTag1() throws Exception
+ void userTag1() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "usertagtest1.xhtml");
@@ -104,18 +106,18 @@ public void testUserTag1() throws Exception
rw.flush();
String result = fw.toString();
- Assertions.assertTrue(result.contains("value1"));
- Assertions.assertFalse(result.contains("value2"));
- Assertions.assertFalse(result.contains("value3"));
+ assertTrue(result.contains("value1"));
+ assertFalse(result.contains("value2"));
+ assertFalse(result.contains("value3"));
}
-
+
/**
* Attributes should not pass to other user tags if they are not declared explicitly.
*
* @throws Exception
*/
@Test
- public void testUserTag2() throws Exception
+ void userTag2() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "usertagtest2.xhtml");
@@ -128,8 +130,8 @@ public void testUserTag2() throws Exception
rw.flush();
String result = fw.toString();
- Assertions.assertTrue(result.contains("value2"));
- Assertions.assertFalse(result.contains("value3"));
- Assertions.assertFalse(result.contains("value1"));
+ assertTrue(result.contains("value2"));
+ assertFalse(result.contains("value3"));
+ assertFalse(result.contains("value1"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java
index 98ab00f365..c82a85a7da 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.ui;
+import static org.junit.jupiter.api.Assertions.*;
+
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;
@@ -26,10 +28,9 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class UITestCase extends AbstractFaceletTestCase
+class UITestCase extends AbstractFaceletTestCase
{
@Override
@@ -52,7 +53,7 @@ protected void setupRenderers() throws Exception
}
@Test
- public void testRelativePaths() throws Exception
+ void relativePaths() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "parent.xml");
@@ -62,8 +63,8 @@ public void testRelativePaths() throws Exception
facesContext.setResponseWriter(mrw);
root.encodeAll(facesContext);
sw.flush();
-
- Assertions.assertTrue(sw.toString().equals("Hello World!"));
+
+ assertEquals("Hello World!", sw.toString());
//System.out.println("************************");
//System.out.println(sw.toString());
@@ -71,7 +72,7 @@ public void testRelativePaths() throws Exception
}
@Test
- public void testCompositionTemplate() throws Exception
+ void compositionTemplate() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "composition-template.xml");
@@ -84,12 +85,12 @@ public void testCompositionTemplate() throws Exception
String response = sw.toString();
- Assertions.assertTrue(response.contains("New Title"));
- Assertions.assertTrue(response.contains("New Body"));
+ assertTrue(response.contains("New Title"));
+ assertTrue(response.contains("New Body"));
}
@Test
- public void testCompositionTemplateSimple() throws Exception
+ void compositionTemplateSimple() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "composition-template-simple.xml");
@@ -102,11 +103,11 @@ public void testCompositionTemplateSimple() throws Exception
String response = sw.toString();
- Assertions.assertTrue(response.contains("New Body"));
+ assertTrue(response.contains("New Body"));
}
@Test
- public void testComponent() throws Exception
+ void component() throws Exception
{
Map map = new HashMap();
facesContext.getExternalContext().getRequestMap().put("map", map);
@@ -114,8 +115,8 @@ public void testComponent() throws Exception
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "component.xml");
- Assertions.assertEquals(1, root.getChildCount());
- Assertions.assertNotNull(map.get("c"));
+ assertEquals(1, root.getChildCount());
+ assertNotNull(map.get("c"));
}
/*
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/CompositionTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/CompositionTestCase.java
index 8d5557ae14..288e5874b2 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/CompositionTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/CompositionTestCase.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.view.facelets.tag.ui.template;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.faces.application.ViewHandler;
@@ -25,10 +28,9 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CompositionTestCase extends AbstractFaceletTestCase {
+class CompositionTestCase extends AbstractFaceletTestCase {
@Override
protected void setUpServletObjects() throws Exception
@@ -43,7 +45,7 @@ protected void setUpServletObjects() throws Exception
* @throws Exception
*/
@Test
- public void testCompositionTrimEffect() throws Exception {
+ void compositionTrimEffect() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "compositionTrim.xhtml");
@@ -54,8 +56,8 @@ public void testCompositionTrimEffect() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
- Assertions.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+ assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
}
/**
@@ -68,7 +70,7 @@ public void testCompositionTrimEffect() throws Exception {
* @throws Exception
*/
@Test
- public void testComposition1() throws Exception {
+ void composition1() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "composition1.xhtml");
@@ -79,10 +81,10 @@ public void testComposition1() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("fragmentNumber1"));
- Assertions.assertTrue(response.contains("compositionContent"));
- Assertions.assertFalse(response.contains("This fragment will not be inserted"));
- Assertions.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+ assertTrue(response.contains("fragmentNumber1"));
+ assertTrue(response.contains("compositionContent"));
+ assertFalse(response.contains("This fragment will not be inserted"));
+ assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
}
/**
@@ -92,7 +94,7 @@ public void testComposition1() throws Exception {
* @throws Exception
*/
@Test
- public void testComposition2EmptyComposition() throws Exception {
+ void composition2EmptyComposition() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "composition2.xhtml");
@@ -103,10 +105,10 @@ public void testComposition2EmptyComposition() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertFalse(response.contains("This fragment will not be inserted"));
- Assertions.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+ assertFalse(response.contains("This fragment will not be inserted"));
+ assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
}
-
+
/**
* An empty ui:composition does not means the content of a ui:insert without
* name to be rendered
@@ -114,7 +116,7 @@ public void testComposition2EmptyComposition() throws Exception {
* @throws Exception
*/
@Test
- public void testComposition3EmptyComposition() throws Exception {
+ void composition3EmptyComposition() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "composition3.xhtml");
@@ -125,17 +127,17 @@ public void testComposition3EmptyComposition() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertFalse(response.contains("This fragment will not be inserted"));
- Assertions.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+ assertFalse(response.contains("This fragment will not be inserted"));
+ assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
}
-
+
/**
* A ui:define takes precedence over a ui:insert
*
* @throws Exception
*/
@Test
- public void testComposition4DefineOverInsert() throws Exception {
+ void composition4DefineOverInsert() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "composition4.xhtml");
@@ -146,11 +148,11 @@ public void testComposition4DefineOverInsert() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("fragmentNumber1"));
- Assertions.assertFalse(response.contains("This fragment will not be inserted"));
- Assertions.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+ assertTrue(response.contains("fragmentNumber1"));
+ assertFalse(response.contains("This fragment will not be inserted"));
+ assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
}
-
+
/**
* A ui:insert on nested composition takes the top TemplateClient.
*
@@ -160,7 +162,7 @@ public void testComposition4DefineOverInsert() throws Exception {
* @throws Exception
*/
@Test
- public void testComposition5() throws Exception {
+ void composition5() throws Exception {
/*
composition5.xhtml
@@ -201,7 +203,7 @@ public void testComposition5() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+ assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
response = checkStringInOrder(response, "start second composition");
response = checkStringInOrder(response, "composition5Content");
@@ -211,11 +213,11 @@ public void testComposition5() throws Exception {
private String checkStringInOrder(String response, String token)
{
int pos = response.indexOf(token);
- Assertions.assertTrue(pos > -1);
+ assertTrue(pos > -1);
return response.substring(pos+token.length());
}
-
-
+
+
/**
* An ui:define on the outer most composition takes precedence over
* the inner one.
@@ -223,7 +225,7 @@ private String checkStringInOrder(String response, String token)
* @throws Exception
*/
@Test
- public void testCompositionNested1() throws Exception {
+ void compositionNested1() throws Exception {
/*
compositionNested1.xhtml
@@ -269,14 +271,14 @@ public void testCompositionNested1() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("fragmentNumber2"));
- Assertions.assertFalse(response.contains("fragmentNumber1"));
- Assertions.assertFalse(response.contains("This fragment will not be inserted"));
- Assertions.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+ assertTrue(response.contains("fragmentNumber2"));
+ assertFalse(response.contains("fragmentNumber1"));
+ assertFalse(response.contains("This fragment will not be inserted"));
+ assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
}
-
+
@Test
- public void testCompositionNested2() throws Exception
+ void compositionNested2() throws Exception
{
/*
@@ -331,7 +333,7 @@ public void testCompositionNested2() throws Exception
sw.flush();
String response = sw.toString();
- Assertions.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+ assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
response = checkStringInOrder(response, "start first decoration");
response = checkStringInOrder(response, "start second composition");
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/DecorateTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/DecorateTestCase.java
index 1737fe9b8c..afd371e76e 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/DecorateTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/DecorateTestCase.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.view.facelets.tag.ui.template;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.faces.application.ViewHandler;
@@ -25,10 +28,9 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class DecorateTestCase extends AbstractFaceletTestCase {
+class DecorateTestCase extends AbstractFaceletTestCase {
@Override
protected void setUpServletObjects() throws Exception
@@ -38,7 +40,7 @@ protected void setUpServletObjects() throws Exception
}
@Test
- public void testDecorate1() throws Exception {
+ void decorate1() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "decorate1.xhtml");
@@ -49,15 +51,15 @@ public void testDecorate1() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("fragmentNumber1"));
- Assertions.assertTrue(response.contains("decorateContent"));
- Assertions.assertFalse(response.contains("This fragment will not be inserted"));
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+ assertTrue(response.contains("fragmentNumber1"));
+ assertTrue(response.contains("decorateContent"));
+ assertFalse(response.contains("This fragment will not be inserted"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
}
-
+
@Test
- public void testDecorate2EmptyDecorate() throws Exception {
+ void decorate2EmptyDecorate() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "decorate2.xhtml");
@@ -68,13 +70,13 @@ public void testDecorate2EmptyDecorate() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertFalse(response.contains("This fragment will not be inserted"));
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+ assertFalse(response.contains("This fragment will not be inserted"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
}
-
+
@Test
- public void testDecorate3EmptyDecorate() throws Exception {
+ void decorate3EmptyDecorate() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "decorate3.xhtml");
@@ -85,13 +87,13 @@ public void testDecorate3EmptyDecorate() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertFalse(response.contains("This fragment will not be inserted"));
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+ assertFalse(response.contains("This fragment will not be inserted"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
}
-
+
@Test
- public void testDecorate4DefineOverInsert() throws Exception {
+ void decorate4DefineOverInsert() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "decorate4.xhtml");
@@ -102,12 +104,12 @@ public void testDecorate4DefineOverInsert() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("fragmentNumber1"));
- Assertions.assertFalse(response.contains("This fragment will not be inserted"));
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+ assertTrue(response.contains("fragmentNumber1"));
+ assertFalse(response.contains("This fragment will not be inserted"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
}
-
+
/**
* Based on
*
@@ -122,7 +124,7 @@ public void testDecorate4DefineOverInsert() throws Exception {
* @throws Exception
*/
@Test
- public void testDecorate5() throws Exception
+ void decorate5() throws Exception
{
/*
decorate5.xhtml
@@ -173,8 +175,8 @@ public void testDecorate5() throws Exception
String response = sw.toString();
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
response = checkStringInOrder(response, "start first decoration");
response = checkStringInOrder(response, "start second decoration");
@@ -188,7 +190,7 @@ public void testDecorate5() throws Exception
private String checkStringInOrder(String response, String token)
{
int pos = response.indexOf(token);
- Assertions.assertTrue(pos > -1);
+ assertTrue(pos > -1);
return response.substring(pos+token.length());
}
@@ -199,7 +201,7 @@ private String checkStringInOrder(String response, String token)
* @throws Exception
*/
@Test
- public void testDecorateNested1() throws Exception {
+ void decorateNested1() throws Exception {
/*
decorate4.xhtml
@@ -246,17 +248,17 @@ public void testDecorateNested1() throws Exception {
sw.flush();
String response = sw.toString();
- Assertions.assertTrue(response.contains("fragmentNumber3"));
- Assertions.assertTrue(response.contains("fragmentNumber2"));
- Assertions.assertFalse(response.contains("fragmentNumber1"));
- Assertions.assertFalse(response.contains("This fragment will not be inserted"));
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
- Assertions.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+ assertTrue(response.contains("fragmentNumber3"));
+ assertTrue(response.contains("fragmentNumber2"));
+ assertFalse(response.contains("fragmentNumber1"));
+ assertFalse(response.contains("This fragment will not be inserted"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+ assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
}
-
-
+
+
@Test
- public void testDecorateNested2() throws Exception
+ void decorateNested2() throws Exception
{
/*
decorateNested2.xhtml
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/IncludeTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/IncludeTestCase.java
index 26bfbca1f4..53120a1c29 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/IncludeTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/IncludeTestCase.java
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.tag.ui.template;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.faces.application.ViewHandler;
@@ -25,10 +27,9 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class IncludeTestCase extends AbstractFaceletTestCase
+class IncludeTestCase extends AbstractFaceletTestCase
{
@Override
@@ -37,9 +38,9 @@ protected void setUpServletObjects() throws Exception
super.setUpServletObjects();
servletContext.addInitParameter(ViewHandler.FACELETS_SKIP_COMMENTS_PARAM_NAME, "true");
}
-
+
@Test
- public void testIncludeIsolation1() throws Exception {
+ void includeIsolation1() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "includeIsolation1.xhtml");
@@ -51,7 +52,7 @@ public void testIncludeIsolation1() throws Exception {
String response = sw.toString();
- Assertions.assertTrue(response.contains("Do you see me?"));
+ assertTrue(response.contains("Do you see me?"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/UserTagTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/UserTagTestCase.java
index ec8d106181..4c099bd88f 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/UserTagTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/UserTagTestCase.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.view.facelets.tag.ui.template;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.StringWriter;
import jakarta.faces.application.ViewHandler;
@@ -25,10 +28,9 @@
import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.AbstractFaceletTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class UserTagTestCase extends AbstractFaceletTestCase
+class UserTagTestCase extends AbstractFaceletTestCase
{
@Override
@@ -38,9 +40,9 @@ protected void setUpServletObjects() throws Exception
servletContext.addInitParameter(ViewHandler.FACELETS_SKIP_COMMENTS_PARAM_NAME, "true");
servletContext.addInitParameter(ViewHandler.FACELETS_LIBRARIES_PARAM_NAME, "/user.taglib.xml");
}
-
+
@Test
- public void testUserTag1() throws Exception {
+ void userTag1() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "userTagTest1.xhtml");
@@ -53,11 +55,11 @@ public void testUserTag1() throws Exception {
String response = sw.toString();
- Assertions.assertTrue(response.contains("Do you see me?"));
+ assertTrue(response.contains("Do you see me?"));
}
@Test
- public void testUserTag2() throws Exception {
+ void userTag2() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "userTagTest2.xhtml");
@@ -70,12 +72,12 @@ public void testUserTag2() throws Exception {
String response = sw.toString();
- Assertions.assertTrue(response.contains("Do you see me?"));
- Assertions.assertFalse(response.contains("This text should not be rendered"));
+ assertTrue(response.contains("Do you see me?"));
+ assertFalse(response.contains("This text should not be rendered"));
}
-
+
@Test
- public void testUserTag3() throws Exception {
+ void userTag3() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "userTagTest3.xhtml");
@@ -88,12 +90,12 @@ public void testUserTag3() throws Exception {
String response = sw.toString();
- Assertions.assertTrue(response.contains("Do you see me?"));
- Assertions.assertFalse(response.contains("This text should not be rendered"));
+ assertTrue(response.contains("Do you see me?"));
+ assertFalse(response.contains("This text should not be rendered"));
}
-
+
@Test
- public void testUserTag4() throws Exception {
+ void userTag4() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "userTagTest4.xhtml");
@@ -106,12 +108,12 @@ public void testUserTag4() throws Exception {
String response = sw.toString();
- Assertions.assertTrue(response.contains("Do you see me?"));
- Assertions.assertFalse(response.contains("This text should not be rendered"));
+ assertTrue(response.contains("Do you see me?"));
+ assertFalse(response.contains("This text should not be rendered"));
}
-
+
@Test
- public void testUserTag5() throws Exception {
+ void userTag5() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "userTagTest5.xhtml");
@@ -124,12 +126,12 @@ public void testUserTag5() throws Exception {
String response = sw.toString();
- Assertions.assertTrue(response.contains("Do you see me?"));
- Assertions.assertFalse(response.contains("This text should not be rendered"));
+ assertTrue(response.contains("Do you see me?"));
+ assertFalse(response.contains("This text should not be rendered"));
}
@Test
- public void testUserTag6() throws Exception {
+ void userTag6() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "userTagTest6.xhtml");
@@ -142,12 +144,12 @@ public void testUserTag6() throws Exception {
String response = sw.toString();
- Assertions.assertTrue(response.contains("Do you see me?"));
- Assertions.assertFalse(response.contains("This text should not be rendered"));
+ assertTrue(response.contains("Do you see me?"));
+ assertFalse(response.contains("This text should not be rendered"));
}
-
+
@Test
- public void testUserTag7() throws Exception {
+ void userTag7() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "userTagTest7.xhtml");
@@ -160,12 +162,12 @@ public void testUserTag7() throws Exception {
String response = sw.toString();
- Assertions.assertTrue(response.contains("Do you see me?"));
- Assertions.assertFalse(response.contains("This text should not be rendered"));
+ assertTrue(response.contains("Do you see me?"));
+ assertFalse(response.contains("This text should not be rendered"));
}
-
+
@Test
- public void testUserTag8() throws Exception {
+ void userTag8() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "userTagTest8.xhtml");
@@ -178,7 +180,7 @@ public void testUserTag8() throws Exception {
String response = sw.toString();
- Assertions.assertTrue(response.contains("Do you see me?"));
- Assertions.assertFalse(response.contains("This text should not be rendered"));
+ assertTrue(response.contains("Do you see me?"));
+ assertFalse(response.contains("This text should not be rendered"));
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/FacesComponentAnnotationMyFacesRequestTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/FacesComponentAnnotationMyFacesRequestTestCase.java
index 654f9650b6..2e9a3d9a41 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/FacesComponentAnnotationMyFacesRequestTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/FacesComponentAnnotationMyFacesRequestTestCase.java
@@ -18,16 +18,17 @@
*/
package org.apache.myfaces.view.facelets.test.component;
+import static org.junit.jupiter.api.Assertions.*;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.application.StateManager;
import jakarta.faces.component.UIComponent;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
-import org.junit.jupiter.api.Assertions;
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.test.core.AbstractMyFacesRequestTestCase;
import org.junit.jupiter.api.Test;
-public class FacesComponentAnnotationMyFacesRequestTestCase extends AbstractMyFacesCDIRequestTestCase
+class FacesComponentAnnotationMyFacesRequestTestCase extends AbstractMyFacesCDIRequestTestCase
{
@Override
protected void setUpWebConfigParams() throws Exception
@@ -41,67 +42,67 @@ protected void setUpWebConfigParams() throws Exception
protected ExpressionFactory createExpressionFactory()
{
return new org.apache.el.ExpressionFactoryImpl();
- }
-
+ }
+
@Test
- public void testUIPanel1() throws Exception
+ void uIPanel1() throws Exception
{
startViewRequest("/testMyUIPanel1.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("panel1");
- Assertions.assertNotNull(comp);
- Assertions.assertTrue(comp instanceof MyUIPanel1);
+ assertNotNull(comp);
+ assertInstanceOf(MyUIPanel1.class, comp);
endRequest();
- }
+ }
@Test
- public void testUIPanel2() throws Exception
+ void uIPanel2() throws Exception
{
startViewRequest("/testMyUIPanel2.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("panel1");
- Assertions.assertNotNull(comp);
- Assertions.assertTrue(comp instanceof MyUIPanel2);
+ assertNotNull(comp);
+ assertInstanceOf(MyUIPanel2.class, comp);
endRequest();
}
-
+
@Test
- public void testUIPanel3() throws Exception
+ void uIPanel3() throws Exception
{
startViewRequest("/testMyUIPanel3.xhtml");
processLifecycleExecuteAndRender();
UIComponent comp = facesContext.getViewRoot().findComponent("panel3");
- Assertions.assertNotNull(comp);
- Assertions.assertTrue(comp instanceof MyUIPanel3);
+ assertNotNull(comp);
+ assertInstanceOf(MyUIPanel3.class, comp);
// Check component type
MyUIPanel3 comp2 = (MyUIPanel3)
facesContext.getApplication().createComponent("myUIPanel3");
- Assertions.assertNotNull(comp2);
+ assertNotNull(comp2);
endRequest();
}
-
+
// Test for MYFACES-4003
@Test
- public void testInputTextWithClass() throws Exception
+ void inputTextWithClass() throws Exception
{
startViewRequest("/testClassAttribute.xhtml");
processLifecycleExecuteAndRender();
UIComponent jsfInputText = facesContext.getViewRoot().findComponent("form:JSF_inputText");
- Assertions.assertNotNull(jsfInputText);
- Assertions.assertEquals("TEST", jsfInputText.getAttributes().get("styleClass"));
+ assertNotNull(jsfInputText);
+ assertEquals("TEST", jsfInputText.getAttributes().get("styleClass"));
// The "class" attribute should have been mapped to a "styleClass" attribute
UIComponent testInputText = facesContext.getViewRoot().findComponent("form:test_inputText");
- Assertions.assertNotNull(testInputText);
- Assertions.assertEquals("TEST", testInputText.getAttributes().get("styleClass"));
+ assertNotNull(testInputText);
+ assertEquals("TEST", testInputText.getAttributes().get("styleClass"));
endRequest();
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/UpdateHeadDynamicViewTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/UpdateHeadDynamicViewTestCase.java
index 53f7958e90..f7bc50c965 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/UpdateHeadDynamicViewTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/UpdateHeadDynamicViewTestCase.java
@@ -18,16 +18,18 @@
*/
package org.apache.myfaces.view.facelets.updateheadres;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import jakarta.faces.application.StateManager;
import jakarta.faces.component.UICommand;
import jakarta.faces.component.UIComponent;
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class UpdateHeadDynamicViewTestCase extends AbstractMyFacesCDIRequestTestCase
+class UpdateHeadDynamicViewTestCase extends AbstractMyFacesCDIRequestTestCase
{
@Override
@@ -38,9 +40,9 @@ protected void setUpWebConfigParams() throws Exception
servletContext.addInitParameter(StateManager.STATE_SAVING_METHOD_PARAM_NAME, StateManager.StateSavingMethod.CLIENT.name());
servletContext.addInitParameter(MyfacesConfig.REFRESH_TRANSIENT_BUILD_ON_PSS, "auto");
}
-
+
@Test
- public void testNoUpdateScript1Head() throws Exception
+ void noUpdateScript1Head() throws Exception
{
startViewRequest("/ajaxContent.xhtml");
processLifecycleExecuteAndRender();
@@ -53,13 +55,13 @@ public void testNoUpdateScript1Head() throws Exception
processLifecycleExecuteAndRender();
String text = getRenderedContent(facesContext);
// the inclusion should trigger update head
- Assertions.assertFalse(text.contains("update id=\"jakarta.faces.ViewHead\""));
+ assertFalse(text.contains("update id=\"jakarta.faces.ViewHead\""));
//System.out.println(text);
endRequest();
}
-
+
@Test
- public void testUpdateScript2Head() throws Exception
+ void updateScript2Head() throws Exception
{
startViewRequest("/ajaxContent.xhtml");
processLifecycleExecuteAndRender();
@@ -73,14 +75,14 @@ public void testUpdateScript2Head() throws Exception
String text = getRenderedContent(facesContext);
// the inclusion should trigger update head
- Assertions.assertTrue(text.contains("update id=\"jakarta.faces.Resource\""));
- Assertions.assertTrue(text.contains("alert(\"script2\");"));
+ assertTrue(text.contains("update id=\"jakarta.faces.Resource\""));
+ assertTrue(text.contains("alert(\"script2\");"));
//System.out.println(text);
endRequest();
}
-
+
@Test
- public void testUpdateScript3Head() throws Exception
+ void updateScript3Head() throws Exception
{
startViewRequest("/ajaxContent.xhtml");
processLifecycleExecuteAndRender();
@@ -94,10 +96,10 @@ public void testUpdateScript3Head() throws Exception
String text = getRenderedContent(facesContext);
// the inclusion should trigger update head
- Assertions.assertTrue(text.contains("update id=\"jakarta.faces.Resource\""));
- Assertions.assertTrue(text.contains("alert(\"script3\");"));
+ assertTrue(text.contains("update id=\"jakarta.faces.Resource\""));
+ assertTrue(text.contains("alert(\"script3\");"));
// MYFACES-4681 - HTML5 is default output mode, so the type attribute is unnecessary
- Assertions.assertTrue(text.contains("link rel=\"stylesheet\" href=\"/test/faces/jakarta.faces.resource/style3.css\""));
+ assertTrue(text.contains("link rel=\"stylesheet\" href=\"/test/faces/jakarta.faces.resource/style3.css\""));
//System.out.println(text);
endRequest();
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/util/ClasspathTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/util/ClasspathTest.java
index 45b7d37e32..28b333f0e3 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/util/ClasspathTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/util/ClasspathTest.java
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.view.facelets.util;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -38,7 +41,6 @@
import org.apache.myfaces.config.MetaInfResourceCache;
import org.apache.myfaces.test.mock.MockExternalContext;
import org.apache.myfaces.test.mock.MockServletContext;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -46,12 +48,12 @@
* META-INF/ URL is neither a JarURLConnection nor a directory on disk, so its entries are read as a zip
* stream whose entry names are relative to the URL it was opened on - not to a classpath root.
*/
-public class ClasspathTest
+class ClasspathTest
{
private static final String JAR = "vfstest:/content/app.war/WEB-INF/lib/custom.jar/";
@Test
- public void testStreamEntriesRelativeToMetaInf() throws Exception
+ void streamEntriesRelativeToMetaInf() throws Exception
{
// opening META-INF/ itself yields its children (like VFS does for a directory)
Map streams = new HashMap<>();
@@ -65,7 +67,7 @@ public void testStreamEntriesRelativeToMetaInf() throws Exception
}
@Test
- public void testStreamEntriesRelativeToJarRoot() throws Exception
+ void streamEntriesRelativeToJarRoot() throws Exception
{
// META-INF/ cannot be read as a zip, the scan falls back to the enclosing jar
Map streams = new HashMap<>();
@@ -75,11 +77,11 @@ public void testStreamEntriesRelativeToJarRoot() throws Exception
new VfsClassLoader(streams, JAR + "META-INF/"), "META-INF/");
assertContains(entries, JAR + "META-INF/custom.taglib.xml");
- Assertions.assertEquals(1, entries.getUrls().size(), entries.getUrls().toString());
+ assertEquals(1, entries.getUrls().size(), entries.getUrls().toString());
}
@Test
- public void testFindResourcesViaMetaInfResourceCache() throws Exception
+ void findResourcesViaMetaInfResourceCache() throws Exception
{
// the path the taglib / faces-config providers take: filter the cached scan by suffix
Map streams = new HashMap<>();
@@ -92,12 +94,12 @@ public void testFindResourcesViaMetaInfResourceCache() throws Exception
ExternalContext context = new MockExternalContext(new MockServletContext(), null, null);
Collection taglibs = MetaInfResourceCache.findResources(context, ".taglib.xml");
- Assertions.assertEquals(1, taglibs.size(), taglibs.toString());
- Assertions.assertEquals(JAR + "META-INF/custom.taglib.xml", taglibs.iterator().next().toExternalForm());
+ assertEquals(1, taglibs.size(), taglibs.toString());
+ assertEquals(JAR + "META-INF/custom.taglib.xml", taglibs.iterator().next().toExternalForm());
Collection configs = MetaInfResourceCache.findResources(context, ".faces-config.xml");
- Assertions.assertEquals(1, configs.size(), configs.toString());
- Assertions.assertEquals(JAR + "META-INF/custom.faces-config.xml",
+ assertEquals(1, configs.size(), configs.toString());
+ assertEquals(JAR + "META-INF/custom.faces-config.xml",
configs.iterator().next().toExternalForm());
}
finally
@@ -108,7 +110,7 @@ public void testFindResourcesViaMetaInfResourceCache() throws Exception
private static void assertContains(Classpath.ResourceEntries entries, String url)
{
- Assertions.assertTrue(entries.getUrls().stream().anyMatch(u -> u.toExternalForm().equals(url)),
+ assertTrue(entries.getUrls().stream().anyMatch(u -> u.toExternalForm().equals(url)),
url + " not found in " + entries.getUrls() + " / " + entries.getNames());
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/util/FastWriterTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/util/FastWriterTest.java
index e085bcf523..e6171128a0 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/util/FastWriterTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/util/FastWriterTest.java
@@ -19,14 +19,16 @@
package org.apache.myfaces.view.facelets.util;
import org.apache.myfaces.util.lang.FastWriter;
-import org.junit.jupiter.api.Assertions;
+
import org.junit.jupiter.api.Test;
-public class FastWriterTest
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class FastWriterTest
{
// Test FastWriter.write(String str, int off, int len)
@Test
- public void testFastWriterWriteString() throws Exception
+ void fastWriterWriteString() throws Exception
{
String sampleStringToWrite = "Test String to write";
@@ -34,11 +36,11 @@ public void testFastWriterWriteString() throws Exception
fw.write(sampleStringToWrite, 0, sampleStringToWrite.length());
// fw.toString() should be: Test String to write
- Assertions.assertEquals(fw.toString(), sampleStringToWrite);
+ assertEquals(fw.toString(), sampleStringToWrite);
}
-
+
@Test
- public void testFastWriterWriteStringOffSet() throws Exception
+ void fastWriterWriteStringOffSet() throws Exception
{
int offSet = 5;
String sampleStringToWrite = "Test String to write";
@@ -47,11 +49,11 @@ public void testFastWriterWriteStringOffSet() throws Exception
fw.write(sampleStringToWrite, offSet, sampleStringToWrite.length() - offSet);
// fw.toString() should be: String to write
- Assertions.assertEquals(fw.toString(), sampleStringToWrite.substring(offSet));
+ assertEquals(fw.toString(), sampleStringToWrite.substring(offSet));
}
-
+
@Test
- public void testFastWriterWriteStringLength() throws Exception
+ void fastWriterWriteStringLength() throws Exception
{
String sampleStringToWrite = "Test String to write";
int length = sampleStringToWrite.substring(0, sampleStringToWrite.indexOf(' ')).length();
@@ -60,6 +62,6 @@ public void testFastWriterWriteStringLength() throws Exception
fw.write(sampleStringToWrite, 0, length);
// fw.toString() should be: Test
- Assertions.assertEquals(fw.toString(), sampleStringToWrite.substring(0,length));
+ assertEquals(fw.toString(), sampleStringToWrite.substring(0,length));
}
}
\ No newline at end of file
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/viewscope/ViewScopeClientSideStateLimitTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/viewscope/ViewScopeClientSideStateLimitTestCase.java
index a0e30b51a3..1734469058 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/viewscope/ViewScopeClientSideStateLimitTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/viewscope/ViewScopeClientSideStateLimitTestCase.java
@@ -18,13 +18,14 @@
*/
package org.apache.myfaces.view.facelets.viewscope;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.application.ProjectStage;
import jakarta.faces.application.StateManager;
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -33,7 +34,7 @@
* {@code @ViewScoped} bean must not let the number of view scopes in the session grow without limit:
* only the most recent {@code org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION} are kept.
*/
-public class ViewScopeClientSideStateLimitTestCase extends AbstractMyFacesCDIRequestTestCase
+class ViewScopeClientSideStateLimitTestCase extends AbstractMyFacesCDIRequestTestCase
{
private static final int LIMIT = 3;
@@ -56,7 +57,7 @@ protected void setUpWebConfigParams() throws Exception
}
@Test
- public void testViewScopesAreLimitedWithClientSideStateSaving() throws Exception
+ void viewScopesAreLimitedWithClientSideStateSaving() throws Exception
{
ViewScopeLimitProbeBean.reset();
@@ -69,9 +70,9 @@ public void testViewScopesAreLimitedWithClientSideStateSaving() throws Exception
endRequest();
}
- Assertions.assertEquals(requests, ViewScopeLimitProbeBean.CREATED.get(),
+ assertEquals(requests, ViewScopeLimitProbeBean.CREATED.get(),
"the @ViewScoped bean must be created once per request");
- Assertions.assertEquals(requests - LIMIT, ViewScopeLimitProbeBean.DESTROYED.get(),
+ assertEquals(requests - LIMIT, ViewScopeLimitProbeBean.DESTROYED.get(),
"only the most recent " + LIMIT + " view scopes must be kept in the session");
}
}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/viewscope/ViewScopeFormlessLeakTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/viewscope/ViewScopeFormlessLeakTestCase.java
index 49dcbf3742..6275b42e4c 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/viewscope/ViewScopeFormlessLeakTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/viewscope/ViewScopeFormlessLeakTestCase.java
@@ -18,11 +18,12 @@
*/
package org.apache.myfaces.view.facelets.viewscope;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import jakarta.el.ExpressionFactory;
import jakarta.faces.application.ProjectStage;
import org.apache.myfaces.test.core.AbstractMyFacesCDIRequestTestCase;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -34,7 +35,7 @@
* the scope has to be destroyed at the end of each request. Before the fix the beans were never
* destroyed and piled up in the session (a memory leak), so {@code DESTROYED} stayed at 0.
*/
-public class ViewScopeFormlessLeakTestCase extends AbstractMyFacesCDIRequestTestCase
+class ViewScopeFormlessLeakTestCase extends AbstractMyFacesCDIRequestTestCase
{
protected ExpressionFactory createExpressionFactory()
@@ -52,7 +53,7 @@ protected void setUpWebConfigParams() throws Exception
}
@Test
- public void testFormlessViewDoesNotLeakViewScopedBeans() throws Exception
+ void formlessViewDoesNotLeakViewScopedBeans() throws Exception
{
ViewScopeLeakProbeBean.reset();
@@ -65,9 +66,9 @@ public void testFormlessViewDoesNotLeakViewScopedBeans() throws Exception
endRequest();
}
- Assertions.assertEquals(requests, ViewScopeLeakProbeBean.CREATED.get(),
+ assertEquals(requests, ViewScopeLeakProbeBean.CREATED.get(),
"the @ViewScoped bean must be created once per request");
- Assertions.assertEquals(requests, ViewScopeLeakProbeBean.DESTROYED.get(),
+ assertEquals(requests, ViewScopeLeakProbeBean.DESTROYED.get(),
"the @ViewScoped beans of a formless (never-saved) view must be destroyed each "
+ "request, not leaked into the session");
}
diff --git a/parent/pom.xml b/parent/pom.xml
index 42b10215dc..c7b0f3a295 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -210,7 +210,7 @@
maven-surefire-plugin
- 3.0.0-M7
+ 3.6.1
@@ -455,7 +455,7 @@
org.junit.jupiter
junit-jupiter-api
- 5.13.4
+ 6.1.3
test
diff --git a/test/src/main/java/org/apache/myfaces/test/base/junit/AbstractViewControllerTestCase.java b/test/src/main/java/org/apache/myfaces/test/base/junit/AbstractViewControllerTestCase.java
index feedf67cc0..afcef0112f 100644
--- a/test/src/main/java/org/apache/myfaces/test/base/junit/AbstractViewControllerTestCase.java
+++ b/test/src/main/java/org/apache/myfaces/test/base/junit/AbstractViewControllerTestCase.java
@@ -19,9 +19,10 @@
package org.apache.myfaces.test.base.junit;
-import java.util.Iterator;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
-import org.junit.jupiter.api.Assertions;
+import java.util.Iterator;
/**
* Abstract base class for testing ViewController
@@ -72,7 +73,7 @@ protected void checkMessageCount(int expected)
messages.next();
actual++;
}
- Assertions.assertEquals(expected, actual, "Complete message count");
+ assertEquals(expected, actual, "Complete message count");
}
@@ -94,7 +95,7 @@ protected void checkMessageCount(String clientId, int expected)
messages.next();
actual++;
}
- Assertions.assertSame(expected, actual, "Complete message count");
+ assertSame(expected, actual, "Complete message count");
}