refactor jvm-related liberty rspec tests

refactor the jvm-related liberty rspec tests for reuse