gilvansfilho commented on code in PR #8549:
URL: https://github.com/apache/camel/pull/8549#discussion_r998689695


##########
components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaComponentTest.java:
##########
@@ -44,6 +44,7 @@ public void testJpaComponentConsumerHasLockModeType() throws 
Exception {
         JpaConsumer consumer = (JpaConsumer) jpa.createConsumer(null);
 
         assertEquals(LockModeType.PESSIMISTIC_WRITE, 
consumer.getLockModeType());
+        comp.close();

Review Comment:
   Code will be something like: 
   
   ```
   @Test
   public void testJpaComponentConsumerHasLockModeType() throws Exception {
       try (JpaComponent comp = new JpaComponent()) {
           comp.setCamelContext(context);
           assertNull(comp.getEntityManagerFactory());
           assertNull(comp.getTransactionManager());
           JpaEndpoint jpa
               = (JpaEndpoint) comp.createEndpoint("jpa://" + 
SendEmail.class.getName() + "?lockModeType=PESSIMISTIC_WRITE");
           JpaConsumer consumer = (JpaConsumer) jpa.createConsumer(null);
           assertEquals(LockModeType.PESSIMISTIC_WRITE, 
consumer.getLockModeType());
       } catch (Exception e) {
           throw e; //or e.printStackTrace();
       }
   }
   ```
   
   Once we will not handle the exception I believe is not necessary use 
try-with-resource.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to