Line data Source code
1 : // Copyright (C) 2018 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.common.base.MoreObjects; 18 : import java.util.Map; 19 : import java.util.Objects; 20 : 21 1 : public class TestSubmitRuleInfo { 22 : /** See {@link com.google.gerrit.entities.SubmitRecord.Status} */ 23 : public String status; 24 : 25 : public String errorMessage; 26 : public Map<String, AccountInfo> ok; 27 : public Map<String, AccountInfo> reject; 28 : public Map<String, None> need; 29 : public Map<String, AccountInfo> may; 30 : public Map<String, None> impossible; 31 : 32 : public static class None { 33 : private None() {} 34 : 35 0 : public static final None INSTANCE = new None(); 36 : } 37 : 38 : @Override 39 : public boolean equals(Object o) { 40 1 : if (o instanceof TestSubmitRuleInfo) { 41 1 : TestSubmitRuleInfo other = (TestSubmitRuleInfo) o; 42 1 : return Objects.equals(status, other.status) 43 1 : && Objects.equals(errorMessage, other.errorMessage) 44 1 : && Objects.equals(ok, other.ok) 45 1 : && Objects.equals(reject, other.reject) 46 1 : && Objects.equals(need, other.need) 47 1 : && Objects.equals(may, other.may) 48 1 : && Objects.equals(impossible, other.impossible); 49 : } 50 0 : return false; 51 : } 52 : 53 : @Override 54 : public int hashCode() { 55 0 : return Objects.hash(status, errorMessage, ok, reject, need, may, impossible); 56 : } 57 : 58 : @Override 59 : public String toString() { 60 0 : return MoreObjects.toStringHelper(this) 61 0 : .add("status", status) 62 0 : .add("errorMessage", errorMessage) 63 0 : .add("ok", ok) 64 0 : .add("reject", reject) 65 0 : .add("need", need) 66 0 : .add("may", may) 67 0 : .add("impossible", impossible) 68 0 : .toString(); 69 : } 70 : }