Fixed issue in isSubset

This commit is contained in:
Andreas Isler
2025-12-05 09:19:33 +01:00
parent b105c63c7e
commit bbaacfb439
2 changed files with 3 additions and 9 deletions
@@ -6,8 +6,6 @@ import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -23,8 +21,6 @@ class FlowableExcelMapperTest {
@Autowired
private FlowableExcelMapper flowableExcelMapper;
protected static final Logger logger = LoggerFactory.getLogger(FlowableExcelMapperTest.class);
public boolean isSubset(JsonNode root, JsonNode test) {
// If test is null, it is always a subset of root
@@ -71,7 +67,7 @@ class FlowableExcelMapperTest {
rootValue = root.get(fieldName);
}
if (testValue.isTextual() && "__N_A".equals(testValue.asText())) {
if (rootValue != null && !rootValue.isNull()) {
if (root != null && root.has(fieldName)) {
return false;
}
continue;
@@ -105,9 +101,8 @@ class FlowableExcelMapperTest {
public void excelMapperTestOk(JsonNode row) {
JsonNode root = row.get("root");
JsonNode test = row.get("test");
logger.info("{}root={}{}test={}", System.lineSeparator(), root, System.lineSeparator(), test);
Assertions.assertThat(isSubset(root, test))
.withFailMessage(System.lineSeparator() + "root=" + root + System.lineSeparator() + "test=" + test).isTrue();
.withFailMessage(System.lineSeparator() + "test :" + test + System.lineSeparator() + "root :" + root).isTrue();
}
protected Stream<Arguments> excelMapperTestFail() {
@@ -118,8 +113,7 @@ class FlowableExcelMapperTest {
public void excelMapperTestFail(JsonNode row) {
JsonNode root = row.get("root");
JsonNode test = row.get("test");
logger.info("{}root={}{}test={}", System.lineSeparator(), root, System.lineSeparator(), test);
Assertions.assertThat(isSubset(root, test))
.withFailMessage(System.lineSeparator() + "root=" + root + System.lineSeparator() + "test=" + test).isFalse();
.withFailMessage(System.lineSeparator() + "test :" + test + System.lineSeparator() + "root :" + root).isFalse();
}
}