1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to you under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 * $Id: WelcomeBeanTestCase.java 464373 2006-10-16 04:21:54Z rahul $ 18 */ 19 20 package org.apache.shale.blank; 21 22 import junit.framework.Test; 23 import junit.framework.TestSuite; 24 import org.apache.shale.test.base.AbstractViewControllerTestCase; 25 26 /*** 27 * <p>Test case for the {@link WelcomeBean} ViewController implementation.</p> 28 * 29 * $Id: WelcomeBeanTestCase.java 464373 2006-10-16 04:21:54Z rahul $ 30 */ 31 public class WelcomeBeanTestCase extends AbstractViewControllerTestCase { 32 33 34 // ------------------------------------------------------------ Constructors 35 36 37 // Construct a new instance of this test case. 38 public WelcomeBeanTestCase(String name) { 39 super(name); 40 } 41 42 43 // ---------------------------------------------------- Overall Test Methods 44 45 46 // Set up instance variables required by this test case. 47 protected void setUp() throws Exception { 48 49 // Perform superclass setup tasks 50 super.setUp(); 51 52 // Construct a new instance to be tested 53 bean = new WelcomeBean(); 54 55 // Insert any additional setup for your unit test methods here 56 57 } 58 59 // Return the tests included in this test case. 60 public static Test suite() { 61 62 return (new TestSuite(WelcomeBeanTestCase.class)); 63 64 } 65 66 67 // Tear down instance variables required by this test case. 68 protected void tearDown() throws Exception { 69 70 // Insert any additional teardown for your unit test methods here 71 72 // Remove the instance we just tested 73 bean = null; 74 75 // Perform superclass teardown tasks 76 super.tearDown(); 77 78 } 79 80 81 // ------------------------------------------------------ Instance Variables 82 83 84 // The instance to be tested 85 WelcomeBean bean = null; 86 87 88 // ------------------------------------------------------------ Test Methods 89 90 91 // Test behavior of prerender() method 92 public void testPrerender() { 93 94 bean.prerender(); 95 assertNotNull(bean.getTimestamp()); 96 97 } 98 99 100 // Test a pristine instance of {@link WelcomeBean} 101 public void testPristine() { 102 103 assertNull(bean.getTimestamp()); 104 105 } 106 107 108 }