WillemJiang commented on a change in pull request #10: SCB-1400 Complement and 
improve unit test
URL: https://github.com/apache/servicecomb-toolkit/pull/10#discussion_r309009558
 
 

 ##########
 File path: 
contractgen/src/test/java/org/apache/servicecomb/toolkit/contractgen/DefaultContractsGeneratorTest.java
 ##########
 @@ -115,12 +121,30 @@ public void testCheckConfig() throws 
NoSuchMethodException, InvocationTargetExce
   }
 
   @Test
-  public void testPrivateCanProcess() throws NoSuchMethodException, 
InvocationTargetException, IllegalAccessException {
+  public void testPrivateCanProcess() throws Exception {
     DefaultContractsGenerator defaultContractsGenerator = new 
DefaultContractsGenerator();
     Method method = 
defaultContractsGenerator.getClass().getDeclaredMethod("canProcess", new 
Class[] {Class.class});
     method.setAccessible(true);
 
     assertFalse((boolean) method.invoke(defaultContractsGenerator, new 
Object[] {null}));
+
+    Class mockClass;
+    ContractTestUtil contractTestUtil = new ContractTestUtil();
+
+    CtClass ctClass = contractTestUtil.createCtClass("TestCanProcess");
+    assertFalse((boolean) method.invoke("TestCanProcess", ctClass.toClass()));
 
 Review comment:
   Java supports the AutoBoxing since JDK6, you don't need add the type case 
here.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to