LCOV - code coverage report
Current view: top level - extensions/client - ProjectWatchInfo.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 10 29 34.5 %
Date: 2022-11-19 15:00:39 Functions: 2 5 40.0 %

          Line data    Source code
       1             : // Copyright (C) 2016 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.client;
      16             : 
      17             : import java.util.Objects;
      18             : 
      19          16 : public class ProjectWatchInfo {
      20             :   public String project;
      21             :   public String filter;
      22             : 
      23             :   public Boolean notifyNewChanges;
      24             :   public Boolean notifyNewPatchSets;
      25             :   public Boolean notifyAllComments;
      26             :   public Boolean notifySubmittedChanges;
      27             :   public Boolean notifyAbandonedChanges;
      28             : 
      29             :   @Override
      30             :   public boolean equals(Object obj) {
      31           1 :     if (obj instanceof ProjectWatchInfo) {
      32           1 :       ProjectWatchInfo w = (ProjectWatchInfo) obj;
      33           1 :       return Objects.equals(project, w.project)
      34           1 :           && Objects.equals(filter, w.filter)
      35           1 :           && Objects.equals(notifyNewChanges, w.notifyNewChanges)
      36           1 :           && Objects.equals(notifyNewPatchSets, w.notifyNewPatchSets)
      37           1 :           && Objects.equals(notifyAllComments, w.notifyAllComments)
      38           1 :           && Objects.equals(notifySubmittedChanges, w.notifySubmittedChanges)
      39           1 :           && Objects.equals(notifyAbandonedChanges, w.notifyAbandonedChanges);
      40             :     }
      41           0 :     return false;
      42             :   }
      43             : 
      44             :   @Override
      45             :   public int hashCode() {
      46           0 :     return Objects.hash(
      47             :         project,
      48             :         filter,
      49             :         notifyNewChanges,
      50             :         notifyNewPatchSets,
      51             :         notifyAllComments,
      52             :         notifySubmittedChanges,
      53             :         notifyAbandonedChanges);
      54             :   }
      55             : 
      56             :   @Override
      57             :   @SuppressWarnings("OrphanedFormatString")
      58             :   public String toString() {
      59           0 :     StringBuilder b = new StringBuilder();
      60           0 :     b.append(project);
      61           0 :     if (filter != null) {
      62           0 :       b.append("%filter=").append(filter);
      63             :     }
      64           0 :     b.append("(notifyAbandonedChanges=")
      65           0 :         .append(toBoolean(notifyAbandonedChanges))
      66           0 :         .append(", notifyAllComments=")
      67           0 :         .append(toBoolean(notifyAllComments))
      68           0 :         .append(", notifyNewChanges=")
      69           0 :         .append(toBoolean(notifyNewChanges))
      70           0 :         .append(", notifyNewPatchSets=")
      71           0 :         .append(toBoolean(notifyNewPatchSets))
      72           0 :         .append(", notifySubmittedChanges=")
      73           0 :         .append(toBoolean(notifySubmittedChanges))
      74           0 :         .append(")");
      75           0 :     return b.toString();
      76             :   }
      77             : 
      78             :   private boolean toBoolean(Boolean b) {
      79           0 :     return b == null ? false : b;
      80             :   }
      81             : }

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