Skip to content

Commit a4726d0

Browse files
committed
test(RequestUtils): Add back test for getting User-Agent
1 parent 039f828 commit a4726d0

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/test/java/com/ibm/cloud/sdk/core/test/util/RequestUtilsTest.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
*/
1313
package com.ibm.cloud.sdk.core.test.util;
1414

15-
import java.util.HashMap;
16-
import java.util.Map;
17-
15+
import com.google.common.collect.Lists;
16+
import com.ibm.cloud.sdk.core.util.RequestUtils;
1817
import org.junit.Assert;
1918
import org.junit.Test;
2019

21-
import com.google.common.collect.Lists;
22-
import com.ibm.cloud.sdk.core.util.RequestUtils;
20+
import java.util.HashMap;
21+
import java.util.Map;
2322

24-
import static com.ibm.cloud.sdk.core.util.RequestUtils.loadCoreVersion;
23+
import static org.junit.Assert.assertNotNull;
24+
import static org.junit.Assert.assertTrue;
2525

2626
/**
2727
* The Class RequestUtilsTest.
@@ -53,12 +53,12 @@ public void testOmit() {
5353

5454
Map<String, Object> omitted = RequestUtils.omit(params, "A");
5555

56-
Assert.assertTrue(omitted.keySet().containsAll(Lists.newArrayList("B", "C", "D")));
57-
Assert.assertTrue(omitted.values().containsAll(Lists.newArrayList(2, 3, 4)));
56+
assertTrue(omitted.keySet().containsAll(Lists.newArrayList("B", "C", "D")));
57+
assertTrue(omitted.values().containsAll(Lists.newArrayList(2, 3, 4)));
5858

5959
omitted = RequestUtils.omit(params, "F");
60-
Assert.assertTrue(omitted.keySet().containsAll(Lists.newArrayList("A", "B", "C", "D")));
61-
Assert.assertTrue(omitted.values().containsAll(Lists.newArrayList(1, 2, 3, 4)));
60+
assertTrue(omitted.keySet().containsAll(Lists.newArrayList("A", "B", "C", "D")));
61+
assertTrue(omitted.values().containsAll(Lists.newArrayList(1, 2, 3, 4)));
6262
}
6363

6464
/**
@@ -103,9 +103,12 @@ public void testPickWithNulls() {
103103
Assert.assertNull(RequestUtils.pick(null));
104104
}
105105

106+
/**
107+
* Test user agent.
108+
*/
106109
@Test
107-
public void testLoadCoreVersion() {
108-
String version = RequestUtils.loadCoreVersion();
109-
Assert.assertEquals("99-SNAPSHOT", version);
110+
public void testUserAgent() {
111+
assertNotNull(RequestUtils.getUserAgent());
112+
assertTrue(RequestUtils.getUserAgent().startsWith("ibm-java-sdk-core/99-SNAPSHOT"));
110113
}
111114
}

0 commit comments

Comments
 (0)