try{ // presumably this require should fail runtime.evalScriptlet("require 'somethingthatdoesnotexist'"); } catch (RaiseException e){ assertEquals("Require of non-existent library should fail", RaiseException.class, e.getClass()); assertNull("Require of non-existent library should , exception should only be RaiseException with no root cause", e.getCause()); }
try{ // JRUBY-646 // presumably this require should fail runtime.evalScriptlet("require 'rubygems'; require 'somethingthatdoesnotexist'"); } catch (RaiseException e){ assertEquals("Require of non-existent library should fail", RaiseException.class, e.getClass()); assertNull("Require of non-existent library should , exception should only be RaiseException with no root cause", e.getCause()); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/test/org/jruby/test/TestLoadService.java File path: /jruby-1.4.0/test/org/jruby/test/TestLoadService.java
Method name: void testNonExistentRequire() Method name: void testNonExistentRequireAfterRubyGems()
Number of AST nodes: 2 Number of AST nodes: 2
1
try{
1
try{
2
            // JRUBY-646
2
            // presumably this require should fail
3
            // presumably this require should fail
3
            runtime.evalScriptlet("require 'somethingthatdoesnotexist'");
4
            runtime.evalScriptlet("require 'rubygems'; require 'somethingthatdoesnotexist'");
4
        } catch (RaiseException e){
5
        } catch (RaiseException e){
5
            assertEquals("Require of non-existent library should fail", RaiseException.class, e.getClass());
6
            assertEquals("Require of non-existent library should fail", RaiseException.class, e.getClass());
6
            assertNull("Require of non-existent library should , exception should only be RaiseException with no root cause", e.getCause());
7
            assertNull("Require of non-existent library should , exception should only be RaiseException with no root cause", e.getCause());
7
        }
8
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are declared in the same class
Number of node comparisons4
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    2
    runtime.evalScriptlet("require 'somethingthatdoesnotexist'");
    2
    runtime.evalScriptlet("require 'somethingthatdoesnotexist'");
    2
    runtime.evalScriptlet("require 'rubygems'; require 'somethingthatdoesnotexist'");
    Differences
    Expression1Expression2Difference
    "require 'somethingthatdoesnotexist'""require 'rubygems'; require 'somethingthatdoesnotexist'"LITERAL_VALUE_MISMATCH
    2
    runtime.evalScriptlet("require 'rubygems'; require 'somethingthatdoesnotexist'");
    Precondition Violations (0)
    Row Violation