blob: 3a08d735a4e0da1030b55411bf7cfe06b8d18735 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.utils.communication.http;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class HttpResultTest {
@Test
void testSuccess() {
assertEquals(false, new HttpResult().setHttpCode(199, "foo").isSuccess());
assertEquals(true, new HttpResult().setHttpCode(200, "foo").isSuccess());
assertEquals(true, new HttpResult().setHttpCode(299, "foo").isSuccess());
assertEquals(false, new HttpResult().setHttpCode(300, "foo").isSuccess());
}
@Test
void testToString() {
assertEquals("HTTP 200/OK", new HttpResult().setContent("Foo").toString());
assertEquals("HTTP 200/OK\n\nFoo", new HttpResult().setContent("Foo").toString(true));
assertEquals("HTTP 200/OK", new HttpResult().toString(true));
assertEquals("HTTP 200/OK", new HttpResult().setContent("").toString(true));
}
@Test
void testNothingButGetCoverage() {
new HttpResult().getHeaders();
}
}
|