All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.thucydides.core.matchers.FileMatchers Maven / Gradle / Ivy

package net.thucydides.core.matchers;

import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;

import java.io.File;


public class FileMatchers {

    @Factory
    public static Matcher exists() {
        return new TypeSafeMatcher() {
            private File checkedFile;

            @Override
            public boolean matchesSafely(File file) {
                checkedFile = file;
                return file.exists();
            }

            @Override
            public void describeTo(Description description) {
                description.appendText("a file at " + checkedFile.getPath());
            }
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy