File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/interceptor/InterceptorTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/interceptor/InterceptorTest.java | |||
Method name: void testCollectionIntercept()
|
Method name: void testPropertyIntercept()
|
|||
Number of AST nodes: 14 | Number of AST nodes: 15 | |||
1 | Session s = openSession( new CollectionInterceptor() );↵ | 1 | Session s = openSession( new PropertyInterceptor() );↵ | |
2 | Transaction t = s.beginTransaction();↵ | 2 | Transaction t = s.beginTransaction();↵ | |
3 | User u = new User("Gavin", "nivag");↵ | 3 | User u = new User("Gavin", "nivag");↵ | |
4 | s.persist(u);↵ | 4 | s.persist(u);↵ | |
5 | u.setPassword("vagni");↵ | 5 | u.setPassword("vagni");↵ | |
6 | t.commit();↵ | 6 | t.commit();↵ | |
7 | s.close();↵ | 7 | s.close();↵ | |
8 | s = openSession();↵ | 8 | s = openSession();↵ | |
9 | t = s.beginTransaction();↵ | 9 | t = s.beginTransaction();↵ | |
10 | u = (User) s.get(User.class, "Gavin");↵ | 10 | u = (User) s.get(User.class, "Gavin");↵ | |
11 | assertEquals( 2, u.getActions().size↵ | 11 | assertNotNull( u.getCreated() );↵ | |
12 | () );↵ | 12 | assertNotNull( u.getLastUpdated() );↵ | |
13 | s.delete(u);↵ | 13 | s.delete(u);↵ | |
14 | t.commit();↵ | 14 | t.commit();↵ | |
15 | s.close(); | 15 |
| |
See real code fragment | See real code fragment |
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.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 79 |
Number of mapped statements | 14 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Session s = openSession(new CollectionInterceptor()); |
| 1 | Session s = openSession(new PropertyInterceptor()); | |||||||||||||||||||||
2 | Transaction t = s.beginTransaction(); | 2 | Transaction t = s.beginTransaction(); | ||||||||||||||||||||||
3 | User u = new User("Gavin", "nivag"); | 3 | User u = new User("Gavin", "nivag"); | ||||||||||||||||||||||
4 | s.persist(u); | 4 | s.persist(u); | ||||||||||||||||||||||
5 | u.setPassword("vagni"); | 5 | u.setPassword("vagni"); | ||||||||||||||||||||||
6 | t.commit(); | 6 | t.commit(); | ||||||||||||||||||||||
7 | s.close(); | 7 | s.close(); | ||||||||||||||||||||||
8 | s = openSession(); | 8 | s = openSession(); | ||||||||||||||||||||||
9 | t = s.beginTransaction(); | 9 | t = s.beginTransaction(); | ||||||||||||||||||||||
10 | u = (User)s.get(User.class, "Gavin"); | 10 | u = (User)s.get(User.class, "Gavin"); | ||||||||||||||||||||||
11 | assertEquals(2, u.getActions().size()); |
| 11 | assertNotNull(u.getCreated()); | |||||||||||||||||||||
|
| 12 | assertNotNull(u.getLastUpdated()); | ||||||||||||||||||||||
12 | s.delete(u); | 13 | s.delete(u); | ||||||||||||||||||||||
13 | t.commit(); | 14 | t.commit(); | ||||||||||||||||||||||
14 | s.close(); | 15 | s.close(); |
Row | Violation |
---|---|
1 | Expression assertEquals(2,u.getActions().size()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression assertNotNull(u.getCreated()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression assertEquals(2,u.getActions().size()) is a void method call, and thus it cannot be parameterized |
4 | Expression assertNotNull(u.getCreated()) is a void method call, and thus it cannot be parameterized |
5 | Expression assertEquals(2,u.getActions().size()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression assertNotNull(u.getCreated()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression assertEquals(2,u.getActions().size()) is a void method call, and thus it cannot be parameterized |
8 | Expression assertNotNull(u.getCreated()) is a void method call, and thus it cannot be parameterized |
9 | Unmatched statement assertNotNull(u.getLastUpdated()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |