Coverage Report - com.jcabi.github.RtBranch
 
Classes in this File Line Coverage Branch Coverage Complexity
RtBranch
90%
10/11
0%
0/36
1
RtBranch$AjcClosure1
100%
1/1
N/A
1
RtBranch$AjcClosure3
100%
1/1
N/A
1
RtBranch$AjcClosure5
100%
1/1
N/A
1
 
 1  2
 /**
 2  
  * Copyright (c) 2013-2017, jcabi.com
 3  
  * All rights reserved.
 4  
  *
 5  
  * Redistribution and use in source and binary forms, with or without
 6  
  * modification, are permitted provided that the following conditions
 7  
  * are met: 1) Redistributions of source code must retain the above
 8  
  * copyright notice, this list of conditions and the following
 9  
  * disclaimer. 2) Redistributions in binary form must reproduce the above
 10  
  * copyright notice, this list of conditions and the following
 11  
  * disclaimer in the documentation and/or other materials provided
 12  
  * with the distribution. 3) Neither the name of the jcabi.com nor
 13  
  * the names of its contributors may be used to endorse or promote
 14  
  * products derived from this software without specific prior written
 15  
  * permission.
 16  
  *
 17  
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 18  
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
 19  
  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 20  
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 21  
  * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 22  
  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 23  
  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 24  
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 25  
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 26  
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 27  
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 28  
  * OF THE POSSIBILITY OF SUCH DAMAGE.
 29  
  */
 30  
 package com.jcabi.github;
 31  
 
 32  
 import com.jcabi.aspects.Immutable;
 33  
 import com.jcabi.aspects.Loggable;
 34  
 import com.jcabi.http.Request;
 35  
 import lombok.EqualsAndHashCode;
 36  
 
 37  
 /**
 38  
  * Git branch.
 39  
  *
 40  
  * @author Chris Rebert (github@rebertia.com)
 41  
  * @version $Id: 0b8710d973b8434d3ab3e3f7857c0b645482b775 $
 42  
  * @since 0.24
 43  
  */
 44  
 @Immutable
 45  
 @Loggable(Loggable.DEBUG)
 46  0
 @EqualsAndHashCode(of = { "entry", "owner", "nam", "hash" })
 47  
 public final class RtBranch implements Branch {
 48  
     /**
 49  
      * API entry point.
 50  
      */
 51  
     private final transient Request entry;
 52  
 
 53  
     /**
 54  
      * Repository we're in.
 55  
      */
 56  
     private final transient Repo owner;
 57  
 
 58  
     /**
 59  
      * Name of this branch.
 60  
      */
 61  
     private final transient String nam;
 62  
 
 63  
     /**
 64  
      * Commit SHA hash.
 65  
      */
 66  
     private final transient String hash;
 67  
 
 68  
     /**
 69  
      * Public ctor.
 70  
      * @param req Request
 71  
      * @param repo Repository
 72  
      * @param nom Name of branch
 73  
      * @param sha Commit SHA hash
 74  
      * @todo #1085:30m Refactor to reduce number of arguments to avoid
 75  
      *  ParameterNumberCheck warning.
 76  
      * @checkstyle ParameterNumberCheck (6 lines)
 77  
      */
 78  
     RtBranch(
 79  
         final Request req,
 80  
         final Repo repo,
 81  
         final String nom,
 82  7
         final String sha) {
 83  7
         this.entry = req;
 84  7
         this.owner = repo;
 85  7
         this.nam = nom;
 86  7
         this.hash = sha;
 87  7
     }
 88  
 
 89  
     @Override
 90  
     public Repo repo() {
 91  2
         return this.owner;
 92  
     }
 93  
 
 94  
     @Override
 95  
     public String name() {
 96  6
         return this.nam;
 97  
     }
 98  
 
 99  
     @Override
 100  
     public Commit commit() {
 101  6
         return new RtCommit(this.entry, this.owner, this.hash);
 102  
     }
 103  
 }