/* * Copyright (C) 2011 Laurent Caillette * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either * version 3 of the License, or (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package org.novelang.opus; import java.io.File; import java.io.IOException; import java.util.concurrent.Executors; import com.google.common.collect.ImmutableSet; import org.novelang.configuration.ConfigurationTools; import org.novelang.designator.Tag; import org.novelang.outfit.DefaultCharset; /** * Some methods for creating {@link Opus} instances easily. * * @author Laurent Caillette */ public class OpusTestTools { private OpusTestTools() { } public static Opus createBook( final File baseDirectory, final String content ) { return new Opus( baseDirectory, baseDirectory, Executors.newSingleThreadExecutor( ConfigurationTools.getExecutorThreadFactory() ), content, DefaultCharset.SOURCE, DefaultCharset.RENDERING, ImmutableSet.< Tag >of() ) ; } public static Opus createBook( final File bookFile ) throws IOException { return new Opus( bookFile.getParentFile(), bookFile, Executors.newSingleThreadExecutor( ConfigurationTools.getExecutorThreadFactory() ), DefaultCharset.SOURCE, DefaultCharset.RENDERING, ImmutableSet.< Tag >of() ) ; } }