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

org.geomajas.testdata.TestPathBinaryStreamAssert Maven / Gradle / Ivy

There is a newer version: 1.18.5
Show newest version
/*
 * This is part of Geomajas, a GIS framework, http://www.geomajas.org/.
 *
 * Copyright 2008-2015 Geosparc nv, http://www.geosparc.com/, Belgium.
 *
 * The program is available in open source according to the GNU Affero
 * General Public License. All contributions in this program are covered
 * by the Geomajas Contributors License Agreement. For full licensing
 * details, see LICENSE.txt in the project root.
 */
package org.geomajas.testdata;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;

/**
 * Abstract assertion for comparing images in the test source/classpath.
 * Use as follows: 
 * 
 *  new TestPathBinaryStreamAssert("org/geomajas/myimages") {
 *		public void generateActual(OutputStream out) throws Exception {
 *				// override to generate image
 *			}
 *		}.assertEqual("test.png", false);
 * }
 * 
* * @author Jan De Moerloose */ public abstract class TestPathBinaryStreamAssert extends BinaryStreamAssert { private String classPath; /** * Create an assert for the specified class path directory. * * @param classPath * the classpath directory (no preceding slash needed) */ public TestPathBinaryStreamAssert(String classPath) { this.classPath = classPath; } public Resource getExpected(String resourceName, boolean rewrite) { if (rewrite) { return new FileSystemResource("src/test/resources/" + classPath + "/" + resourceName); } else { return new ClassPathResource(classPath + "/" + resourceName); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy