package com.netflix.zuul.groovy;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;

import java.io.File;
import java.io.FilenameFilter;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;

/**
 * Filters only .groovy files
 *
 * @author Mikey Cohen
 * Date: 5/30/13
 * Time: 11:47 AM
 *
 */
public class GroovyFileFilter implements FilenameFilter {
    public boolean accept(File dir, String name) {
        return name.endsWith(".groovy");
    }


    @RunWith(MockitoJUnitRunner.class)
    public static class UnitTest {

        @Mock
        private File nonGroovyFile;
        @Mock
        private File groovyFile;

        @Mock
        private File directory;

        @Before
        public void before() {
            MockitoAnnotations.initMocks(this);
        }


        @Test
        public void testGroovyFileFilter() {

            when(nonGroovyFile.getName()).thenReturn("file.mikey");
            when(groovyFile.getName()).thenReturn("file.groovy");

            GroovyFileFilter filter = new GroovyFileFilter();

            assertFalse(filter.accept(nonGroovyFile, "file.mikey"));
            assertTrue(filter.accept(groovyFile, "file.groovy"));

        }
    }
}
@@ -1,8 +1,650 @@
+/*%0A * Copyright 2013 Netflix, Inc.%0A *%0A *      Licensed under the Apache License, Version 2.0 (the %22License%22);%0A *      you may not use this file except in compliance with the License.%0A *      You may obtain a copy of the License at%0A *%0A *          http://www.apache.org/licenses/LICENSE-2.0%0A *%0A *      Unless required by applicable law or agreed to in writing, software%0A *      distributed under the License is distributed on an %22AS IS%22 BASIS,%0A *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *      See the License for the specific language governing permissions and%0A *      limitations under the License.%0A */%0A
 package 

Add missing license header