@@ -0,0 +1,2175 @@
+package sg.ncl.service.data.logic;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.ExpectedException;%0Aimport org.mockito.Mock;%0Aimport org.mockito.junit.MockitoJUnit;%0Aimport org.mockito.junit.MockitoRule;%0Aimport sg.ncl.service.data.data.jpa.DataEntity;%0Aimport sg.ncl.service.data.data.jpa.DataRepository;%0Aimport sg.ncl.service.data.data.jpa.DataResourceEntity;%0Aimport sg.ncl.service.data.domain.AsyncAvScannerService;%0Aimport sg.ncl.service.data.domain.AvScannerService;%0Aimport sg.ncl.service.data.domain.Data;%0Aimport sg.ncl.service.data.domain.DataResource;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport static org.mockito.Matchers.anyString;%0Aimport static org.mockito.Mockito.*;%0Aimport static sg.ncl.service.data.util.TestUtil.getDataResourceEntity;%0A%0A/**%0A * Created by dcsyeoty on 06-Jun-17.%0A */%0Apublic class AsyncAvScannerImplTest %7B%0A%0A    @Rule%0A    public MockitoRule mockito = MockitoJUnit.rule();%0A    @Rule%0A    public final ExpectedException exception = ExpectedException.none();%0A%0A    @Mock%0A    private AvScannerService avScannerService;%0A    @Mock%0A    private DataRepository dataRepository;%0A%0A    private AsyncAvScannerService asyncAvScannerService;%0A%0A    @Before%0A    public void before() %7B%0A        assertThat(mockingDetails(avScannerService).isMock()).isTrue();%0A        assertThat(mockingDetails(dataRepository).isMock()).isTrue();%0A        asyncAvScannerService = new AsyncAvScannerImpl(avScannerService, dataRepository);%0A    %7D%0A%0A    @Test%0A    public void testScanResource() throws Exception %7B%0A        DataEntity dataEntity = new DataEntity();%0A        DataResourceEntity dataResourceEntity = getDataResourceEntity();%0A%0A        dataEntity.addResource(dataResourceEntity);%0A%0A        when(avScannerService.scan(anyString(), anyString(), anyString())).thenReturn(true);%0A        when(dataRepository.save(any(DataEntity.class))).thenReturn(dataEntity);%0A%0A        Data result = asyncAvScannerService.scanResource(dataEntity, dataResourceEntity, %22data%22, %22utf8%22);%0A%0A        verify(dataRepository, times(1)).save(dataEntity);%0A        assertThat(result.getResources().stream().anyMatch(DataResource::isMalicious));%0A    %7D%0A%7D%0A

add test cases