Mass removal of all Tabs (Style Warnings)
[aaf/authz.git] / cadi / client / src / test / java / org / onap / aaf / client / test / JU_ResultTest.java
1 /*******************************************************************************
2  * ============LICENSE_START====================================================
3  * * org.onap.aaf
4  * * ===========================================================================
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * * ===========================================================================
7  * * Licensed under the Apache License, Version 2.0 (the "License");
8  * * you may not use this file except in compliance with the License.
9  * * You may obtain a copy of the License at
10  * * 
11  *  *      http://www.apache.org/licenses/LICENSE-2.0
12  * * 
13  *  * Unless required by applicable law or agreed to in writing, software
14  * * distributed under the License is distributed on an "AS IS" BASIS,
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * * See the License for the specific language governing permissions and
17  * * limitations under the License.
18  * * ============LICENSE_END====================================================
19  * *
20  * *
21  ******************************************************************************/
22 package org.onap.aaf.client.test;
23
24 import static org.hamcrest.CoreMatchers.is;
25 import static org.junit.Assert.*;
26
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.onap.aaf.cadi.client.Result;
30
31 public class JU_ResultTest {
32
33     @Before
34     public void setUp() throws Exception {
35     }
36
37     @Test
38     public void testOk() {
39         Result<String> t = Result.ok(1, "Ok");
40         assertNotNull(t);
41         assertThat(t.code, is(1));
42         assertTrue(t.isOK());
43         assertThat(t.toString(), is("Code: 1"));
44     }
45
46     @Test
47     public void testErr() {
48         Result<String> t = Result.err(1, "Error Body");
49         assertNotNull(t);
50         assertThat(t.error, is("Error Body"));
51         assertFalse(t.isOK());
52         assertThat(t.toString(), is("Code: 1 = Error Body"));
53     }
54     
55     @Test
56     public void testOk1() {
57         Result<String> t = Result.ok(1, "Ok");
58         assertNotNull(t);
59         assertThat(t.code, is(1));
60         assertTrue(t.isOK());
61         assertThat(t.toString(), is("Code: 1"));
62     }
63
64     @Test
65     public void testErr1() {
66         Result<String> t = Result.err(1, "Error Body");
67         assertNotNull(t);
68         assertThat(t.error, is("Error Body"));
69         assertFalse(t.isOK());
70         assertThat(t.toString(), is("Code: 1 = Error Body"));
71     }
72     
73     @Test
74     public void testOk2() {
75         Result<String> t = Result.ok(1, "Ok");
76         assertNotNull(t);
77         assertThat(t.code, is(1));
78         assertTrue(t.isOK());
79         assertThat(t.toString(), is("Code: 1"));
80     }
81
82     @Test
83     public void testErr2() {
84         Result<String> t = Result.err(1, "Error Body");
85         assertNotNull(t);
86         assertThat(t.error, is("Error Body"));
87         assertFalse(t.isOK());
88         assertThat(t.toString(), is("Code: 1 = Error Body"));
89     }
90     
91     @Test
92     public void testOk3() {
93         Result<String> t = Result.ok(1, "Ok");
94         assertNotNull(t);
95         assertThat(t.code, is(1));
96         assertTrue(t.isOK());
97         assertThat(t.toString(), is("Code: 1"));
98     }
99
100     @Test
101     public void testErr3() {
102         Result<String> t = Result.err(1, "Error Body");
103         assertNotNull(t);
104         assertThat(t.error, is("Error Body"));
105         assertFalse(t.isOK());
106         assertThat(t.toString(), is("Code: 1 = Error Body"));
107     }
108 }