Clover coverage report -
Coverage timestamp: Wed Jan 31 2007 15:38:53 EST
file stats: LOC: 95   Methods: 6
NCLOC: 52   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
EnumTest.java - 94.4% 83.3% 91.7%
coverage coverage
 1    /*
 2    * JBoss, Home of Professional Open Source.
 3    * Copyright 2006, Red Hat Middleware LLC, and individual contributors
 4    * as indicated by the @author tags. See the copyright.txt file in the
 5    * distribution for a full listing of individual contributors.
 6    *
 7    * This is free software; you can redistribute it and/or modify it
 8    * under the terms of the GNU Lesser General Public License as
 9    * published by the Free Software Foundation; either version 2.1 of
 10    * the License, or (at your option) any later version.
 11    *
 12    * This software is distributed in the hope that it will be useful,
 13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 15    * Lesser General Public License for more details.
 16    *
 17    * You should have received a copy of the GNU Lesser General Public
 18    * License along with this software; if not, write to the Free
 19    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 20    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 21    */
 22   
 23    package org.jboss.cache.pojo;
 24   
 25    import junit.framework.TestCase;
 26    import junit.framework.Test;
 27    import junit.framework.TestSuite;
 28    import org.apache.commons.logging.Log;
 29    import org.apache.commons.logging.LogFactory;
 30    import org.jboss.cache.config.Configuration.CacheMode;
 31    import org.jboss.cache.factories.UnitTestCacheFactory;
 32    import org.jboss.cache.pojo.test.ArrayObject;
 33    import org.jboss.cache.pojo.test.Person;
 34    import org.jboss.cache.pojo.test.EnumPlanet;
 35   
 36    /**
 37    * Basic PojoCache test case for Enum.
 38    *
 39    * @author Ben Wang
 40    */
 41   
 42    public class EnumTest extends TestCase
 43    {
 44    Log log = LogFactory.getLog(EnumTest.class);
 45    PojoCache cache_, cache1_;
 46   
 47  2 public EnumTest(String name)
 48    {
 49  2 super(name);
 50    }
 51   
 52  2 protected void setUp() throws Exception
 53    {
 54  2 super.setUp();
 55  2 log.info("setUp() ....");
 56  2 boolean toStart = true;
 57  2 cache_ = PojoCacheFactory.createCache(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC), toStart);
 58  2 cache1_ = PojoCacheFactory.createCache(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC), toStart);
 59    }
 60   
 61  2 protected void tearDown() throws Exception
 62    {
 63  2 super.tearDown();
 64  2 cache_.stop();
 65  2 cache1_.stop();
 66    }
 67   
 68  2 public void testSimple() throws Exception
 69    {
 70  2 log.info("testSimple() ....");
 71   
 72  2 double earthWeight = 165;
 73  2 double mass = earthWeight / EnumPlanet.EARTH.surfaceGravity();
 74   
 75  2 cache_.attach("enum", EnumPlanet.EARTH);
 76   
 77  2 EnumPlanet ep = (EnumPlanet)cache1_.find("enum");
 78   
 79  2 EnumPlanet.EARTH.setMass(7.0e+24);
 80   
 81  2 assertEquals("Earth mass ", EnumPlanet.EARTH.mass(), ep.mass());
 82    }
 83   
 84  2 public static Test suite() throws Exception
 85    {
 86  2 return new TestSuite(EnumTest.class);
 87    }
 88   
 89   
 90  0 public static void main(String[] args) throws Exception
 91    {
 92  0 junit.textui.TestRunner.run(suite());
 93    }
 94   
 95    }