Conversation
|
I think we should also update DataTypeIntegrationTest and similar, looking into that. |
|
In hindsight, it's better to keep duration tests separate because the type has specific restrictions (e.g. can't be used in collections) so it can't be handled as a "regular" primitive type by DataTypeIntegrationTest. |
| @Test(groups = "unit") | ||
| @Test(groups = "unit", enabled = false) | ||
| public void should_return_same_elements_with_all_primitive_types_using_latest_protocol_version() { | ||
| assertThat(DataType.allPrimitiveTypes(ProtocolVersion.NEWEST_SUPPORTED)).isEqualTo(DataType.allPrimitiveTypes()); |
There was a problem hiding this comment.
This fails, I'm not sure if we should adapt it or remove it altogether.
There was a problem hiding this comment.
I vote for removing it. The method under test – DataType.allPrimitiveTypes(ProtocolVersion) – is itself a test method and the assumption – NEWEST_SUPPORTED should contain all known primitive types – is simply not true anymore.
There was a problem hiding this comment.
should_not_return_v4_types_in_all_primitive_types_with_v3 (right above) could be deleted too.
adutra
left a comment
There was a problem hiding this comment.
Approving my own changes \o/
| TINYINT(20, ProtocolVersion.V4), | ||
| DATE(17, ProtocolVersion.V4), | ||
| TIME(18, ProtocolVersion.V4); | ||
| TUPLE(49, ProtocolVersion.V3); |
There was a problem hiding this comment.
If you re-order by protocolId, why not fully re-order?
There was a problem hiding this comment.
Right, I missed a few of them.
|
|
||
| @Override | ||
| public boolean apply(DataType dataType) { | ||
| return protocolVersion.compareTo(dataType.getName().minProtocolVersion) >= 0; |
There was a problem hiding this comment.
This method is only used in tests, therefore I would suggest that we move it to TestUtils, wdyt? To buy us some time, I will push a commit to do that myself, but feel free to revert if you disagree.
| return protocolVersion.compareTo(dataType.getName().minProtocolVersion) >= 0; | ||
| // Duration is handled separately in DurationIntegrationTest, because it has specific restrictions (e.g. | ||
| // not allowed in collections). | ||
| return dataType.getName() != Name.DURATION && |
There was a problem hiding this comment.
Also, I think the "base" method should return all types for a given version, and let individual tests filter out undesired ones, like in DataTypeTest.exclude(DataType).
| @Test(groups = "unit") | ||
| @Test(groups = "unit", enabled = false) | ||
| public void should_return_same_elements_with_all_primitive_types_using_latest_protocol_version() { | ||
| assertThat(DataType.allPrimitiveTypes(ProtocolVersion.NEWEST_SUPPORTED)).isEqualTo(DataType.allPrimitiveTypes()); |
There was a problem hiding this comment.
I vote for removing it. The method under test – DataType.allPrimitiveTypes(ProtocolVersion) – is itself a test method and the assumption – NEWEST_SUPPORTED should contain all known primitive types – is simply not true anymore.
| * This class is a singleton; to obtain its unique instance, | ||
| * call {@link #duration()}. | ||
| */ | ||
| public static class DurationType extends CustomType { |
There was a problem hiding this comment.
Pushed a small commit to delete this.
| * | ||
| * @param protocolVersion protocol version to get types for. | ||
| * @return returns a set of all the primitive types for the given protocolVersion. | ||
| */ |
There was a problem hiding this comment.
Moved to TestUtils as per my own suggestion.
| @Test(groups = "unit") | ||
| public void should_return_same_elements_with_all_primitive_types_using_latest_protocol_version() { | ||
| assertThat(DataType.allPrimitiveTypes(ProtocolVersion.NEWEST_SUPPORTED)).isEqualTo(DataType.allPrimitiveTypes()); | ||
| } |
There was a problem hiding this comment.
Removed these two tests, as they cover a method that has been moved to TestUtils.
Protocol v5 is still beta, I temporarily added this (not committed) in DurationIntegrationTest to test: