001 /* 002 * Created on Jan 17, 2009 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 005 * in compliance with the License. You may obtain a copy of the License at 006 * 007 * http://www.apache.org/licenses/LICENSE-2.0 008 * 009 * Unless required by applicable law or agreed to in writing, software distributed under the License 010 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 011 * or implied. See the License for the specific language governing permissions and limitations under 012 * the License. 013 * 014 * Copyright @2009-2010 the original author or authors. 015 */ 016 package org.fest.swing.testing; 017 018 import org.fest.swing.core.BasicRobot; 019 import org.fest.swing.core.Robot; 020 021 /** 022 * Understands a template for test cases that use FEST-Swing. 023 * @since 1.1 024 * 025 * @author Alex Ruiz 026 */ 027 public abstract class FestSwingTestCaseTemplate { 028 029 private Robot robot; 030 031 public FestSwingTestCaseTemplate() { 032 robot = null; // Just to satisfy FindBugs 033 } 034 035 /** 036 * Creates this test's <code>{@link Robot}</code> using a new AWT hierarchy. 037 */ 038 protected final void setUpRobot() { 039 robot = BasicRobot.robotWithNewAwtHierarchy(); 040 } 041 042 /** 043 * Cleans up resources used by this test's <code>{@link Robot}</code>. 044 */ 045 protected final void cleanUp() { 046 robot.cleanUp(); 047 } 048 049 /** 050 * Returns this test's <code>{@link Robot}</code>. 051 * @return this test's <code>{@link Robot}</code> 052 */ 053 protected final Robot robot() { return robot; } 054 }