Skip to content

Commit

Permalink
Add a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
pilhuhn committed Aug 4, 2022
1 parent 1d8d8e8 commit 8940bc9
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.quarkus.vertx.http.runtime.attribute;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertNull;

import org.junit.jupiter.api.Test;

import io.quarkus.vertx.core.runtime.VertxMDC;

class VertxMDCDataAttributeTest {

@Test
void returnsCorrectValue() {
VertxMDC mdc = VertxMDC.INSTANCE;
mdc.put("traceId", "123");

VertxMDCDataAttribute mdcDataAttribute = new VertxMDCDataAttribute("traceId");
assertThat(mdcDataAttribute.readAttribute(null)).isEqualTo("123");
}

@Test
void returnsNullOnKeyNotInMDC() {
VertxMDC mdc = VertxMDC.INSTANCE;
mdc.put("traceId", "123");

VertxMDCDataAttribute mdcDataAttribute = new VertxMDCDataAttribute("spanId");
assertNull(mdcDataAttribute.readAttribute(null));
}
}

0 comments on commit 8940bc9

Please sign in to comment.