-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR 6524 with amendments #6569
Merged
Merged
PR 6524 with amendments #6569
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
011c576
20240614
junwense ca2b44c
20240617
junwense 8691c57
20240617
junwense 2fb0561
20240617
junwense 9e498ea
20240624
junwense 1887e3f
Merge branch 'open-telemetry:main' into main
junwense b5f8d7d
Update api/incubator/src/test/java/io/opentelemetry/api/incubator/pro…
jkwatson 52263dd
Merge branch 'open-telemetry:main' into main
junwense 4aaafae
20240627
junwense 1ebbc04
20240701
junwense 756a88d
20240701
junwense fc8f54d
20240703
junwense 78c6a5d
20240703
junwense 7f968c0
clean up tests, fix a couple of bugs
jkwatson c555f14
remove unneeded annotation
jkwatson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
69 changes: 69 additions & 0 deletions
69
...ator/src/test/java/io/opentelemetry/api/incubator/propagation/CaseInsensitiveMapTest.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,69 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.incubator.propagation; | ||
|
||
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class CaseInsensitiveMapTest { | ||
|
||
@Test | ||
void createByConstructor() { | ||
Map<String, String> map = new HashMap<>(); | ||
map.put("Key1", "test"); | ||
map.put("Key2", "test2"); | ||
|
||
CaseInsensitiveMap caseInsensitiveMap = new CaseInsensitiveMap(map); | ||
|
||
Map<String, String> standardMap = new HashMap<>(); | ||
standardMap.put("key1", "test"); | ||
standardMap.put("key2", "test2"); | ||
|
||
assertThat(caseInsensitiveMap).isEqualTo(standardMap); | ||
} | ||
|
||
@Test | ||
void putAll() { | ||
CaseInsensitiveMap caseInsensitiveMap = new CaseInsensitiveMap(); | ||
Map<String, String> standardMap = new HashMap<>(); | ||
standardMap.put("key1", "test"); | ||
standardMap.put("key2", "test2"); | ||
caseInsensitiveMap.putAll(standardMap); | ||
assertThat(caseInsensitiveMap).isEqualTo(standardMap); | ||
} | ||
|
||
@Test | ||
void putIfAbsent() { | ||
CaseInsensitiveMap caseInsensitiveMap = new CaseInsensitiveMap(); | ||
caseInsensitiveMap.putIfAbsent("key1", "test"); | ||
assertThat(caseInsensitiveMap.get("KEY1")).isEqualTo("test"); | ||
caseInsensitiveMap.putIfAbsent("key1", "nope"); | ||
assertThat(caseInsensitiveMap.get("KEY1")).isEqualTo("test"); | ||
} | ||
|
||
@Test | ||
void createByConstructorWithNullMap() { | ||
CaseInsensitiveMap caseInsensitiveMap = new CaseInsensitiveMap(null); | ||
assertThat(caseInsensitiveMap).isEmpty(); | ||
} | ||
|
||
@Test | ||
void caseInsensitivity() { | ||
CaseInsensitiveMap caseInsensitiveMap = new CaseInsensitiveMap(null); | ||
|
||
assertThat(caseInsensitiveMap).isEmpty(); | ||
|
||
caseInsensitiveMap.put("KEY1", "test1"); | ||
caseInsensitiveMap.put("KEY2", "test2"); | ||
assertThat(caseInsensitiveMap.get("key1")).isEqualTo("test1"); | ||
assertThat(caseInsensitiveMap.get("key2")).isEqualTo("test2"); | ||
assertThat(caseInsensitiveMap.get("kEy2")).isEqualTo("test2"); | ||
assertThat(caseInsensitiveMap.get("KEY2")).isEqualTo("test2"); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we normally don't include NonNull annotations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm. I don't remember either way. Happy to remove if you think we should skip it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done