|
1 | 1 | package dev.openfeature.sdk;
|
2 | 2 |
|
3 | 3 | import static org.assertj.core.api.Assertions.assertThat;
|
| 4 | +import static org.assertj.core.api.InstanceOfAssertFactories.optional; |
4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
5 | 6 | import static org.junit.jupiter.api.Assertions.assertFalse;
|
6 | 7 | import static org.junit.jupiter.api.Assertions.assertNull;
|
|
15 | 16 | import java.util.List;
|
16 | 17 | import java.util.Map;
|
17 | 18 |
|
| 19 | +import com.google.common.collect.ImmutableList; |
| 20 | +import dev.openfeature.sdk.exceptions.FlagNotFoundError; |
18 | 21 | import io.cucumber.java.hu.Ha;
|
19 | 22 | import org.junit.jupiter.api.AfterEach;
|
20 | 23 | import org.junit.jupiter.api.Test;
|
@@ -206,7 +209,14 @@ private Client _client() {
|
206 | 209 | Client c = api.getClient();
|
207 | 210 | FlagEvaluationDetails<Boolean> result = c.getBooleanDetails("test", false);
|
208 | 211 | assertEquals(Reason.ERROR.toString(), result.getReason());
|
209 |
| - assertThat(TEST_LOGGER.getLoggingEvents()).contains(LoggingEvent.error("Unable to correctly evaluate flag with key {} due to exception {}", "test", TestConstants.BROKEN_MESSAGE)); |
| 212 | + |
| 213 | + ImmutableList<LoggingEvent> loggingEvents = TEST_LOGGER.getLoggingEvents(); |
| 214 | + assertThat(loggingEvents.size()).isGreaterThan(0); |
| 215 | + |
| 216 | + LoggingEvent event = loggingEvents.get(0); |
| 217 | + assertThat(event.getMessage()).isEqualTo("Unable to correctly evaluate flag with key '{}'"); |
| 218 | + assertThat(event.getThrowable().isPresent()).isTrue(); |
| 219 | + assertThat(event.getThrowable().get()).isInstanceOf(FlagNotFoundError.class); |
210 | 220 | }
|
211 | 221 |
|
212 | 222 | @Specification(number="1.2.2", text="The client interface MUST define a metadata member or accessor, containing an immutable name field or accessor of type string, which corresponds to the name value supplied during client creation.")
|
|
0 commit comments