/** * Copyright 2011 Oliver Buchtala * * This file is part of ndogen. * * ndogen is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ndogen is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ndogen. If not, see <http://www.gnu.org/licenses/>. */ package org.ndogen; import java.io.File; import java.io.IOException; import org.ndogen.util.FileUtils; public class Fixture { String input; String output; public Fixture(String file) { super(); if(!new File(file).exists()) { throw new RuntimeException("Fixture file does not exist: " + file); } String content; try { content = FileUtils.readFile(file); } catch (IOException e) { throw new RuntimeException("Could not read fixture file: " + file); } String[] parts = content.split("%%"); input = parts[0]; output = parts[1].trim(); } public String getInput() { return input; } public String getOutput() { return output; } }