Skip to content

Commit ef6418c

Browse files
authored
test(flaky): fix paramter type assert in testBothAnnotatedConstructor test case
1 parent 87a68dd commit ef6418c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

incubator/cdi-inject-weld/src/test/java/org/glassfish/jersey/inject/weld/internal/injector/CachedConstructorAnalyzerTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022, 2024 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -30,6 +30,7 @@
3030
import org.junit.jupiter.api.Test;
3131
import static org.junit.jupiter.api.Assertions.assertEquals;
3232
import static org.junit.jupiter.api.Assertions.assertThrows;
33+
import static org.junit.jupiter.api.Assertions.assertTrue;
3334

3435
/**
3536
* Tests {@link CachedConstructorAnalyzer}.
@@ -110,7 +111,8 @@ public void testBothAnnotatedConstructor() {
110111

111112
Constructor<BothAnnotatedConstructor> constructor = analyzer.getConstructor();
112113
assertEquals(1, constructor.getParameterCount());
113-
assertEquals(Integer.class, constructor.getParameterTypes()[0]);
114+
Class<?> parameterType = constructor.getParameterTypes()[0];
115+
assertTrue(parameterType.equals(String.class) || parameterType.equals(Integer.class));
114116
}
115117

116118
@Test

inject/cdi2-se/src/test/java/org/glassfish/jersey/inject/cdi/se/injector/CachedConstructorAnalyzerTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2022, 2024 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -30,6 +30,7 @@
3030
import org.junit.jupiter.api.Test;
3131
import static org.junit.jupiter.api.Assertions.assertEquals;
3232
import static org.junit.jupiter.api.Assertions.assertThrows;
33+
import static org.junit.jupiter.api.Assertions.assertTrue;
3334

3435
/**
3536
* Tests {@link CachedConstructorAnalyzer}.
@@ -110,7 +111,8 @@ public void testBothAnnotatedConstructor() {
110111

111112
Constructor<BothAnnotatedConstructor> constructor = analyzer.getConstructor();
112113
assertEquals(1, constructor.getParameterCount());
113-
assertEquals(Integer.class, constructor.getParameterTypes()[0]);
114+
Class<?> parameterType = constructor.getParameterTypes()[0];
115+
assertTrue(parameterType.equals(String.class) || parameterType.equals(Integer.class));
114116
}
115117

116118
@Test

0 commit comments

Comments
 (0)