LCOV - code coverage report
Current view: top level - extensions/common - ReviewerUpdateInfo.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 7 15 46.7 %
Date: 2022-11-19 15:00:39 Functions: 2 4 50.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.common;
      16             : 
      17             : import com.google.gerrit.extensions.client.ReviewerState;
      18             : import java.sql.Timestamp;
      19             : import java.time.Instant;
      20             : import java.util.Objects;
      21             : 
      22             : public class ReviewerUpdateInfo {
      23             :   // TODO(issue-15508): Migrate timestamp fields in *Info/*Input classes from type Timestamp to
      24             :   // Instant
      25             :   public Timestamp updated;
      26             : 
      27             :   public AccountInfo updatedBy;
      28             :   public AccountInfo reviewer;
      29             :   public ReviewerState state;
      30             : 
      31           1 :   public ReviewerUpdateInfo() {}
      32             : 
      33             :   // TODO(issue-15508): Migrate timestamp fields in *Info/*Input classes from type Timestamp to
      34             :   // Instant
      35             :   @SuppressWarnings("JdkObsolete")
      36             :   public ReviewerUpdateInfo(
      37          46 :       Instant updated, AccountInfo updatedBy, AccountInfo reviewer, ReviewerState state) {
      38          46 :     this.updated = Timestamp.from(updated);
      39          46 :     this.updatedBy = updatedBy;
      40          46 :     this.reviewer = reviewer;
      41          46 :     this.state = state;
      42          46 :   }
      43             : 
      44             :   @Override
      45             :   public boolean equals(Object o) {
      46           0 :     if (o instanceof ReviewerUpdateInfo) {
      47           0 :       ReviewerUpdateInfo reviewerUpdateInfo = (ReviewerUpdateInfo) o;
      48           0 :       return Objects.equals(updated, reviewerUpdateInfo.updated)
      49           0 :           && Objects.equals(updatedBy, reviewerUpdateInfo.updatedBy)
      50           0 :           && Objects.equals(reviewer, reviewerUpdateInfo.reviewer)
      51           0 :           && Objects.equals(state, reviewerUpdateInfo.state);
      52             :     }
      53           0 :     return false;
      54             :   }
      55             : 
      56             :   @Override
      57             :   public int hashCode() {
      58           0 :     return Objects.hash(updated, updatedBy, reviewer, state);
      59             :   }
      60             : }

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