john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

SQLColumnTest

//2012-04-15 johnpfeiffer
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.junit.Test;

public class SQLColumnTest
{
    @Test   public void testSQLColumn()
    {
        SQLColumn column = new SQLColumn( "field" , "type" , "nullable" , "key" , "defaultValue" , "extra" );
        if( column == null )
        {       fail( "Constructor returned null" );
        }
    }
    @Test   public void testSQLColumnFieldNull()
    {
        try{        SQLColumn column = new SQLColumn( null , "type" , "nullable" , "key" , "defaultValue" , "extra" );
        }catch( IllegalArgumentException iae )
        {       return;
      }
        fail( "Expected IllegalArgumentException" );
    }
    @Test   public void testSQLColumnNullableNull()
    {
        try{        SQLColumn column = new SQLColumn( "field" , null , "nullable" , "key" , "defaultValue" , "extra" );
        }catch( IllegalArgumentException iae )
        {       return;
      }
        fail( "Expected IllegalArgumentException" );
    }
    @Test   public void testSQLColumnKeyNull()
    {
        try{        SQLColumn column = new SQLColumn( "field" , "type" , "nullable" , null , "defaultValue" , "extra" );
        }catch( IllegalArgumentException iae )
        {       return;
      }
        fail( "Expected IllegalArgumentException" );
    }
    @Test   public void testSQLColumnDefaultValueNull()
    {
        try{        SQLColumn column = new SQLColumn( "field" , "type" , "nullable" , "key" , null , "extra" );
        }catch( IllegalArgumentException iae )
        {       return;
      }
        fail( "Expected IllegalArgumentException" );
    }
    @Test   public void testSQLColumnExtraNull()
    {
        try{        SQLColumn column = new SQLColumn( "field" , "type" , "nullable" , "key" , "defaultValue" , null );
        }catch( IllegalArgumentException iae )
        {       return;
      }
        fail( "Expected IllegalArgumentException" );
    }
    @Test   public void testSQLColumnFieldEmpty()
    {
        try{        SQLColumn column = new SQLColumn( "" , "type" , "nullable" , "key" , "defaultValue" , "extra" );
        }catch( IllegalArgumentException iae )
        {       return;
      }
        fail( "Expected IllegalArgumentException" );
    }
    @Test   public void testSQLColumnTypeNull()
    {
        try{        SQLColumn column = new SQLColumn( "field" , "" , "nullable" , "key" , "defaultValue" , "extra" );
        }catch( IllegalArgumentException iae )
        {       return;
      }
        fail( "Expected IllegalArgumentException" );
    }


    @Test   public void testGetField()
    {       SQLColumn column = new SQLColumn( "field" , "type" , "nullable" , "key" , "defaultValue" , "extra" );
            assertEquals( "field" , column.getField() );
    }
    @Test   public void testGetType()
    {       SQLColumn column = new SQLColumn( "field" , "type" , "nullable" , "key" , "defaultValue" , "extra" );
            assertEquals( "type" , column.getType() );
    }
    @Test   public void testGetNullable()
    {       SQLColumn column = new SQLColumn( "field" , "type" , "nullable" , "key" , "defaultValue" , "extra" );
            assertEquals( "nullable" , column.getNullable() );
    }
    @Test   public void testGetKey()
    {       SQLColumn column = new SQLColumn( "field" , "type" , "nullable" , "key" , "defaultValue" , "extra" );
            assertEquals( "key" , column.getKey() );
    }
    @Test   public void testGetDefaultValue()
    {       SQLColumn column = new SQLColumn( "field" , "type" , "nullable" , "key" , "defaultValue" , "extra" );
            assertEquals( "defaultValue" , column.getDefaultValue() );
    }
    @Test   public void testGetExtra()
    {       SQLColumn column = new SQLColumn( "field" , "type" , "nullable" , "key" , "defaultValue" , "extra" );
            assertEquals( "extra" , column.getExtra() );
    }

} // end class

  • « Microcore grub INCOMPLETE
  • SQLColumn »

Published

Apr 16, 2012

Category

java-classes

~290 words

Tags

  • classes 92
  • java 252
  • sqlcolumntest 1