Sha256: b3f008b9d33c99bfb20c70bdd5273147dfcb330b96d4be9d68ff19b4820b35df

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
# License:   Apache License, Version 2.0

require File.dirname(__FILE__) + '/../../../spec_helper'

if RUBY_PLATFORM =~ /java/
  module Java::JavaLang::Iterable
    describe self do
      before(:each) do
        @tm = get_used_tm_sys_tm
      end
      it "should respond to :first" do
        java.util.HashSet.new.should respond_to(:first)
      end
      describe "#first" do
        it "should give back one containee of the Iterable" do
          topic = @tm.get!("Person")
          names = [topic.create_name("Name1"), topic.create_name("Name2"), topic.create_name("Name3")]
          topic.names.should be_a_kind_of Enumerable
          lambda{topic.names.first}.should_not raise_error
          names.should include topic.names.first
        end
        it "should give back nil if the Set is empty" do
          topic = @tm.get!("Person")
          set = topic.occurrences
          set.should be_empty
          set.should be_a_kind_of(Enumerable)
          set.first.should be_nil
        end
        
      end
    end # of describe self
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rtm-0.3.1 spec/rtm/tmapi/ext/java_util_set_spec.rb
rtm-0.3.0 spec/rtm/tmapi/ext/java_util_set_spec.rb
rtm-0.2.1 spec/rtm/tmapi/ext/java_util_set_spec.rb
rtm-0.2.0 spec/rtm/tmapi/ext/java_util_set_spec.rb
rtm-0.2 spec/rtm/tmapi/ext/java_util_set_spec.rb