Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 70   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    import org.jboss.cache.factories.XmlConfigurationParser;
 11    import org.jboss.cache.xml.XmlHelper;
 12    import org.w3c.dom.Element;
 13   
 14    /**
 15    * LFU Configuration test.
 16    *
 17    * @author Daniel Huang (dhuang@jboss.org)
 18    * @version $Revision: 1.6 $
 19    */
 20    public class LFUConfigurationTest extends TestCase
 21    {
 22   
 23  1 public void testXMLParsing() throws Exception
 24    {
 25  1 LFUConfiguration config = new LFUConfiguration();
 26  1 String xml =
 27    "<region name=\"abc\">" +
 28    "<attribute name=\"minNodes\">10</attribute>" +
 29    "<attribute name=\"maxNodes\">20</attribute>" +
 30    "</region>";
 31   
 32  1 Element element = XmlHelper.stringToElement(xml);
 33   
 34  1 XmlConfigurationParser.parseEvictionPolicyConfig(element, config);
 35   
 36  1 assertEquals(10, config.getMinNodes());
 37  1 assertEquals(20, config.getMaxNodes());
 38    }
 39   
 40  1 public void testXMLParsing2() throws Exception
 41    {
 42  1 LFUConfiguration config = new LFUConfiguration();
 43  1 String xml =
 44    "<region name=\"abc\">" +
 45    "<attribute name=\"minNodes\">10</attribute>" +
 46    "</region>";
 47  1 Element element = XmlHelper.stringToElement(xml);
 48   
 49  1 XmlConfigurationParser.parseEvictionPolicyConfig(element, config);
 50   
 51  1 assertEquals(10, config.getMinNodes());
 52  1 assertEquals(0, config.getMaxNodes());
 53    }
 54   
 55  1 public void testXMLParsing3() throws Exception
 56    {
 57  1 LFUConfiguration config = new LFUConfiguration();
 58  1 String xml =
 59    "<region name=\"abc\">" +
 60    "<attribute name=\"maxNodes\">20</attribute>" +
 61    "</region>";
 62  1 Element element = XmlHelper.stringToElement(xml);
 63   
 64  1 XmlConfigurationParser.parseEvictionPolicyConfig(element, config);
 65   
 66  1 assertEquals(0, config.getMinNodes());
 67  1 assertEquals(20, config.getMaxNodes());
 68   
 69    }
 70    }