/* * @(#)Test.java * * Project: JHotdraw - a GUI framework for technical drawings * http://www.jhotdraw.org * http://jhotdraw.sourceforge.net * Copyright: (c) by the original author(s) and all contributors * License: Lesser GNU Public License (LGPL) * http://www.opensource.org/licenses/lgpl-license.html */ package org.jhotdraw.test.contrib; import java.awt.Point; import junit.framework.TestCase; // JUnitDoclet begin import import org.jhotdraw.contrib.GraphicalCompositeFigure; import org.jhotdraw.contrib.Layoutable; import org.jhotdraw.contrib.SimpleLayouter; import org.jhotdraw.figures.RectangleFigure; // JUnitDoclet end import /* * Generated by JUnitDoclet, a tool provided by * ObjectFab GmbH under LGPL. * Please see www.junitdoclet.org, www.gnu.org * and www.objectfab.de for informations about * the tool, the licence and the authors. */ // JUnitDoclet begin javadoc_class /** * TestCase SimpleLayouterTest is generated by * JUnitDoclet to hold the tests for SimpleLayouter. * @see org.jhotdraw.contrib.SimpleLayouter */ // JUnitDoclet end javadoc_class public class SimpleLayouterTest // JUnitDoclet begin extends_implements extends TestCase // JUnitDoclet end extends_implements { // JUnitDoclet begin class // instance variables, helper methods, ... put them in this marker private SimpleLayouter simplelayouter; // JUnitDoclet end class /** * Constructor SimpleLayouterTest is * basically calling the inherited constructor to * initiate the TestCase for use by the Framework. */ public SimpleLayouterTest(String name) { // JUnitDoclet begin method SimpleLayouterTest super(name); // JUnitDoclet end method SimpleLayouterTest } /** * Factory method for instances of the class to be tested. */ public SimpleLayouter createInstance() throws Exception { // JUnitDoclet begin method testcase.createInstance Layoutable fig = new GraphicalCompositeFigure(new RectangleFigure(new Point(10, 10), new Point(100, 100))); return new SimpleLayouter(fig); // JUnitDoclet end method testcase.createInstance } /** * Method setUp is overwriting the framework method to * prepare an instance of this TestCase for a single test. * It's called from the JUnit framework only. */ protected void setUp() throws Exception { // JUnitDoclet begin method testcase.setUp super.setUp(); simplelayouter = createInstance(); // JUnitDoclet end method testcase.setUp } /** * Method tearDown is overwriting the framework method to * clean up after each single test of this TestCase. * It's called from the JUnit framework only. */ protected void tearDown() throws Exception { // JUnitDoclet begin method testcase.tearDown simplelayouter = null; super.tearDown(); // JUnitDoclet end method testcase.tearDown } // JUnitDoclet begin javadoc_method setLayoutable() /** * Method testSetGetLayoutable is testing setLayoutable * and getLayoutable together by setting some value * and verifying it by reading. * @see org.jhotdraw.contrib.SimpleLayouter#setLayoutable(org.jhotdraw.contrib.Layoutable) * @see org.jhotdraw.contrib.SimpleLayouter#getLayoutable() */ // JUnitDoclet end javadoc_method setLayoutable() public void testSetGetLayoutable() throws Exception { // JUnitDoclet begin method setLayoutable getLayoutable org.jhotdraw.contrib.Layoutable[] tests = { new GraphicalCompositeFigure(), null }; for (int i = 0; i < tests.length; i++) { simplelayouter.setLayoutable(tests[i]); assertEquals(tests[i], simplelayouter.getLayoutable()); } // JUnitDoclet end method setLayoutable getLayoutable } // JUnitDoclet begin javadoc_method setInsets() /** * Method testSetGetInsets is testing setInsets * and getInsets together by setting some value * and verifying it by reading. * @see org.jhotdraw.contrib.SimpleLayouter#setInsets(java.awt.Insets) * @see org.jhotdraw.contrib.SimpleLayouter#getInsets() */ // JUnitDoclet end javadoc_method setInsets() public void testSetGetInsets() throws Exception { // JUnitDoclet begin method setInsets getInsets java.awt.Insets[] tests = { new java.awt.Insets(5, 5, 5, 5), null }; for (int i = 0; i < tests.length; i++) { simplelayouter.setInsets(tests[i]); assertEquals(tests[i], simplelayouter.getInsets()); } // JUnitDoclet end method setInsets getInsets } // JUnitDoclet begin javadoc_method create() /** * Method testCreate is testing create * @see org.jhotdraw.contrib.SimpleLayouter#create(org.jhotdraw.contrib.Layoutable) */ // JUnitDoclet end javadoc_method create() public void testCreate() throws Exception { // JUnitDoclet begin method create // JUnitDoclet end method create } // JUnitDoclet begin javadoc_method calculateLayout() /** * Method testCalculateLayout is testing calculateLayout * @see org.jhotdraw.contrib.SimpleLayouter#calculateLayout(java.awt.Point, java.awt.Point) */ // JUnitDoclet end javadoc_method calculateLayout() public void testCalculateLayout() throws Exception { // JUnitDoclet begin method calculateLayout // JUnitDoclet end method calculateLayout } // JUnitDoclet begin javadoc_method layout() /** * Method testLayout is testing layout * @see org.jhotdraw.contrib.SimpleLayouter#layout(java.awt.Point, java.awt.Point) */ // JUnitDoclet end javadoc_method layout() public void testLayout() throws Exception { // JUnitDoclet begin method layout // JUnitDoclet end method layout } // JUnitDoclet begin javadoc_method read() /** * Method testRead is testing read * @see org.jhotdraw.contrib.SimpleLayouter#read(org.jhotdraw.util.StorableInput) */ // JUnitDoclet end javadoc_method read() public void testRead() throws Exception { // JUnitDoclet begin method read // JUnitDoclet end method read } // JUnitDoclet begin javadoc_method write() /** * Method testWrite is testing write * @see org.jhotdraw.contrib.SimpleLayouter#write(org.jhotdraw.util.StorableOutput) */ // JUnitDoclet end javadoc_method write() public void testWrite() throws Exception { // JUnitDoclet begin method write // JUnitDoclet end method write } // JUnitDoclet begin javadoc_method testVault /** * JUnitDoclet moves marker to this method, if there is not match * for them in the regenerated code and if the marker is not empty. * This way, no test gets lost when regenerating after renaming. * <b>Method testVault is supposed to be empty.</b> */ // JUnitDoclet end javadoc_method testVault public void testVault() throws Exception { // JUnitDoclet begin method testcase.testVault // JUnitDoclet end method testcase.testVault } }