Skip to content

Commit

Permalink
Fixed MockBeanManager to not return null on methods returning collection
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
BalusC committed Oct 14, 2023
1 parent 99b8a6d commit d6e3915
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion impl/src/test/java/com/sun/faces/el/ELUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions impl/src/test/java/com/sun/faces/mock/MockBeanManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -71,12 +73,12 @@ public <T> CreationalContext<T> createCreationalContext(Contextual<T> contextual

@Override
public Set<Bean<?>> getBeans(Type beanType, Annotation... qualifiers) {
return null;
return emptySet();
}

@Override
public Set<Bean<?>> getBeans(String name) {
return null;
return emptySet();
}

@Override
Expand Down Expand Up @@ -156,12 +158,12 @@ public boolean isPassivatingScope(Class<? extends Annotation> annotationType) {

@Override
public Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> bindingType) {
return null;
return emptySet();
}

@Override
public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype) {
return null;
return emptySet();
}

@Override
Expand Down

0 comments on commit d6e3915

Please sign in to comment.