github-code-scanning[bot] commented on code in PR #709:
URL:
https://github.com/apache/incubator-baremaps/pull/709#discussion_r1240422985
##########
baremaps-core/src/test/java/org/apache/baremaps/database/AppendOnlyBufferTest.java:
##########
@@ -73,7 +75,25 @@
// read values
int count = 0;
for (var v : collection) {
- assertEquals(value, v);
+ if (value instanceof byte[]) {
Review Comment:
## Chain of 'instanceof' tests
This if block performs a chain of 8 type tests - consider alternatives, e.g.
polymorphism or the visitor pattern.
[Show more
details](https://github.com/apache/incubator-baremaps/security/code-scanning/700)
##########
baremaps-core/src/test/java/org/apache/baremaps/database/type/DataTypeTest.java:
##########
@@ -21,14 +22,34 @@
class DataTypeTest {
@ParameterizedTest
-
@MethodSource("org.apache.baremaps.collection.type.DataTypeProvider#dataTypes")
+ @MethodSource("org.apache.baremaps.database.type.DataTypeProvider#dataTypes")
void writeAndRead(DataType dataType, Object value) {
var size = dataType.size(value);
var buffer = ByteBuffer.allocate(size);
dataType.write(buffer, 0, value);
var recordSize = dataType.size(buffer, 0);
var recordValue = dataType.read(buffer, 0);
+
assertEquals(size, recordSize);
- assertEquals(value, recordValue);
+
+ if (value instanceof byte[]) {
Review Comment:
## Chain of 'instanceof' tests
This if block performs a chain of 8 type tests - consider alternatives, e.g.
polymorphism or the visitor pattern.
[Show more
details](https://github.com/apache/incubator-baremaps/security/code-scanning/701)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]