LCOV - code coverage report
Current view: top level - acceptance/testsuite/change - TestCommitIdentifier.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 10 10 100.0 %
Date: 2022-11-19 15:00:39 Functions: 6 6 100.0 %

          Line data    Source code
       1             : // Copyright (C) 2020 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.acceptance.testsuite.change;
      16             : 
      17             : import com.google.auto.value.AutoOneOf;
      18             : import com.google.gerrit.entities.Change;
      19             : import com.google.gerrit.entities.PatchSet;
      20             : import org.eclipse.jgit.lib.ObjectId;
      21             : 
      22             : /** Attributes, each one uniquely identifying a commit. */
      23             : @AutoOneOf(TestCommitIdentifier.Kind.class)
      24           5 : public abstract class TestCommitIdentifier {
      25           5 :   public enum Kind {
      26           5 :     COMMIT_SHA_1,
      27           5 :     BRANCH,
      28           5 :     CHANGE_ID,
      29           5 :     PATCHSET_ID
      30             :   }
      31             : 
      32             :   public abstract Kind getKind();
      33             : 
      34             :   /** SHA-1 of the commit. */
      35             :   public abstract ObjectId commitSha1();
      36             : 
      37             :   /** Branch whose tip points to the desired commit. */
      38             :   public abstract String branch();
      39             : 
      40             :   /** Numeric ID of the change whose current patchset points to the desired commit. */
      41             :   public abstract Change.Id changeId();
      42             : 
      43             :   /** ID of the patchset representing the desired commit. */
      44             :   public abstract PatchSet.Id patchsetId();
      45             : 
      46             :   public static TestCommitIdentifier ofCommitSha1(ObjectId commitSha1) {
      47           1 :     return AutoOneOf_TestCommitIdentifier.commitSha1(commitSha1);
      48             :   }
      49             : 
      50             :   public static TestCommitIdentifier ofBranch(String branchName) {
      51           2 :     return AutoOneOf_TestCommitIdentifier.branch(branchName);
      52             :   }
      53             : 
      54             :   public static TestCommitIdentifier ofChangeId(Change.Id changeId) {
      55           4 :     return AutoOneOf_TestCommitIdentifier.changeId(changeId);
      56             :   }
      57             : 
      58             :   public static TestCommitIdentifier ofPatchsetId(PatchSet.Id patchsetId) {
      59           3 :     return AutoOneOf_TestCommitIdentifier.patchsetId(patchsetId);
      60             :   }
      61             : }

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