Coverage Report - com.jcabi.github.RtStatus
 
Classes in this File Line Coverage Branch Coverage Complexity
RtStatus
91%
11/12
0%
0/28
1
RtStatus$AjcClosure1
100%
1/1
N/A
1
RtStatus$AjcClosure3
100%
1/1
N/A
1
RtStatus$AjcClosure5
100%
1/1
N/A
1
RtStatus$AjcClosure7
100%
1/1
N/A
1
 
 1  2
 /**
 2  
  * Copyright (c) 2013-2015, 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 javax.validation.constraints.NotNull;
 35  
 import lombok.EqualsAndHashCode;
 36  
 
 37  
 /**
 38  
  * Github commit status.
 39  
  * @author Marcin Cylke (maracin.cylke+github@gmail.com)
 40  
  * @version $Id$
 41  
  * @since 0.23
 42  
  */
 43  
 @Immutable
 44  
 @Loggable(Loggable.DEBUG)
 45  0
 @EqualsAndHashCode(of = { "cstate", "url", "message", "name" })
 46  
 public final class RtStatus implements Status {
 47  
 
 48  
     /**
 49  
      * Commit status.
 50  
      */
 51  
     private final transient State cstate;
 52  
 
 53  
     /**
 54  
      * Details url.
 55  
      */
 56  
     private final transient String url;
 57  
 
 58  
     /**
 59  
      * Complete message.
 60  
      */
 61  
     private final transient String message;
 62  
 
 63  
     /**
 64  
      * Short message.
 65  
      */
 66  
     private final transient String name;
 67  
 
 68  
     /**
 69  
      * Create new status object.
 70  
      * @param status State.
 71  
      * @param address Target url.
 72  
      * @param descr Description.
 73  
      * @param ctx Context.
 74  
      * @checkstyle ParameterNumberCheck (500 lines)
 75  
      */
 76  
     public RtStatus(
 77  
         @NotNull(message = "status can't be NULL") final State status,
 78  
         final String address,
 79  
         final String descr,
 80  
         final String ctx
 81  2
     ) {
 82  2
         this.url = address;
 83  2
         this.message = descr;
 84  2
         this.name = ctx;
 85  2
         this.cstate = status;
 86  2
     }
 87  
 
 88  
     /**
 89  
      * Get status of this status.
 90  
      * @return Present status
 91  
      */
 92  
     @Override
 93  
     public State state() {
 94  2
         return this.cstate;
 95  
     }
 96  
 
 97  
     /**
 98  
      * Get url of the status.
 99  
      * @return Url as string
 100  
      */
 101  
     @Override
 102  
     public String targetUrl() {
 103  2
         return this.url;
 104  
     }
 105  
 
 106  
     /**
 107  
      * Get message from container.
 108  
      * @return Description string
 109  
      */
 110  
     @Override
 111  
     public String description() {
 112  2
         return this.message;
 113  
     }
 114  
 
 115  
     /**
 116  
      * Get name info from container.
 117  
      * @return Context
 118  
      */
 119  
     @Override
 120  
     public String context() {
 121  2
         return this.name;
 122  
     }
 123  
 }