/*
 * Copyright 2013 Steven Swor.
 *
 * 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 com.github.sworisbreathing.ehcachefilemonitor;

import java.io.File;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

/**
 * Unit tests for {@link FileMonitoringCacheEventListener}.
 *
 * @author Steven Swor
 */
public class FileMonitoringCacheEventListenerTest {

    @Test(expected = CloneNotSupportedException.class)
    public void testClone() throws CloneNotSupportedException {
        new FileMonitoringCacheEventListener(null, null).clone();
    }

    @Rule
    public TemporaryFolder tempFolder = new TemporaryFolder();

    @Test
    public void testGetDirectoryFile() throws IOException {
        File newFile = tempFolder.newFile();
        assertEquals(tempFolder.getRoot(), FileMonitoringCacheEventListener.getDirectory(newFile));
    }

    @Test
    public void testGetDirectoryFolder() {
        assertEquals(tempFolder.getRoot(), FileMonitoringCacheEventListener.getDirectory(tempFolder.getRoot()));
    }
}

@@ -974,16 +974,156 @@
 Test %7B%0A%0A
+    /**%0A     * Tests %7B@link FileMonitoringCacheEventListener#clone()%7D.%0A     * @throws CloneNotSupportedException if the test passes%0A     */%0A
     @Tes
@@ -1169,16 +1169,16 @@
 .class)%0A
-
     publ
@@ -1302,24 +1302,79 @@
 e();%0A    %7D%0A%0A
+    /**%0A     * A temporary folder for testing.%0A     */%0A
     @Rule%0A  
@@ -1435,16 +1435,182 @@
 der();%0A%0A
+    /**%0A     * Tests %7B@link FileMonitoringCacheEventListener#getDirectory(File)%7D with a%0A     * file.%0A     * @throws IOException if the file cannot be created%0A     */%0A
     @Tes
@@ -1819,24 +1819,138 @@
 e));%0A    %7D%0A%0A
+    /**%0A     * Tests %7B@link FileMonitoringCacheEventListener#getDirectory(File)%7D with a%0A     * directory.%0A     */%0A
     @Test%0A  

test javadoc