Skip to content

Commit d0c15c0

Browse files
committed
Fix unit test for MySQLSinkTest
1 parent 8b1f12c commit d0c15c0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

mysql-plugin/src/test/java/io/cdap/plugin/mysql/MysqlSinkTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,23 @@
2020
import org.junit.Assert;
2121
import org.junit.Test;
2222

23+
import static org.mockito.Mockito.mock;
24+
import static org.mockito.Mockito.when;
25+
2326
public class MysqlSinkTest {
2427
@Test
2528
public void testSetColumnsInfo() {
2629
Schema outputSchema = Schema.recordOf("output",
2730
Schema.Field.of("id", Schema.of(Schema.Type.INT)),
2831
Schema.Field.of("name", Schema.of(Schema.Type.STRING)),
2932
Schema.Field.of("insert", Schema.of(Schema.Type.STRING)));
30-
MysqlSink mySQLSink = new MysqlSink(new MysqlSink.MysqlSinkConfig());
33+
34+
MysqlSink.MysqlSinkConfig mockConfig = mock(MysqlSink.MysqlSinkConfig.class);
35+
when(mockConfig.getInitialRetryDuration()).thenReturn(5); // or appropriate value
36+
when(mockConfig.getMaxRetryDuration()).thenReturn(80); // or appropriate value
37+
when(mockConfig.getMaxRetryCount()).thenReturn(5); // or appropriate value
38+
39+
MysqlSink mySQLSink = new MysqlSink(mockConfig);
3140
Assert.assertNotNull(outputSchema.getFields());
3241
mySQLSink.setColumnsInfo(outputSchema.getFields());
3342
Assert.assertEquals("`id`,`name`,`insert`", mySQLSink.getDbColumns());

0 commit comments

Comments
 (0)