kyoty opened a new pull request #5666:
URL: https://github.com/apache/dolphinscheduler/pull/5666


   ## Purpose of the pull request
   Try to introduce several methods like below in `Result`:
   ```java
       public boolean isSuccess() {
           return this.isStatus(Status.SUCCESS);
       }
   
       public boolean isFailed() {
           return !this.isSuccess();
       }
   
       public boolean isStatus(Status status) {
           return this.code != null && this.code.equals(status.getCode());
       }
   ```
   
   The purpose of this is to reduce some tedious template code:
   ```java
   // can be replaced by isConnection.isFailed()
   if (Status.SUCCESS.getCode() != isConnection.getCode()) {
     ....
   }
   
   // can be replaced by isConnection.isSuccess()
   if (Status.SUCCESS.getCode() == result.getCode()) {
     ....
   }
   
   // can be replaced by 
Assert.assertTrue(result.isStatus(Status.CREATE_ACCESS_TOKEN_ERROR));
   Assert.assertEquals(Status.CREATE_ACCESS_TOKEN_ERROR.getCode(), 
result.getCode().intValue());
   ```
   
   
   The
   ## Brief change log
   No new features, using existing UTs.


-- 
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]


Reply via email to