Skip to content

Commit

Permalink
fix flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniellaHubble authored Nov 21, 2024
1 parent c5e5a82 commit 34ecdda
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -92,6 +92,7 @@ public void testNewIpSelector() {
@Test
public void testNewMetadataSelector() {
Instance ins1 = new Instance();
ins1.setMetadata(new LinkedHashMap<>());
ins1.addMetadata("a", "1");
ins1.addMetadata("b", "2");
Instance ins2 = new Instance();
Expand All @@ -102,7 +103,7 @@ public void testNewMetadataSelector() {
NamingContext namingContext = mock(NamingContext.class);
when(namingContext.getInstances()).thenReturn(Arrays.asList(ins1, ins2, ins3));

NamingSelector metadataSelector = NamingSelectorFactory.newMetadataSelector(new HashMap() {
NamingSelector metadataSelector = NamingSelectorFactory.newMetadataSelector(new LinkedHashMap() {
{
put("a", "1");
put("b", "2");
Expand All @@ -117,6 +118,7 @@ public void testNewMetadataSelector() {
@Test
public void testNewMetadataSelector2() {
Instance ins1 = new Instance();
ins1.setMetadata(new LinkedHashMap<>());
ins1.addMetadata("a", "1");
ins1.addMetadata("c", "3");
Instance ins2 = new Instance();
Expand All @@ -127,7 +129,7 @@ public void testNewMetadataSelector2() {
NamingContext namingContext = mock(NamingContext.class);
when(namingContext.getInstances()).thenReturn(Arrays.asList(ins1, ins2, ins3));

NamingSelector metadataSelector = NamingSelectorFactory.newMetadataSelector(new HashMap() {
NamingSelector metadataSelector = NamingSelectorFactory.newMetadataSelector(new LinkedHashMap() {
{
put("a", "1");
put("b", "2");
Expand Down

0 comments on commit 34ecdda

Please sign in to comment.