/*
 * Copyright 2016 DELTIS Engineering sprl
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package be.deltis.documentarchiver.impl;

import be.deltis.documentarchiver.Processor;
import be.deltis.documentarchiver.context.Context;
import be.deltis.documentarchiver.context.Source;
import be.deltis.documentarchiver.helper.FileHelper;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verify;

/**
 * Created by benoit on 18/03/14.
 */

@Test
public class WatcherImplTest {

    @InjectMocks
    private WatcherImpl watcher = new WatcherImpl();

    @Mock
    private Processor processor ;

    @BeforeMethod
    public void injectMocks() {
        MockitoAnnotations.initMocks(this);
    }

    public void takeOneFile() throws Exception {
        Path testDir = FileHelper.createTempDirectory(this);

        watcher.setContexts(Collections.singletonList(new Context(Source.EMAIL, testDir)));
        watcher.setSuffix(".pdf");

        Path testFile = FileHelper.createTempFile(testDir, this);

        watcher.takeOneFile();
        verify(processor).processFile(any(Path.class), any(Context.class));

        FileHelper.deleteDir(testDir, this);

        /*
        Files.deleteIfExists(testFile);
        Files.deleteIfExists(testDir);
        */
    }
}

@@ -1951,110 +1951,8 @@
 is);
-%0A%0A        /*%0A        Files.deleteIfExists(testFile);%0A        Files.deleteIfExists(testDir);%0A        */
 %0A   

Refactor unit tests #11 - removed dead code