提交 2edf02b5 编写于 作者: T tristaZero

add assertGetKeyGeneratorWithoutTypeAndClassName()

上级 334722a9
......@@ -18,7 +18,6 @@
package io.shardingsphere.core.yaml.sharding;
import io.shardingsphere.core.keygen.SnowflakeKeyGenerator;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
......@@ -26,14 +25,23 @@ import static org.junit.Assert.assertThat;
public class YamlKeyGeneratorConfigurationTest {
@Before
public void setUp() {
}
@Test
public void assertGetKeyGeneratorWithClassName() {
YamlKeyGeneratorConfiguration keyGeneratorConfiguration = new YamlKeyGeneratorConfiguration();
keyGeneratorConfiguration.setClassName("io.shardingsphere.core.keygen.SnowflakeKeyGenerator");
assertThat(keyGeneratorConfiguration.getKeyGenerator().getClass().getName(), is(SnowflakeKeyGenerator.class.getName()));
}
@Test
public void assertGetKeyGeneratorWithSnowflakeType() {
YamlKeyGeneratorConfiguration keyGeneratorConfiguration = new YamlKeyGeneratorConfiguration();
keyGeneratorConfiguration.setType("SNOWFLAKE");
assertThat(keyGeneratorConfiguration.getKeyGenerator().getClass().getName(), is(SnowflakeKeyGenerator.class.getName()));
}
@Test
public void assertGetKeyGeneratorWithoutTypeAndClassName() {
YamlKeyGeneratorConfiguration keyGeneratorConfiguration = new YamlKeyGeneratorConfiguration();
assertThat(keyGeneratorConfiguration.getKeyGenerator().getClass().getName(), is(SnowflakeKeyGenerator.class.getName()));
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册