We have a spring boot application and have written test cases for the service class. The test case is running when I am running it as Right Click -> Run As -> JUnit Test. But when I am running it through maven, it is not found. My test class is as below:
package dk.tdc.fasapi.service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import dk.tdc.fasapi.repository.implementation.jdbc.IncidentDetailsRepo;
import dk.tdc.fasapi.requestResponse.incidents.getdetails.IncidentDetails;
@RunWith(MockitoJUnitRunner.class)
public class TestIncidentDetailsService {
    private Map<String, Object> fasoDetailsMap = null;
    private List<Map<String, Object>> subStateMapList = null;
    @Mock
    private IncidentDetailsRepo incidentDetailsRepo;
    @InjectMocks
    private IncidentDetailsService incidentDetailsService;
    @Before
    public void beforeMethod() {
        fasoDetailsMap = new HashMap<>();
        fasoDetailsMap.put("FaultDescription", "Test Description");
        fasoDetailsMap.put("UrgentCode", "01");
        fasoDetailsMap.put("LID", "12345678");
        fasoDetailsMap.put("CustomerName", "TDC");
        fasoDetailsMap.put("CustomerPhone", "11223344");
        fasoDetailsMap.put("ExtRefId", "1234");
        fasoDetailsMap.put("SSID", "0001");
        Map<String, Object> subStateMap = new HashMap<String, Object>();
        subStateMap.put("X_CURRENT_STATUS", "Accepted");
        subStateMapList = new ArrayList<Map<String,Object>>();
        subStateMapList.add(subStateMap);
    }
    @Test
    public void testExecuteOpenFaso() throws Exception {
        Mockito.when(incidentDetailsRepo.getOpenFasoDetails(Mockito.anyString())).thenReturn(fasoDetailsMap);
        Mockito.when(incidentDetailsRepo.getCurrentStatus(Mockito.anyString())).thenReturn(subStateMapList);
        IncidentDetails incidentDetails = incidentDetailsService.execute("20181225-000001");
        Assert.assertEquals(incidentDetails.getId(), "20181225-000001");
        Assert.assertEquals(incidentDetails.getStatus(), "Open");
        Assert.assertEquals(incidentDetails.getTitle(), "Test Description");
        Assert.assertEquals(incidentDetails.getSeverity(), "01");
        Assert.assertEquals(incidentDetails.getParameter().getType(), "LID");
        Assert.assertEquals(incidentDetails.getParameter().getValue(), "12345678");
        Assert.assertEquals(incidentDetails.getContact().getName(), "TDC");
        Assert.assertEquals(incidentDetails.getContact().getNumber(), "11223344");
        Assert.assertEquals(incidentDetails.getReferences().getTicket(), "1234");
        Assert.assertEquals(incidentDetails.getReferences().getSsid(), "0001");
        Assert.assertEquals(incidentDetails.getReferences().getContractor(), "ENIIG180619");
        Assert.assertEquals(incidentDetails.getSubState(), "Accepted");
    }
    @Test
    public void testExecuteClosedFaso() throws Exception {
        Mockito.when(incidentDetailsRepo.getOpenFasoDetails(Mockito.anyString())).thenReturn(null);
        Mockito.when(incidentDetailsRepo.getClosedFasoDetails(Mockito.anyString())).thenReturn(fasoDetailsMap);
        Mockito.when(incidentDetailsRepo.getCurrentStatus(Mockito.anyString())).thenReturn(subStateMapList);
        IncidentDetails incidentDetails = incidentDetailsService.execute("20181225-000001");
        Assert.assertEquals(incidentDetails.getId(), "20181225-000001");
        Assert.assertEquals(incidentDetails.getStatus(), "Closed");
        Assert.assertEquals(incidentDetails.getTitle(), "Test Description");
        Assert.assertEquals(incidentDetails.getSeverity(), "01");
        Assert.assertEquals(incidentDetails.getParameter().getType(), "LID");
        Assert.assertEquals(incidentDetails.getParameter().getValue(), "12345678");
        Assert.assertEquals(incidentDetails.getContact().getName(), "TDC");
        Assert.assertEquals(incidentDetails.getContact().getNumber(), "11223344");
        Assert.assertEquals(incidentDetails.getReferences().getTicket(), "1234");
        Assert.assertEquals(incidentDetails.getReferences().getSsid(), "0001");
        Assert.assertEquals(incidentDetails.getReferences().getContractor(), "ENIIG180619");
        Assert.assertEquals(incidentDetails.getSubState(), "Accepted");
    }
    @After
    public void afterMethod() {
        fasoDetailsMap = null;
    }
}
Can anyone please suggest whether I will have to add any more annotations on my test class to make it visible?
