try { cfg.addFile( file.getAbsolutePath() ); fail(); } catch ( InvalidMappingException inv ) { assertEquals( inv.getType(), "file" ); assertEquals( inv.getPath(), file.getPath() ); assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) ); }
try { cfg.addResource( resourceName, getClass().getClassLoader() ); fail(); } catch ( InvalidMappingException inv ) { assertEquals( inv.getType(), "resource" ); assertEquals( inv.getPath(), resourceName ); assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/mappingexception/MappingExceptionTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/mappingexception/MappingExceptionTest.java
Method name: void testInvalidMapping() Method name: void testInvalidMapping()
Number of AST nodes: 3 Number of AST nodes: 3
1
try {
1
try {
2
			cfg.addFile( file.getAbsolutePath() );
2
			cfg.addResource( resourceName, getClass().getClassLoader() );
3
			fail();
3
			fail();
4
		}
4
		}
5
		catch ( InvalidMappingException inv ) {
5
		catch ( InvalidMappingException inv ) {
6
			assertEquals( inv.getType(), "file" );
6
			assertEquals( inv.getType(), "resource" );
7
			assertEquals( inv.getPath(), file.getPath() );
7
			assertEquals( inv.getPath(), resourceName );
8
			assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
8
			assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
9
		}
9
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are in the same method
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)517.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    15
    try
    15
    try
    27
    try
    Differences
    Expression1Expression2Difference
    "file""resource"LITERAL_VALUE_MISMATCH
    file.getPath()resourceNameTYPE_COMPATIBLE_REPLACEMENT
    27
    try
    16
    cfg.addFile(file.getAbsolutePath());
    16
    cfg.addFile(file.getAbsolutePath());
    28
    cfg.addResource(resourceName, getClass().getClassLoader());
    Differences
    Expression1Expression2Difference
    addFileaddResourceMETHOD_INVOCATION_NAME_MISMATCH
    cfg.addFile(file.getAbsolutePath())cfg.addResource(resourceName,getClass().getClassLoader())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression cfg.addFile(file.getAbsolutePath()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression cfg.addResource(resourceName,getClass().getClassLoader()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression cfg.addFile(file.getAbsolutePath()) is a void method call, and thus it cannot be parameterized
    Expression cfg.addResource(resourceName,getClass().getClassLoader()) is a void method call, and thus it cannot be parameterized
    Expression cfg.addFile(file.getAbsolutePath()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression cfg.addResource(resourceName,getClass().getClassLoader()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression cfg.addFile(file.getAbsolutePath()) is a void method call, and thus it cannot be parameterized
    Expression cfg.addResource(resourceName,getClass().getClassLoader()) is a void method call, and thus it cannot be parameterized
    28
    cfg.addResource(resourceName, getClass().getClassLoader());
    17
    fail();
    29
    fail();
    Precondition Violations (8)
    Row Violation
    1Expression cfg.addFile(file.getAbsolutePath()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression cfg.addResource(resourceName,getClass().getClassLoader()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression cfg.addFile(file.getAbsolutePath()) is a void method call, and thus it cannot be parameterized
    4Expression cfg.addResource(resourceName,getClass().getClassLoader()) is a void method call, and thus it cannot be parameterized
    5Expression cfg.addFile(file.getAbsolutePath()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression cfg.addResource(resourceName,getClass().getClassLoader()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression cfg.addFile(file.getAbsolutePath()) is a void method call, and thus it cannot be parameterized
    8Expression cfg.addResource(resourceName,getClass().getClassLoader()) is a void method call, and thus it cannot be parameterized