    001package org.apache.turbine;
    002
    003
    004/*
    005 * Licensed to the Apache Software Foundation (ASF) under one
    006 * or more contributor license agreements.  See the NOTICE file
    007 * distributed with this work for additional information
    008 * regarding copyright ownership.  The ASF licenses this file
    009 * to you under the Apache License, Version 2.0 (the
    010 * "License"); you may not use this file except in compliance
    011 * with the License.  You may obtain a copy of the License at
    012 *
    013 *   http://www.apache.org/licenses/LICENSE-2.0
    014 *
    015 * Unless required by applicable law or agreed to in writing,
    016 * software distributed under the License is distributed on an
    017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    018 * KIND, either express or implied.  See the License for the
    019 * specific language governing permissions and limitations
    020 * under the License.
    021 */
    022
    023
    024import org.apache.turbine.test.BaseTestCase;
    025import org.apache.turbine.util.TurbineConfig;
    026import org.junit.AfterClass;
    027import org.junit.BeforeClass;
    028import org.junit.Test;
    029
    030/**
    031 * Can we call "destroy" unconditionally on our Turbine Servlet, even if
    032 * it hasn't configured?
    033 *
    034 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
    035 * @version $Id: DestroyTest.java 1606111 2014-06-27 14:46:47Z gk $
    036 */
    037public class DestroyTest
    038    extends BaseTestCase
    039{
    040    private static TurbineConfig tc = null;
    041
    042
    043    @BeforeClass
    044    public static void init() throws Exception {
    045        tc = new TurbineConfig(".", "/conf/test/TemplateService.properties");
    046    }
    047    @Test
    048    public void testDestroy()
    049        throws Exception
    050    {
    051        Turbine t = new Turbine();
    052        t.destroy();
    053    }
    054    @Test
    055    public void testInitAndDestroy()
    056        throws Exception
    057    {
    058        tc.initialize();
    059        tc.dispose();
    060    }
    061
    062    @AfterClass
    063    public static void destroy()
    064        throws Exception
    065    {
    066        // should be already dispoesd
    067        //tc.dispose();
    068    }
    069}