From d6e39155d565aca10d7496706fbd46006a29d4b5 Mon Sep 17 00:00:00 2001 From: Bauke Scholtz Date: Sat, 14 Oct 2023 13:12:11 -0400 Subject: [PATCH] Fixed MockBeanManager to not return null on methods returning collection and fixed ELUtilsTest failing due to BeanManager now being required before ApplicationImpl is created (as it needs context params which now checks FacesConfig annotation via CDI) --- impl/src/test/java/com/sun/faces/el/ELUtilsTest.java | 2 +- .../test/java/com/sun/faces/mock/MockBeanManager.java | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/impl/src/test/java/com/sun/faces/el/ELUtilsTest.java b/impl/src/test/java/com/sun/faces/el/ELUtilsTest.java index 2eca310586..461e50652e 100644 --- a/impl/src/test/java/com/sun/faces/el/ELUtilsTest.java +++ b/impl/src/test/java/com/sun/faces/el/ELUtilsTest.java @@ -46,12 +46,12 @@ public URL getResource(String path) { "com.sun.faces.mock.MockRenderKitFactory"); new FacesContextImpl(externalContext, new LifecycleImpl()); + FacesContext.getCurrentInstance().getAttributes().put(RIConstants.CDI_BEAN_MANAGER, new MockBeanManager()); new ApplicationImpl(); applicationAssociate = (ApplicationAssociate) externalContext.getApplicationMap() .get(RIConstants.FACES_PREFIX + "ApplicationAssociate"); - FacesContext.getCurrentInstance().getAttributes().put(RIConstants.CDI_BEAN_MANAGER, new MockBeanManager()); } @Test diff --git a/impl/src/test/java/com/sun/faces/mock/MockBeanManager.java b/impl/src/test/java/com/sun/faces/mock/MockBeanManager.java index 6eda0eb22c..b651643062 100644 --- a/impl/src/test/java/com/sun/faces/mock/MockBeanManager.java +++ b/impl/src/test/java/com/sun/faces/mock/MockBeanManager.java @@ -16,6 +16,8 @@ package com.sun.faces.mock; +import static java.util.Collections.emptySet; + import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.List; @@ -71,12 +73,12 @@ public CreationalContext createCreationalContext(Contextual contextual @Override public Set> getBeans(Type beanType, Annotation... qualifiers) { - return null; + return emptySet(); } @Override public Set> getBeans(String name) { - return null; + return emptySet(); } @Override @@ -156,12 +158,12 @@ public boolean isPassivatingScope(Class annotationType) { @Override public Set getInterceptorBindingDefinition(Class bindingType) { - return null; + return emptySet(); } @Override public Set getStereotypeDefinition(Class stereotype) { - return null; + return emptySet(); } @Override