Clover coverage report -
Coverage timestamp: Wed Jan 31 2007 15:38:53 EST
file stats: LOC: 71   Methods: 3
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LFUConfigurationTest.java - 100% 100% 100%
coverage
 1    /*
 2    * JBoss, the OpenSource J2EE webOS
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache.eviction;
 8   
 9    import junit.framework.TestCase;
 10   
 11    import org.jboss.cache.factories.XmlConfigurationParser;
 12    import org.jboss.cache.xml.XmlHelper;
 13    import org.w3c.dom.Element;
 14   
 15    /**
 16    * LFU Configuration test.
 17    *
 18    * @author Daniel Huang (dhuang@jboss.org)
 19    * @version $Revision: 1.5 $
 20    */
 21    public class LFUConfigurationTest extends TestCase
 22    {
 23   
 24  1 public void testXMLParsing() throws Exception
 25    {
 26  1 LFUConfiguration config = new LFUConfiguration();
 27  1 String xml =
 28    "<region name=\"abc\">" +
 29    "<attribute name=\"minNodes\">10</attribute>" +
 30    "<attribute name=\"maxNodes\">20</attribute>" +
 31    "</region>";
 32   
 33  1 Element element = XmlHelper.stringToElement(xml);
 34   
 35  1 XmlConfigurationParser.parseEvictionPolicyConfig(element, config);
 36   
 37  1 assertEquals(10, config.getMinNodes());
 38  1 assertEquals(20, config.getMaxNodes());
 39    }
 40   
 41  1 public void testXMLParsing2() throws Exception
 42    {
 43  1 LFUConfiguration config = new LFUConfiguration();
 44  1 String xml =
 45    "<region name=\"abc\">" +
 46    "<attribute name=\"minNodes\">10</attribute>" +
 47    "</region>";
 48  1 Element element = XmlHelper.stringToElement(xml);
 49   
 50  1 XmlConfigurationParser.parseEvictionPolicyConfig(element, config);
 51   
 52  1 assertEquals(10, config.getMinNodes());
 53  1 assertEquals(0, config.getMaxNodes());
 54    }
 55   
 56  1 public void testXMLParsing3() throws Exception
 57    {
 58  1 LFUConfiguration config = new LFUConfiguration();
 59  1 String xml =
 60    "<region name=\"abc\">" +
 61    "<attribute name=\"maxNodes\">20</attribute>" +
 62    "</region>";
 63  1 Element element = XmlHelper.stringToElement(xml);
 64   
 65  1 XmlConfigurationParser.parseEvictionPolicyConfig(element, config);
 66   
 67  1 assertEquals(0, config.getMinNodes());
 68  1 assertEquals(20, config.getMaxNodes());
 69   
 70    }
 71    }