LCOV - code coverage report
Current view: top level - server/group - InternalGroupDescription.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 13 14 92.9 %
Date: 2022-11-19 15:00:39 Functions: 11 12 91.7 %

          Line data    Source code
       1             : // Copyright (C) 2017 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.server.group;
      16             : 
      17             : import static java.util.Objects.requireNonNull;
      18             : 
      19             : import com.google.common.collect.ImmutableSet;
      20             : import com.google.gerrit.common.Nullable;
      21             : import com.google.gerrit.common.PageLinks;
      22             : import com.google.gerrit.entities.Account;
      23             : import com.google.gerrit.entities.AccountGroup;
      24             : import com.google.gerrit.entities.GroupDescription;
      25             : import com.google.gerrit.entities.InternalGroup;
      26             : import java.time.Instant;
      27             : 
      28             : public class InternalGroupDescription implements GroupDescription.Internal {
      29             : 
      30             :   private final InternalGroup internalGroup;
      31             : 
      32          56 :   public InternalGroupDescription(InternalGroup internalGroup) {
      33          56 :     this.internalGroup = requireNonNull(internalGroup);
      34          56 :   }
      35             : 
      36             :   @Override
      37             :   public AccountGroup.UUID getGroupUUID() {
      38          56 :     return internalGroup.getGroupUUID();
      39             :   }
      40             : 
      41             :   @Override
      42             :   public String getName() {
      43          40 :     return internalGroup.getName();
      44             :   }
      45             : 
      46             :   @Nullable
      47             :   @Override
      48             :   public String getEmailAddress() {
      49           0 :     return null;
      50             :   }
      51             : 
      52             :   @Nullable
      53             :   @Override
      54             :   public String getUrl() {
      55          37 :     return "#" + PageLinks.toGroup(getGroupUUID());
      56             :   }
      57             : 
      58             :   @Override
      59             :   public AccountGroup.Id getId() {
      60          36 :     return internalGroup.getId();
      61             :   }
      62             : 
      63             :   @Override
      64             :   @Nullable
      65             :   public String getDescription() {
      66          36 :     return internalGroup.getDescription();
      67             :   }
      68             : 
      69             :   @Override
      70             :   public AccountGroup.UUID getOwnerGroupUUID() {
      71          53 :     return internalGroup.getOwnerGroupUUID();
      72             :   }
      73             : 
      74             :   @Override
      75             :   public boolean isVisibleToAll() {
      76          37 :     return internalGroup.isVisibleToAll();
      77             :   }
      78             : 
      79             :   @Override
      80             :   public Instant getCreatedOn() {
      81          36 :     return internalGroup.getCreatedOn();
      82             :   }
      83             : 
      84             :   @Override
      85             :   public ImmutableSet<Account.Id> getMembers() {
      86           9 :     return internalGroup.getMembers();
      87             :   }
      88             : 
      89             :   @Override
      90             :   public ImmutableSet<AccountGroup.UUID> getSubgroups() {
      91           4 :     return internalGroup.getSubgroups();
      92             :   }
      93             : }

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