This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new ab2d2a5b6bc Rename TypedPropertiesFixture (#19752)
ab2d2a5b6bc is described below
commit ab2d2a5b6bce06570b6e741356a78aeacbfb2d2c
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Aug 1 18:32:41 2022 +0800
Rename TypedPropertiesFixture (#19752)
---
.../infra/props/TypedPropertiesTest.java | 62 +++++++++++-----------
.../props/TypedPropertyValueExceptionTest.java | 4 +-
.../infra/props/TypedPropertyValueTest.java | 22 ++++----
...Properties.java => TypedPropertiesFixture.java} | 6 +--
...opertyKey.java => TypedPropertyKeyFixture.java} | 2 +-
5 files changed, 48 insertions(+), 48 deletions(-)
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertiesTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertiesTest.java
index e23c629fc99..1cd1e196722 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertiesTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertiesTest.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.infra.props;
import
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
-import org.apache.shardingsphere.infra.props.fixture.TestTypedProperties;
-import org.apache.shardingsphere.infra.props.fixture.TestTypedPropertyKey;
+import org.apache.shardingsphere.infra.props.fixture.TypedPropertiesFixture;
+import org.apache.shardingsphere.infra.props.fixture.TypedPropertyKeyFixture;
import org.junit.Test;
import java.util.Properties;
@@ -33,48 +33,48 @@ public final class TypedPropertiesTest {
@Test
public void assertGetValue() {
- TestTypedProperties actual = new
TestTypedProperties(createProperties());
- assertTrue(actual.getValue(TestTypedPropertyKey.BOOLEAN_VALUE));
- assertTrue(actual.getValue(TestTypedPropertyKey.BOOLEAN_OBJECT_VALUE));
- assertThat(actual.getValue(TestTypedPropertyKey.INT_VALUE), is(100));
- assertThat(actual.getValue(TestTypedPropertyKey.INT_OBJECT_VALUE),
is(100));
- assertThat(actual.getValue(TestTypedPropertyKey.LONG_VALUE),
is(10000L));
- assertThat(actual.getValue(TestTypedPropertyKey.LONG_OBJECT_VALUE),
is(10000L));
- assertThat(actual.getValue(TestTypedPropertyKey.STRING_VALUE),
is("new_value"));
+ TypedPropertiesFixture actual = new
TypedPropertiesFixture(createProperties());
+ assertTrue(actual.getValue(TypedPropertyKeyFixture.BOOLEAN_VALUE));
+
assertTrue(actual.getValue(TypedPropertyKeyFixture.BOOLEAN_OBJECT_VALUE));
+ assertThat(actual.getValue(TypedPropertyKeyFixture.INT_VALUE),
is(100));
+ assertThat(actual.getValue(TypedPropertyKeyFixture.INT_OBJECT_VALUE),
is(100));
+ assertThat(actual.getValue(TypedPropertyKeyFixture.LONG_VALUE),
is(10000L));
+ assertThat(actual.getValue(TypedPropertyKeyFixture.LONG_OBJECT_VALUE),
is(10000L));
+ assertThat(actual.getValue(TypedPropertyKeyFixture.STRING_VALUE),
is("new_value"));
}
private Properties createProperties() {
Properties result = new Properties();
- result.setProperty(TestTypedPropertyKey.BOOLEAN_VALUE.getKey(),
Boolean.TRUE.toString());
- result.setProperty(TestTypedPropertyKey.BOOLEAN_OBJECT_VALUE.getKey(),
Boolean.TRUE.toString());
- result.setProperty(TestTypedPropertyKey.INT_VALUE.getKey(), "100");
- result.setProperty(TestTypedPropertyKey.INT_OBJECT_VALUE.getKey(),
"100");
- result.setProperty(TestTypedPropertyKey.LONG_VALUE.getKey(), "10000");
- result.setProperty(TestTypedPropertyKey.LONG_OBJECT_VALUE.getKey(),
"10000");
- result.setProperty(TestTypedPropertyKey.STRING_VALUE.getKey(),
"new_value");
+ result.setProperty(TypedPropertyKeyFixture.BOOLEAN_VALUE.getKey(),
Boolean.TRUE.toString());
+
result.setProperty(TypedPropertyKeyFixture.BOOLEAN_OBJECT_VALUE.getKey(),
Boolean.TRUE.toString());
+ result.setProperty(TypedPropertyKeyFixture.INT_VALUE.getKey(), "100");
+ result.setProperty(TypedPropertyKeyFixture.INT_OBJECT_VALUE.getKey(),
"100");
+ result.setProperty(TypedPropertyKeyFixture.LONG_VALUE.getKey(),
"10000");
+ result.setProperty(TypedPropertyKeyFixture.LONG_OBJECT_VALUE.getKey(),
"10000");
+ result.setProperty(TypedPropertyKeyFixture.STRING_VALUE.getKey(),
"new_value");
return result;
}
@Test
public void assertGetDefaultValue() {
- TestTypedProperties actual = new TestTypedProperties(new Properties());
- assertFalse(actual.getValue(TestTypedPropertyKey.BOOLEAN_VALUE));
-
assertFalse(actual.getValue(TestTypedPropertyKey.BOOLEAN_OBJECT_VALUE));
- assertThat(actual.getValue(TestTypedPropertyKey.INT_VALUE), is(10));
- assertThat(actual.getValue(TestTypedPropertyKey.INT_OBJECT_VALUE),
is(10));
- assertThat(actual.getValue(TestTypedPropertyKey.LONG_VALUE),
is(1000L));
- assertThat(actual.getValue(TestTypedPropertyKey.LONG_OBJECT_VALUE),
is(1000L));
- assertThat(actual.getValue(TestTypedPropertyKey.STRING_VALUE),
is("value"));
+ TypedPropertiesFixture actual = new TypedPropertiesFixture(new
Properties());
+ assertFalse(actual.getValue(TypedPropertyKeyFixture.BOOLEAN_VALUE));
+
assertFalse(actual.getValue(TypedPropertyKeyFixture.BOOLEAN_OBJECT_VALUE));
+ assertThat(actual.getValue(TypedPropertyKeyFixture.INT_VALUE), is(10));
+ assertThat(actual.getValue(TypedPropertyKeyFixture.INT_OBJECT_VALUE),
is(10));
+ assertThat(actual.getValue(TypedPropertyKeyFixture.LONG_VALUE),
is(1000L));
+ assertThat(actual.getValue(TypedPropertyKeyFixture.LONG_OBJECT_VALUE),
is(1000L));
+ assertThat(actual.getValue(TypedPropertyKeyFixture.STRING_VALUE),
is("value"));
}
@Test(expected = ShardingSphereConfigurationException.class)
public void assertGetInvalidValue() {
Properties props = new Properties();
- props.setProperty(TestTypedPropertyKey.BOOLEAN_VALUE.getKey(), "test");
- props.setProperty(TestTypedPropertyKey.BOOLEAN_OBJECT_VALUE.getKey(),
"test");
- props.setProperty(TestTypedPropertyKey.INT_VALUE.getKey(), "test");
- props.setProperty(TestTypedPropertyKey.INT_OBJECT_VALUE.getKey(),
"test");
- props.setProperty(TestTypedPropertyKey.LONG_VALUE.getKey(), "test");
- new TestTypedProperties(props);
+ props.setProperty(TypedPropertyKeyFixture.BOOLEAN_VALUE.getKey(),
"test");
+
props.setProperty(TypedPropertyKeyFixture.BOOLEAN_OBJECT_VALUE.getKey(),
"test");
+ props.setProperty(TypedPropertyKeyFixture.INT_VALUE.getKey(), "test");
+ props.setProperty(TypedPropertyKeyFixture.INT_OBJECT_VALUE.getKey(),
"test");
+ props.setProperty(TypedPropertyKeyFixture.LONG_VALUE.getKey(), "test");
+ new TypedPropertiesFixture(props);
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertyValueExceptionTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertyValueExceptionTest.java
index 25465821e8a..9e3580c46fe 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertyValueExceptionTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertyValueExceptionTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.infra.props;
-import org.apache.shardingsphere.infra.props.fixture.TestTypedPropertyKey;
+import org.apache.shardingsphere.infra.props.fixture.TypedPropertyKeyFixture;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
@@ -27,6 +27,6 @@ public final class TypedPropertyValueExceptionTest {
@Test
public void assertGetMessage() {
- assertThat(new
TypedPropertyValueException(TestTypedPropertyKey.INT_VALUE,
"test").getMessage(), is("Value `test` of `int` cannot convert to type
`int`."));
+ assertThat(new
TypedPropertyValueException(TypedPropertyKeyFixture.INT_VALUE,
"test").getMessage(), is("Value `test` of `int` cannot convert to type
`int`."));
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertyValueTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertyValueTest.java
index 0237ee50789..ae5a78a62a5 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertyValueTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/TypedPropertyValueTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.infra.props;
-import org.apache.shardingsphere.infra.props.fixture.TestTypedPropertyKey;
+import org.apache.shardingsphere.infra.props.fixture.TypedPropertyKeyFixture;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
@@ -29,39 +29,39 @@ public final class TypedPropertyValueTest {
@Test
public void assertGetBooleanValue() throws TypedPropertyValueException {
- assertTrue((Boolean) new
TypedPropertyValue(TestTypedPropertyKey.BOOLEAN_VALUE,
Boolean.TRUE.toString()).getValue());
- assertTrue((Boolean) new
TypedPropertyValue(TestTypedPropertyKey.BOOLEAN_OBJECT_VALUE,
Boolean.TRUE.toString()).getValue());
+ assertTrue((Boolean) new
TypedPropertyValue(TypedPropertyKeyFixture.BOOLEAN_VALUE,
Boolean.TRUE.toString()).getValue());
+ assertTrue((Boolean) new
TypedPropertyValue(TypedPropertyKeyFixture.BOOLEAN_OBJECT_VALUE,
Boolean.TRUE.toString()).getValue());
}
@Test
public void assertGetInvalidBooleanValue() throws
TypedPropertyValueException {
- assertFalse((Boolean) new
TypedPropertyValue(TestTypedPropertyKey.BOOLEAN_VALUE, "test").getValue());
+ assertFalse((Boolean) new
TypedPropertyValue(TypedPropertyKeyFixture.BOOLEAN_VALUE, "test").getValue());
}
@Test
public void assertGetIntValue() throws TypedPropertyValueException {
- assertThat(new TypedPropertyValue(TestTypedPropertyKey.INT_VALUE,
"1000").getValue(), is(1000));
- assertThat(new
TypedPropertyValue(TestTypedPropertyKey.INT_OBJECT_VALUE, "1000").getValue(),
is(1000));
+ assertThat(new TypedPropertyValue(TypedPropertyKeyFixture.INT_VALUE,
"1000").getValue(), is(1000));
+ assertThat(new
TypedPropertyValue(TypedPropertyKeyFixture.INT_OBJECT_VALUE,
"1000").getValue(), is(1000));
}
@Test(expected = TypedPropertyValueException.class)
public void assertGetInvalidIntValue() throws TypedPropertyValueException {
- new TypedPropertyValue(TestTypedPropertyKey.INT_VALUE, "test");
+ new TypedPropertyValue(TypedPropertyKeyFixture.INT_VALUE, "test");
}
@Test
public void assertGetLongValue() throws TypedPropertyValueException {
- assertThat(new TypedPropertyValue(TestTypedPropertyKey.LONG_VALUE,
"10000").getValue(), is(10000L));
- assertThat(new
TypedPropertyValue(TestTypedPropertyKey.LONG_OBJECT_VALUE, "10000").getValue(),
is(10000L));
+ assertThat(new TypedPropertyValue(TypedPropertyKeyFixture.LONG_VALUE,
"10000").getValue(), is(10000L));
+ assertThat(new
TypedPropertyValue(TypedPropertyKeyFixture.LONG_OBJECT_VALUE,
"10000").getValue(), is(10000L));
}
@Test(expected = TypedPropertyValueException.class)
public void assertGetInvalidLongValue() throws TypedPropertyValueException
{
- new TypedPropertyValue(TestTypedPropertyKey.LONG_VALUE, "test");
+ new TypedPropertyValue(TypedPropertyKeyFixture.LONG_VALUE, "test");
}
@Test
public void assertGetStringValue() throws TypedPropertyValueException {
- assertThat(new TypedPropertyValue(TestTypedPropertyKey.STRING_VALUE,
"new_value").getValue(), is("new_value"));
+ assertThat(new
TypedPropertyValue(TypedPropertyKeyFixture.STRING_VALUE,
"new_value").getValue(), is("new_value"));
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TestTypedProperties.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TypedPropertiesFixture.java
similarity index 82%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TestTypedProperties.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TypedPropertiesFixture.java
index c02648ddec0..4b3b22c198f 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TestTypedProperties.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TypedPropertiesFixture.java
@@ -21,9 +21,9 @@ import org.apache.shardingsphere.infra.props.TypedProperties;
import java.util.Properties;
-public final class TestTypedProperties extends
TypedProperties<TestTypedPropertyKey> {
+public final class TypedPropertiesFixture extends
TypedProperties<TypedPropertyKeyFixture> {
- public TestTypedProperties(final Properties props) {
- super(TestTypedPropertyKey.class, props);
+ public TypedPropertiesFixture(final Properties props) {
+ super(TypedPropertyKeyFixture.class, props);
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TestTypedPropertyKey.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TypedPropertyKeyFixture.java
similarity index 95%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TestTypedPropertyKey.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TypedPropertyKeyFixture.java
index 216edf51c6d..9b15637d4ee 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TestTypedPropertyKey.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/props/fixture/TypedPropertyKeyFixture.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.props.TypedPropertyKey;
@RequiredArgsConstructor
@Getter
-public enum TestTypedPropertyKey implements TypedPropertyKey {
+public enum TypedPropertyKeyFixture implements TypedPropertyKey {
BOOLEAN_VALUE("boolean", String.valueOf(Boolean.FALSE), boolean.class),