##### Coverage Report - com.ctrip.apollo.common.http.MultiResponseEntity

Classes in this File | Line Coverage | Branch Coverage | Complexity
MultiResponseEntity |
0% | 0/10
0% | 0/2
| 1.5;1.5

1 |  |
     package com.ctrip.apollo.common.http;
2 |  |
3 |  |
     import org.springframework.http.HttpStatus;
4 |  |
5 |  |
     import java.util.LinkedList;
6 |  |
     import java.util.List;
7 |  |
8 |  |
     /**
9 |  |
      * 一个Response中包含多个ResponseEntity
10 |  |
      */
11 |  |
     public class MultiResponseEntity<T> {
12 |  |
13 |  |
       private int code;
14 |  |
15 | 0 |
       private List<RichResponseEntity<T>> entities = new LinkedList<>();
16 |  |
17 | 0 |
       private MultiResponseEntity(HttpStatus httpCode) {
18 | 0 |
         this.code = httpCode.value();
19 | 0 |
       }
20 |  |
21 |  |
       public static <T> MultiResponseEntity<T> instance(HttpStatus statusCode) {
22 | 0 |
         return new MultiResponseEntity<>(statusCode);
23 |  |
       }
24 |  |
25 |  |
       public static <T> MultiResponseEntity<T> ok() {
26 | 0 |
         return new MultiResponseEntity<>(HttpStatus.OK);
27 |  |
       }
28 |  |
29 |  |
       public void addResponseEntity(RichResponseEntity<T> responseEntity) {
30 | 0 |
         if (responseEntity == null){
31 | 0 |
           throw new IllegalArgumentException("sub response entity can not be null");
32 |  |
         }
33 | 0 |
         entities.add(responseEntity);
34 |  |
35 | 0 |
       }
36 |  |
37 |  |
     }