Skip to content

Commit

Permalink
uncoupled test
Browse files Browse the repository at this point in the history
  • Loading branch information
l3r8yJ committed Apr 9, 2023
1 parent 00bef04 commit a6734af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ SOFTWARE.
<maven-invoker-plugin.version>3.5.1</maven-invoker-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<mockito-core.version>5.2.0</mockito-core.version>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -162,6 +163,12 @@ SOFTWARE.
<version>${assert4j-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito-core.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

package io.github.eocqrs.kafka.consumer.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 KfConsumerParams}.
Expand All @@ -38,16 +38,12 @@ final class KfConsumerParamsTest {

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

0 comments on commit a6734af

Please sign in to comment.