LCOV - code coverage report
Current view: top level - extensions/client - MenuItem.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 16 33 48.5 %
Date: 2022-11-19 15:00:39 Functions: 4 6 66.7 %

          Line data    Source code
       1             : // Copyright (C) 2015 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             : public class MenuItem {
      20             :   public final String url;
      21             :   public final String name;
      22             :   public final String target;
      23             :   public final String id;
      24             : 
      25             :   public MenuItem(String name, String url) {
      26           1 :     this(name, url, "_blank");
      27           1 :   }
      28             : 
      29             :   public MenuItem(String name, String url, String target) {
      30         151 :     this(name, url, target, null);
      31         151 :   }
      32             : 
      33         151 :   public MenuItem(String name, String url, String target, String id) {
      34         151 :     this.url = url;
      35         151 :     this.name = name;
      36         151 :     this.target = target;
      37         151 :     this.id = id;
      38         151 :   }
      39             : 
      40             :   @Override
      41             :   public boolean equals(Object obj) {
      42           1 :     if (obj instanceof MenuItem) {
      43           1 :       MenuItem o = (MenuItem) obj;
      44           1 :       return Objects.equals(url, o.url)
      45           1 :           && Objects.equals(name, o.name)
      46           1 :           && Objects.equals(target, o.target)
      47           1 :           && Objects.equals(id, o.id);
      48             :     }
      49           0 :     return false;
      50             :   }
      51             : 
      52             :   @Override
      53             :   public int hashCode() {
      54           0 :     return Objects.hash(url, name, target, id);
      55             :   }
      56             : 
      57             :   @Override
      58             :   public String toString() {
      59           0 :     return new StringBuilder()
      60           0 :         .append("MenuItem{")
      61           0 :         .append("url=")
      62           0 :         .append(url)
      63           0 :         .append(',')
      64           0 :         .append("name=")
      65           0 :         .append(name)
      66           0 :         .append(',')
      67           0 :         .append("target=")
      68           0 :         .append(target)
      69           0 :         .append(',')
      70           0 :         .append("id=")
      71           0 :         .append(id)
      72           0 :         .append('}')
      73           0 :         .toString();
      74             :   }
      75             : }

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