-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
90 additions
and
45 deletions.
There are no files selected for viewing
21 changes: 0 additions & 21 deletions
21
...build/app/src/test/java/com/microsoft/applications/events/maesdktest/ExampleUnitTest.java
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
...app/src/test/java/com/microsoft/applications/events/maesdktest/HttpClientRequestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
package com.microsoft.applications.events.maesdktest; | ||
|
||
import com.microsoft.applications.events.HttpClientRequest; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.nio.charset.Charset; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static java.nio.charset.StandardCharsets.UTF_8; | ||
import static org.junit.Assert.*; | ||
|
||
public class HttpClientRequestTest { | ||
@Test | ||
public void testHeaders() { | ||
byte[] bytes = "key1value1key2value2".getBytes(UTF_8); | ||
int[] header_lengths = new int[] { 4, 6, 4, 6 }; | ||
|
||
HttpClientRequest.Headers headers = new HttpClientRequest.Headers(header_lengths, bytes); | ||
ArrayList<String> actual = new ArrayList<>(); | ||
while (headers.hasNext()) { | ||
HttpClientRequest.HeaderEntry entry = headers.next(); | ||
actual.add(entry.key); | ||
actual.add(entry.value); | ||
} | ||
|
||
Assert.assertEquals(4, headers.length); | ||
Assert.assertArrayEquals( | ||
new String[] {"key1", "value1", "key2", "value2"}, | ||
actual.toArray() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters