Clover coverage report - Drools - 2.0-rc2
Coverage timestamp: Wed May 11 2005 07:12:26 BST
file stats: LOC: 36   Methods: 2
NCLOC: 31   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ApplicationDataParameterValue.java 100% 100% 100% 100%
coverage
 1    package org.drools.semantics.annotation.model;
 2   
 3    import org.drools.spi.Tuple;
 4   
 5    class ApplicationDataParameterValue implements ParameterValue
 6    {
 7    private final String name;
 8    private final Class< ? > clazz;
 9   
 10  8 public ApplicationDataParameterValue(String name, Class< ? > clazz)
 11    {
 12  8 if (name == null)
 13    {
 14  1 throw new IllegalArgumentException( "Null 'name' argument" );
 15    }
 16  7 if (clazz == null)
 17    {
 18  1 throw new IllegalArgumentException( "Null 'clazz' argument" );
 19    }
 20  6 this.name = name;
 21  6 this.clazz = clazz;
 22    }
 23   
 24  2 public Object getValue( Tuple tuple )
 25    {
 26  2 Object value = tuple.getWorkingMemory( ).getApplicationData( name );
 27  2 if (!clazz.isAssignableFrom( value.getClass( ) ))
 28    {
 29    // TODO What is the apprioriate drools exception to throw here?
 30  1 throw new IllegalStateException( "Application data class different than declaration"
 31    + ": app-data-name = " + name + ", expected class = " + clazz
 32    + ", actual class = " + value.getClass( ) );
 33    }
 34  1 return value;
 35    }
 36    }