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

nz.ac.auckland.integration.testing.resource.PlainTextTestResource Maven / Gradle / Ivy

The newest version!
package nz.ac.auckland.integration.testing.resource;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.net.URL;

/**
 * A simple mechanism for sending and comparing plain text values
 * using the Java equals mechanism
 *
 * @author David MacDonald 
 */
public class PlainTextTestResource extends StaticTestResource {

    public PlainTextTestResource(String value) {
        super(value);
    }

    public PlainTextTestResource(File file) {
        super(file);
    }

    public PlainTextTestResource(URL url) {
        super(url);
    }

    /**
     * @return The plain text from an external resource as a standard Java String
     * @throws Exception
     */
    protected String getResource(File file) throws Exception {
        return FileUtils.readFileToString(file);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy