LCOV - code coverage report
Current view: top level - extensions/common - SubmitRequirementResultInfo.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 17 21 81.0 %
Date: 2022-11-19 15:00:39 Functions: 3 4 75.0 %

          Line data    Source code
       1             : // Copyright (C) 2021 The Android Open Source Project
       2             : //
       3             : // Licensed under the Apache License, Version 2.0 (the "License");
       4             : // you may not use this file except in compliance with the License.
       5             : // You may obtain a copy of the License at
       6             : //
       7             : // http://www.apache.org/licenses/LICENSE-2.0
       8             : //
       9             : // Unless required by applicable law or agreed to in writing, software
      10             : // distributed under the License is distributed on an "AS IS" BASIS,
      11             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             : // See the License for the specific language governing permissions and
      13             : // limitations under the License.
      14             : 
      15             : package com.google.gerrit.extensions.common;
      16             : 
      17             : import com.google.gerrit.common.Nullable;
      18             : import java.util.Objects;
      19             : 
      20             : /** Result of evaluating a submit requirement on a change. */
      21         104 : public class SubmitRequirementResultInfo {
      22         103 :   public enum Status {
      23             :     /** Submit requirement is fulfilled. */
      24         103 :     SATISFIED,
      25             : 
      26             :     /**
      27             :      * Submit requirement is not satisfied. Happens when {@code submittabilityExpressionResult} is
      28             :      * not fulfilled.
      29             :      */
      30         103 :     UNSATISFIED,
      31             : 
      32             :     /**
      33             :      * Submit requirement is overridden. Happens when {@code overrideExpressionResult} is fulfilled.
      34             :      */
      35         103 :     OVERRIDDEN,
      36             : 
      37             :     /**
      38             :      * Submit requirement is not applicable for the change. Happens when {@code
      39             :      * applicabilityExpressionResult} is not fulfilled.
      40             :      */
      41         103 :     NOT_APPLICABLE,
      42             : 
      43             :     /**
      44             :      * Any of the applicability, submittability or override expressions contain invalid syntax and
      45             :      * are not parsable.
      46             :      */
      47         103 :     ERROR,
      48             : 
      49             :     /**
      50             :      * The "submit requirement" was bypassed during submission, e.g. by pushing for review with the
      51             :      * %submit option.
      52             :      */
      53         103 :     FORCED
      54             :   }
      55             : 
      56             :   /** Submit requirement name. */
      57             :   public String name;
      58             : 
      59             :   /** Submit requirement description. */
      60             :   public String description;
      61             : 
      62             :   /** Overall result (status) of evaluating this submit requirement. */
      63             :   public Status status;
      64             : 
      65             :   /** Whether this result was created from a legacy submit record. */
      66             :   public boolean isLegacy;
      67             : 
      68             :   /** Result of evaluating the applicability expression. */
      69             :   @Nullable public SubmitRequirementExpressionInfo applicabilityExpressionResult;
      70             : 
      71             :   /** Result of evaluating the submittability expression. */
      72             :   @Nullable public SubmitRequirementExpressionInfo submittabilityExpressionResult;
      73             : 
      74             :   /** Result of evaluating the override expression. */
      75             :   @Nullable public SubmitRequirementExpressionInfo overrideExpressionResult;
      76             : 
      77             :   @Override
      78             :   public boolean equals(Object o) {
      79           1 :     if (this == o) {
      80           0 :       return true;
      81             :     }
      82           1 :     if (!(o instanceof SubmitRequirementResultInfo)) {
      83           0 :       return false;
      84             :     }
      85           1 :     SubmitRequirementResultInfo that = (SubmitRequirementResultInfo) o;
      86           1 :     return isLegacy == that.isLegacy
      87           1 :         && Objects.equals(name, that.name)
      88           1 :         && Objects.equals(description, that.description)
      89             :         && status == that.status
      90           1 :         && Objects.equals(applicabilityExpressionResult, that.applicabilityExpressionResult)
      91           1 :         && Objects.equals(submittabilityExpressionResult, that.submittabilityExpressionResult)
      92           1 :         && Objects.equals(overrideExpressionResult, that.overrideExpressionResult);
      93             :   }
      94             : 
      95             :   @Override
      96             :   public int hashCode() {
      97           0 :     return Objects.hash(
      98             :         name,
      99             :         description,
     100             :         status,
     101           0 :         isLegacy,
     102             :         applicabilityExpressionResult,
     103             :         submittabilityExpressionResult,
     104             :         overrideExpressionResult);
     105             :   }
     106             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750