Skip to content

Commit bfd4c2c

Browse files
cuioss-oliverclaude
andcommitted
test: Enhance coverage for deprecated writeProperty method
Added comprehensive test coverage including: - Null value handling - Method chaining scenarios - Multiple sequential writes This improves test coverage for the restored deprecated writeProperty method to meet Sonar quality gate requirements (80% coverage threshold). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent dea4b4c commit bfd4c2c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/test/java/de/cuioss/tools/property/PropertyUtilTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,20 @@ void shouldSupportDeprecatedWriteProperty() {
140140
assertAll("Testing deprecated writeProperty",
141141
() -> assertSame(underTest, result, "Should return the same bean instance for chaining"),
142142
() -> assertEquals(number, readProperty(underTest, ATTRIBUTE_READ_WRITE), "Property value should be set correctly"));
143+
144+
// Test with null value
145+
Object nullResult = writeProperty(underTest, ATTRIBUTE_READ_WRITE, null);
146+
assertAll("Testing deprecated writeProperty with null",
147+
() -> assertSame(underTest, nullResult, "Should return the bean instance even with null value"),
148+
() -> assertNull(readProperty(underTest, ATTRIBUTE_READ_WRITE), "Property value should be null"));
149+
150+
// Test chaining multiple writes
151+
Object chainResult = writeProperty(
152+
writeProperty(underTest, ATTRIBUTE_READ_WRITE, 10),
153+
ATTRIBUTE_READ_WRITE, 20);
154+
assertAll("Testing method chaining",
155+
() -> assertSame(underTest, chainResult, "Should return the bean for chaining"),
156+
() -> assertEquals(20, readProperty(underTest, ATTRIBUTE_READ_WRITE), "Final value should be 20"));
143157
}
144158

145159
}

0 commit comments

Comments
 (0)