Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (24 sloc) 0.717 kb
require 'test/unit'
require 'java'
require 'jruby'
require 'jruby/serialization'
require 'fileutils'
import java.io.ObjectOutputStream
import java.io.FileOutputStream
import java.io.FileInputStream
class TestJrubyObjectInputStream < Test::Unit::TestCase
def test_serialize_and_deserialize_java_object
str = java.lang.String.new("hi")
out_stream = ObjectOutputStream.new(FileOutputStream.new("store"))
out_stream.write_object(str)
out_stream.close
in_stream = JRubyObjectInputStream.new(FileInputStream.new("store"))
str2 = nil
assert_nothing_raised do
str2 = in_stream.read_object
end
in_stream.close
FileUtils.rm_f "store"
assert_equal str,str2
end
end
Jump to Line
Something went wrong with that request. Please try again.