Skip to content

Commit

Permalink
mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
l3r8yJ committed Apr 9, 2023
1 parent 400a308 commit 79337d7
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

package io.github.eocqrs.kafka.producer.settings;

import io.github.eocqrs.kafka.parameters.GroupId;
import io.github.eocqrs.kafka.parameters.KfParams;
import io.github.eocqrs.kafka.Params;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

/**
* Test case for {@link KfProducerParams}.
Expand All @@ -38,16 +38,12 @@ final class KfProducerParamsTest {

@Test
void representsXmlCorrectly() {
final Params mock = Mockito.mock(Params.class);
Mockito.when(mock.asXml()).thenReturn("my string");
MatcherAssert.assertThat(
"Represents right XML settings",
new KfProducerParams(
new KfParams(
new GroupId("103")
)
).asXml(),
Matchers.equalTo(
"<producer>\n<groupId>103</groupId>\n</producer>\n"
)
new KfProducerParams(mock).asXml(),
Matchers.equalTo("<producer>\nmy string\n</producer>\n")
);
}
}

0 comments on commit 79337d7

Please sign in to comment.