File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/cfg/ListenerTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/cfg/ListenerTest.java | |||
Method name: void testSetListenerEmptyClassObjectArray()
|
Method name: void testSetListenersInvalidClassInstances()
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | Configuration cfg = new Configuration();↵ | 1 | Configuration cfg = new Configuration();↵ | |
2 | assertNotNull( cfg.getEventListeners().getDeleteEventListeners() );↵ | 2 | assertNotNull( cfg.getEventListeners().getDeleteEventListeners() );↵ | |
3 | try {↵ | 3 | try {↵ | |
4 | cfg.setListener( "delete", new Object[] { } );↵ | 4 | cfg.setListeners( "delete", new InvalidListenerForTest[] { new InvalidListenerForTest() } );↵ | |
5 | fail( "should have thrown java.lang.ArrayStoreException" );↵ | 5 | fail( "should have thrown java.lang.ClassCastException" );↵ | |
6 | }↵ | 6 | }↵ | |
7 | catch ( ArrayStoreException ex ) {↵ | 7 | catch ( ClassCastException ex ) {↵ | |
8 | // expected↵ | 8 | // expected↵ | |
9 | } | 9 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 11 |
Number of mapped statements | 5 |
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) | 2.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Configuration cfg = new Configuration(); | 1 | Configuration cfg = new Configuration(); | |||||||||||||||||||||||
2 | assertNotNull(cfg.getEventListeners().getDeleteEventListeners()); | 2 | assertNotNull(cfg.getEventListeners().getDeleteEventListeners()); | |||||||||||||||||||||||
3 | try |
| 3 | try | ||||||||||||||||||||||
4 | cfg.setListener("delete", new Object[] {}); |
| 5 | fail("should have thrown java.lang.ClassCastException"); | ||||||||||||||||||||||
5 | fail("should have thrown java.lang.ArrayStoreException"); |
| 4 | cfg.setListeners("delete", new InvalidListenerForTest[] {new InvalidListenerForTest()}); |
Row | Violation |
---|---|
1 | Expression cfg.setListener("delete",new Object[]{}) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression cfg.setListener("delete",new Object[]{}) is a void method call, and thus it cannot be parameterized |
3 | Expression fail("should have thrown java.lang.ClassCastException") is a void method call, and thus it cannot be parameterized |
4 | Expression cfg.setListener("delete",new Object[]{}) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression cfg.setListener("delete",new Object[]{}) is a void method call, and thus it cannot be parameterized |
6 | Expression fail("should have thrown java.lang.ClassCastException") is a void method call, and thus it cannot be parameterized |
7 | Expression cfg.setListeners("delete",new InvalidListenerForTest[]{new InvalidListenerForTest()}) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression fail("should have thrown java.lang.ArrayStoreException") is a void method call, and thus it cannot be parameterized |
9 | Expression cfg.setListeners("delete",new InvalidListenerForTest[]{new InvalidListenerForTest()}) is a void method call, and thus it cannot be parameterized |
10 | Expression cfg.setListeners("delete",new InvalidListenerForTest[]{new InvalidListenerForTest()}) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression fail("should have thrown java.lang.ArrayStoreException") is a void method call, and thus it cannot be parameterized |
12 | Expression cfg.setListeners("delete",new InvalidListenerForTest[]{new InvalidListenerForTest()}) is a void method call, and thus it cannot be parameterized |