### Question:
InternalTypeMapping { public static String sqltypeForClass( Type type ) { String sqlType = TYPES.get( type ); if( sqlType == null ) { Type nativeType = findInternalType( type ); sqlType = TYPES.get( nativeType ); if( sqlType == null ) throw new IllegalArgumentException( String.format( "cannot map type %s to a sql type", type ) ); } return sqlType; }  static Type findInternalType( Type type ); static String sqltypeForClass( Type type );  }### Answer:
@Test public void testMappings() { assertEquals( "int not null", InternalTypeMapping.sqltypeForClass( int.class ) ); assertEquals( "int not null", InternalTypeMapping.sqltypeForClass( long.class ) ); assertEquals( "int", InternalTypeMapping.sqltypeForClass( Integer.class ) ); assertEquals( "int", InternalTypeMapping.sqltypeForClass( Long.class ) ); assertEquals( "varchar(256)", InternalTypeMapping.sqltypeForClass( String.class ) ); assertEquals( "timestamp", InternalTypeMapping.sqltypeForClass( Timestamp.class ) ); assertEquals( "time", InternalTypeMapping.sqltypeForClass( Time.class ) ); assertEquals( "date", InternalTypeMapping.sqltypeForClass( Date.class ) ); }
@Test(expected = IllegalArgumentException.class) public void testUnknownClass() { InternalTypeMapping.sqltypeForClass( boolean.class ); }
@Test public void testTypeWithCoercibles() { assertEquals( "date", InternalTypeMapping.sqltypeForClass( new SQLDateCoercibleType() ) ); assertEquals( "time", InternalTypeMapping.sqltypeForClass( new SQLTimeCoercibleType() ) ); assertEquals( "timestamp", InternalTypeMapping.sqltypeForClass( new SQLTimestampCoercibleType() ) ); }