require 'java'
require 'models/data_types'
require 'db/derby'
require 'test/unit'

JInteger = java.lang.Integer

class TypeConversionTest < Test::Unit::TestCase

  def setup
    DbTypeMigration.up  
    DbType.create(
      :sample_timestamp => Time.at(1169964202),
      :sample_decimal => JInteger::MAX_VALUE + 1)
  end
  
  def teardown
    DbTypeMigration.down
  end
  
  def test_timestamp
    types = DbType.find(:first)
    assert_equal 'Sun Jan 28 06:03:22 UTC 2007', types.sample_timestamp.getutc.to_s
  end
  
  def test_decimal
    types = DbType.find(:first)
    assert_equal((JInteger::MAX_VALUE + 1), types.sample_decimal)
  end
end
require 'java'
require 'models/data_types'
require 'db/derby'
require 'test/unit'

JInteger = java.lang.Integer

class TypeConversionTest < Test::Unit::TestCase
  TEST_TIME = Time.at(1169964202)
  def setup
    DbTypeMigration.up  
    DbType.create(
      :sample_timestamp => TEST_TIME,
      :sample_decimal => JInteger::MAX_VALUE + 1)
  end
  
  def teardown
    DbTypeMigration.down
  end
  
  def test_timestamp
    types = DbType.find(:first)
    assert_equal TEST_TIME, types.sample_timestamp.getutc
  end
  
  def test_decimal
    types = DbType.find(:first)
    assert_equal((JInteger::MAX_VALUE + 1), types.sample_decimal)
  end
end

Fix the test to actually compare times instead of string representations of time.
Fix the test to actually compare times instead of string representations of time.

git-svn-id: 0d15740d2b2329e9094a4e8932733054e5d3e04c@491 8ba958d5-0c1a-0410-94a6-a65dfc1b28a6
