Browse Source

Fix JUnit 5 assertion argument order in tests (condition first, message second)

Co-authored-by: ViacheslavKlimov <56742475+ViacheslavKlimov@users.noreply.github.com>
pull/14725/head
copilot-swe-agent[bot] 8 months ago
parent
commit
d5ced6ad22
  1. 28
      common/data/src/test/java/org/thingsboard/server/common/data/DynamicProtoUtilsTest.java

28
common/data/src/test/java/org/thingsboard/server/common/data/DynamicProtoUtilsTest.java

@ -215,15 +215,15 @@ public class DynamicProtoUtilsTest {
String json = DynamicProtoUtils.dynamicMsgToJson(firmwareStatusDescriptor, firmwareStatus.toByteArray());
// Default behavior: field names converted to camelCase
assertTrue("JSON should contain camelCase field 'currentFwTitle'", json.contains("\"currentFwTitle\""));
assertTrue("JSON should contain camelCase field 'currentFwVersion'", json.contains("\"currentFwVersion\""));
assertTrue("JSON should contain camelCase field 'fwState'", json.contains("\"fwState\""));
assertTrue("JSON should contain camelCase field 'targetFwTitle'", json.contains("\"targetFwTitle\""));
assertTrue("JSON should contain camelCase field 'targetFwVersion'", json.contains("\"targetFwVersion\""));
assertTrue(json.contains("\"currentFwTitle\""), "JSON should contain camelCase field 'currentFwTitle'");
assertTrue(json.contains("\"currentFwVersion\""), "JSON should contain camelCase field 'currentFwVersion'");
assertTrue(json.contains("\"fwState\""), "JSON should contain camelCase field 'fwState'");
assertTrue(json.contains("\"targetFwTitle\""), "JSON should contain camelCase field 'targetFwTitle'");
assertTrue(json.contains("\"targetFwVersion\""), "JSON should contain camelCase field 'targetFwVersion'");
// Verify snake_case versions are NOT present
assertFalse("JSON should NOT contain snake_case field 'current_fw_title'", json.contains("\"current_fw_title\""));
assertFalse("JSON should NOT contain snake_case field 'fw_state'", json.contains("\"fw_state\""));
assertFalse(json.contains("\"current_fw_title\""), "JSON should NOT contain snake_case field 'current_fw_title'");
assertFalse(json.contains("\"fw_state\""), "JSON should NOT contain snake_case field 'fw_state'");
}
@Test
@ -261,15 +261,15 @@ public class DynamicProtoUtilsTest {
String json = DynamicProtoUtils.dynamicMsgToJson(firmwareStatusDescriptor, firmwareStatus.toByteArray());
// When flag is enabled, verify snake_case is preserved
assertTrue("JSON should contain snake_case field 'current_fw_title'", json.contains("\"current_fw_title\""));
assertTrue("JSON should contain snake_case field 'current_fw_version'", json.contains("\"current_fw_version\""));
assertTrue("JSON should contain snake_case field 'fw_state'", json.contains("\"fw_state\""));
assertTrue("JSON should contain snake_case field 'target_fw_title'", json.contains("\"target_fw_title\""));
assertTrue("JSON should contain snake_case field 'target_fw_version'", json.contains("\"target_fw_version\""));
assertTrue(json.contains("\"current_fw_title\""), "JSON should contain snake_case field 'current_fw_title'");
assertTrue(json.contains("\"current_fw_version\""), "JSON should contain snake_case field 'current_fw_version'");
assertTrue(json.contains("\"fw_state\""), "JSON should contain snake_case field 'fw_state'");
assertTrue(json.contains("\"target_fw_title\""), "JSON should contain snake_case field 'target_fw_title'");
assertTrue(json.contains("\"target_fw_version\""), "JSON should contain snake_case field 'target_fw_version'");
// Verify camelCase versions are NOT present
assertFalse("JSON should NOT contain camelCase field 'currentFwTitle'", json.contains("\"currentFwTitle\""));
assertFalse("JSON should NOT contain camelCase field 'fwState'", json.contains("\"fwState\""));
assertFalse(json.contains("\"currentFwTitle\""), "JSON should NOT contain camelCase field 'currentFwTitle'");
assertFalse(json.contains("\"fwState\""), "JSON should NOT contain camelCase field 'fwState'");
}
}

Loading…
Cancel
Save