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/onetomany/OneToManyTest.java | |||
Method name: void testSetListenerClassName()
|
Method name: void testManyToManySize()
|
|||
Number of AST nodes: 5 | Number of AST nodes: 6 | |||
1 | Configuration cfg = new Configuration();↵ | 1 | Session ↵ | |
2 | assertNotNull( cfg.getEventListeners().getDeleteEventListeners() );↵ | |||
3 | cfg.setListener( "delete", DeleteListenerForTest.class.getName() );↵ | 2 | s = openSession();↵ | |
3 | Transaction t = s.beginTransaction();↵ | |||
4 | //this test raise an exception right now HHH-570↵ | |||
4 | assertEquals( 1, cfg.getEventListeners().getDeleteEventListeners().length );↵ | 5 | assertEquals( 0, ↵ | |
5 | assertTrue( cfg.getEventListeners().getDeleteEventListeners()[0] instanceof DeleteListenerForTest ↵ | 6 | s.createQuery("from Parent p where size(p.children) = 0").list().size() );↵ | |
7 | assertEquals( 0, s.createQuery("from Parent p where p.children.size = 0").list().size() );↵ | |||
8 | t.commit();↵ | |||
6 | ); | 9 | s.close(); | |
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.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 30 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Session s = openSession(); | ||||||||||||||||||||||
1 | Configuration cfg = new Configuration(); | | ||||||||||||||||||||||
| 2 | Transaction t = s.beginTransaction(); | ||||||||||||||||||||||
2 | assertNotNull(cfg.getEventListeners().getDeleteEventListeners()); |
| 3 | assertEquals(0, s.createQuery("from Parent p where size(p.children) = 0").list().size()); | ||||||||||||||||||||
3 | cfg.setListener("delete", DeleteListenerForTest.class.getName()); | | ||||||||||||||||||||||
4 | assertEquals(1, cfg.getEventListeners().getDeleteEventListeners().length); |
| 4 | assertEquals(0, s.createQuery("from Parent p where p.children.size = 0").list().size()); | ||||||||||||||||||||
5 | assertTrue(cfg.getEventListeners().getDeleteEventListeners()[0] instanceof DeleteListenerForTest); |
| 5 | t.commit(); | ||||||||||||||||||||
| 6 | s.close(); |
Row | Violation |
---|---|
1 | Expression assertNotNull(cfg.getEventListeners().getDeleteEventListeners()) is a void method call, and thus it cannot be parameterized |
2 | Expression assertEquals(0,s.createQuery("from Parent p where size(p.children) = 0").list().size()) is a void method call, and thus it cannot be parameterized |
3 | Expression assertNotNull(cfg.getEventListeners().getDeleteEventListeners()) is a void method call, and thus it cannot be parameterized |
4 | Expression assertEquals(0,s.createQuery("from Parent p where size(p.children) = 0").list().size()) is a void method call, and thus it cannot be parameterized |
5 | Expression assertTrue(cfg.getEventListeners().getDeleteEventListeners()[0] instanceof DeleteListenerForTest) is a void method call, and thus it cannot be parameterized |
6 | Expression t.commit() is a void method call, and thus it cannot be parameterized |
7 | Expression assertTrue(cfg.getEventListeners().getDeleteEventListeners()[0] instanceof DeleteListenerForTest) is a void method call, and thus it cannot be parameterized |
8 | Expression t.commit() is a void method call, and thus it cannot be parameterized |