@@ -0,0 +1,1706 @@
+package net.trajano.jee.web.test;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.mockito.ArgumentMatchers.anyString;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport javax.faces.context.FacesContext;%0Aimport javax.servlet.ServletContext;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.Mock;%0Aimport org.mockito.MockitoAnnotations;%0A%0Aimport com.sun.faces.config.InitFacesContext;%0A%0Aimport net.trajano.jee.bean.NlpBean;%0Aimport net.trajano.jee.nlp.AnalysisResult;%0Aimport net.trajano.jee.nlp.Nlp;%0A%0Apublic class NlpBeanTest %7B%0A%0A    private class FakeContext extends InitFacesContext %7B%0A%0A        public FakeContext(final ServletContext sc) %7B%0A            super(sc);%0A            setCurrentInstance(context);%0A        %7D%0A%0A    %7D%0A%0A    @Mock%0A    private FacesContext context;%0A%0A    @Before%0A    public void before() %7B%0A%0A        MockitoAnnotations.initMocks(this);%0A        final ServletContext sc = mock(ServletContext.class);%0A        new FakeContext(sc);%0A        assertEquals(context, FacesContext.getCurrentInstance());%0A    %7D%0A%0A    @Test%0A    public void testSimpleAnalysis() throws Exception %7B%0A%0A        final NlpBean bean = new NlpBean();%0A        final Nlp nlp = mock(Nlp.class);%0A        when(nlp.analyze(anyString())).thenReturn(new AnalysisResult());%0A        bean.setNlp(nlp);%0A        bean.setInput(%22Hello world%22);%0A        assertEquals(%22Hello world%22, bean.getInput());%0A        assertFalse(bean.isParsed());%0A        bean.parse();%0A        assertNotNull(bean.getResult());%0A        assertTrue(bean.isParsed());%0A%0A    %7D%0A%0A%7D%0A

fixup! Implement Nlp stateless bean