Skip to content

Commit

Permalink
fix: stabilize unit test SpaceApplicationMigrationTest - EXO-66907
Browse files Browse the repository at this point in the history
  • Loading branch information
ahamdi committed Oct 19, 2023
1 parent 815be5b commit 6f32650
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@
import org.exoplatform.social.core.space.*;
import org.exoplatform.social.core.space.model.Space;
import org.exoplatform.social.core.space.spi.SpaceService;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletContext;
import org.gatein.pc.api.PortletInvoker;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.info.PortletInfo;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;


import java.util.Collections;
import java.util.HashSet;

import static org.junit.Assert.*;
Expand Down Expand Up @@ -72,7 +76,23 @@ public void setUp() throws PortletInvokerException {
this.entityManagerService = container.getComponentInstanceOfType(EntityManagerService.class);
this.settingService = container.getComponentInstanceOfType(SettingService.class);
PortletInvoker portletInvoker = mock(PortletInvoker.class);
when(portletInvoker.getPortlets()).thenReturn(new HashSet<>());
Portlet portlet = new Portlet() {
@Override
public PortletContext getContext() {
return null;
}

@Override
public PortletInfo getInfo() {
return null;
}

@Override
public boolean isRemote() {
return false;
}
};
when(portletInvoker.getPortlets()).thenReturn(Collections.singleton(portlet));
container.unregisterComponent(PortletInvoker.class);
container.registerComponentInstance(PortletInvoker.class, portletInvoker);
HashSet<MembershipEntry> memberships = new HashSet<MembershipEntry>();
Expand Down

0 comments on commit 6f32650

Please sign in to comment.