File tree Expand file tree Collapse file tree
src/test/java/io/github/eocqrs/kafka/consumer/settings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ SOFTWARE.
104104 <maven-invoker-plugin .version>3.5.1</maven-invoker-plugin .version>
105105 <maven-source-plugin .version>3.2.1</maven-source-plugin .version>
106106 <maven-gpg-plugin .version>3.0.1</maven-gpg-plugin .version>
107+ <mockito-core .version>5.2.0</mockito-core .version>
107108 </properties >
108109 <dependencies >
109110 <dependency >
@@ -162,6 +163,12 @@ SOFTWARE.
162163 <version >${assert4j-core.version} </version >
163164 <scope >test</scope >
164165 </dependency >
166+ <dependency >
167+ <groupId >org.mockito</groupId >
168+ <artifactId >mockito-core</artifactId >
169+ <version >${mockito-core.version} </version >
170+ <scope >test</scope >
171+ </dependency >
165172 </dependencies >
166173 <build >
167174 <plugins >
Original file line number Diff line number Diff line change 2222
2323package io .github .eocqrs .kafka .consumer .settings ;
2424
25- import io .github .eocqrs .kafka .parameters .GroupId ;
26- import io .github .eocqrs .kafka .parameters .KfParams ;
25+ import io .github .eocqrs .kafka .Params ;
2726import org .hamcrest .MatcherAssert ;
2827import org .hamcrest .Matchers ;
2928import org .junit .jupiter .api .Test ;
29+ import org .mockito .Mockito ;
3030
3131/**
3232 * Test case for {@link KfConsumerParams}.
@@ -38,16 +38,12 @@ final class KfConsumerParamsTest {
3838
3939 @ Test
4040 void representsXmlCorrectly () {
41+ final Params mock = Mockito .mock (Params .class );
42+ Mockito .when (mock .asXml ()).thenReturn ("<groupId>103</groupId>" );
4143 MatcherAssert .assertThat (
4244 "Represents right XML settings" ,
43- new KfConsumerParams (
44- new KfParams (
45- new GroupId ("103" )
46- )
47- ).asXml (),
48- Matchers .equalTo (
49- "<consumer>\n <groupId>103</groupId>\n </consumer>\n "
50- )
45+ new KfConsumerParams (mock ).asXml (),
46+ Matchers .equalTo ("<consumer>\n <groupId>103</groupId>\n </consumer>\n " )
5147 );
5248 }
5349}
You can’t perform that action at this time.
0 commit comments