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 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 4 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.4 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | try | | 1 | try |
2 | runtime.evalScriptlet("require 'somethingthatdoesnotexist'"); | | 2 | runtime.evalScriptlet("require 'rubygems'; require 'somethingthatdoesnotexist'"); |
Precondition Violations (0)
Row |
Violation |