Ignore:
Timestamp:
Jul 29, 2008, 11:56:32 PM (16 years ago)
Author:
KOBAYASHI, Shinji
Message:

refs #39
fixed Object_Ref, Object_ID

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/models/tests/test_reference_model.rb

    r93 r94  
    147147  def setup
    148148    assert_nothing_raised(Exception){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.3")}
     149    assert_nothing_raised(Exception){@object_ref = OpenEHR::RM::Support::Identification::Object_Ref.new('local', 'ANY', @object_id)}
    149150    assert_nothing_raised(Exception){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
    150151    assert_nothing_raised(Exception){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new("0.0.7", 'terminology','0.0.3')}
     
    155156  def test_init
    156157    assert_instance_of OpenEHR::RM::Support::Identification::Object_ID, @object_id
     158    assert_instance_of OpenEHR::RM::Support::Identification::Object_Ref, @object_ref
    157159    assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, @archetype_id
    158160    assert_instance_of OpenEHR::RM::Support::Identification::Terminology_ID, @terminology_id
     
    170172    assert_raise(ArgumentError){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new(nil)}
    171173    assert_raise(ArgumentError){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new("")}
     174  end
     175
     176  def test_object_refs
     177    assert_equal 'local', @object_ref.namespace
     178    assert_equal 'ANY', @object_ref.type
     179    assert_equal @object_id, @object_ref.id
     180
     181    assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new}
     182    assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new(nil, 'ANY', @object_id)}
     183    assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new('', 'ANY', @object_id)}
     184    assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new('local', nil, @object_id)}
     185    assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new('local', '', @object_id)}
     186    assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new('local', 'ANY', nil)}
     187
     188    assert_nothing_raised(Exception){@object_ref.namespace = 'terminology'}
     189    assert_equal 'terminology', @object_ref.namespace
     190    assert_raise(ArgumentError){@object_ref.namespace = nil}
     191    assert_raise(ArgumentError){@object_ref.namespace = ''}
     192    assert_raise(ArgumentError){@object_ref.namespace = '?&&'}
     193    assert_raise(ArgumentError){@object_ref.namespace = '843'}
     194
     195    assert_nothing_raised(Exception){@object_ref.type = 'GUIDELINE'}
     196    assert_equal 'GUIDELINE', @object_ref.type
     197    assert_raise(ArgumentError){@object_ref.type = nil}
     198    assert_raise(ArgumentError){@object_ref.type = ''}
     199
     200    assert_nothing_raised(Exception){@object_ref.id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.5")}
     201    assert_equal OpenEHR::RM::Support::Identification::Object_ID.new("0.0.5"), @object_ref.id
     202    assert_raise(ArgumentError){@object_ref.id = nil}
    172203  end
    173204
Note: See TracChangeset for help on using the changeset viewer.