/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.job.internal;

import java.util.Arrays;
import java.util.List;

import org.jmock.Expectations;
import org.junit.Assert;
import org.junit.Test;
import org.xwiki.context.Execution;
import org.xwiki.context.ExecutionContextManager;
import org.xwiki.context.internal.DefaultExecution;
import org.xwiki.context.internal.DefaultExecutionContextManager;
import org.xwiki.job.JobManager;
import org.xwiki.job.JobStatusStore;
import org.xwiki.test.annotation.ComponentList;
import org.xwiki.test.jmock.AbstractMockingComponentTestCase;
import org.xwiki.test.jmock.annotation.MockingRequirement;

/**
 * Unit tests for {@link DefaultJobManager}.
 *
 * @version $Id$
 */
@MockingRequirement(value = DefaultJobManager.class, exceptions = { ExecutionContextManager.class, Execution.class })
@ComponentList({
    DefaultExecution.class,
    DefaultExecutionContextManager.class
})
public class DefaultJobManagerTest extends AbstractMockingComponentTestCase<JobManager>
{
    @Test
    public void testGetJobStatusForUnexistingJob() throws Exception
    {
        final List<String> jobId = Arrays.asList("unexisting-job");
        final JobStatusStore jobStatusStorage = getComponentManager().getInstance(JobStatusStore.class);

        getMockery().checking(new Expectations()
        {
            {
                oneOf(jobStatusStorage).getJobStatus(jobId);
                will(returnValue(null));
            }
        });

        Assert.assertNull(getMockedComponent().getJobStatus(jobId));
    }
}

@@ -985,151 +985,74 @@
 rg.j
-mock.Expectations;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0Aimport org.xwiki.context.Execution;%0Aimport org.xwiki.context.ExecutionContex
+unit.jupiter.api.Test;%0Aimport org.xwiki.component.manager.Componen
 tMan
@@ -1179,41 +1179,8 @@
 er;%0A
-import org.xwiki.job.JobManager;%0A
 impo
@@ -1287,28 +1287,80 @@
 st.j
-mock.AbstractMocking
+unit5.mockito.ComponentTest;%0Aimport org.xwiki.test.junit5.mockito.Inject
 Comp
@@ -1364,24 +1364,23 @@
 omponent
-TestCase
+Manager
 ;%0Aimport
@@ -1400,42 +1400,142 @@
 st.j
-mock.annotation.MockingRequirem
+unit5.mockito.InjectMockComponents;%0A%0Aimport static org.junit.jupiter.api.Assertions.assertNull;%0Aimport static org.mockito.Mockito.wh
 en
-t
 ;%0A%0A/
@@ -1611,124 +1611,21 @@
 */%0A@
-MockingRequirement(value = DefaultJobManager.class, exceptions = %7B ExecutionContextManager.class, Execution.class %7D)
+ComponentTest
 %0A@Co
@@ -1748,63 +1748,155 @@
 Test
- extends AbstractMockingComponentTestCase%3CJob
+%0A%7B%0A    @InjectMockComponents%0A    private DefaultJobManager jobManager;%0A%0A    @InjectComponentManager%0A    private ComponentManager component
 Manager
-%3E%0A%7B
+;%0A
 %0A   
@@ -1922,13 +1922,9 @@
 oid 
-testG
+g
 etJo
@@ -1980,22 +1980,16 @@
         
-final 
 List%3CStr
@@ -2046,14 +2046,8 @@
     
-final 
 JobS
@@ -2080,12 +2080,9 @@
 e = 
-getC
+c
 ompo
@@ -2092,18 +2092,16 @@
 tManager
-()
 .getInst
@@ -2128,25 +2128,24 @@
 class);%0A
-%0A
         
 getMocke
@@ -2140,94 +2140,12 @@
     
-getMockery().checking(new Expectations()%0A        %7B%0A            %7B%0A                oneOf
+when
 (job
@@ -2157,17 +2157,16 @@
 sStorage
-)
 .getJobS
@@ -2181,124 +2181,58 @@
 bId)
-;%0A                will(returnValue
+).thenReturn
 (null)
-)
 ;%0A
-            %7D%0A        %7D);%0A%0A        Assert.assertNull(getMockedComponent()
+%0A        assertNull(jobManager
 .get

Convert to JUnit5 + from JMock to Mockito