From 5ff47a75d92ceda4e3b11c2767a37d50883bf04b Mon Sep 17 00:00:00 2001 From: Sven Hettwer Date: Fri, 22 Mar 2019 09:28:58 +0100 Subject: [PATCH] (citrusframework/citrus-db#28) Added free implementation --- .../citrus/db/driver/data/CitrusClob.java | 4 ++-- .../citrus/db/driver/data/CitrusClobTest.java | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/driver/src/main/java/com/consol/citrus/db/driver/data/CitrusClob.java b/driver/src/main/java/com/consol/citrus/db/driver/data/CitrusClob.java index 5d0296c..851499a 100644 --- a/driver/src/main/java/com/consol/citrus/db/driver/data/CitrusClob.java +++ b/driver/src/main/java/com/consol/citrus/db/driver/data/CitrusClob.java @@ -126,8 +126,8 @@ public void truncate(final long len) { } @Override - public void free() throws SQLException { - + public void free() { + stringBuilder.delete(0, stringBuilder.length()); } @Override diff --git a/driver/src/test/java/com/consol/citrus/db/driver/data/CitrusClobTest.java b/driver/src/test/java/com/consol/citrus/db/driver/data/CitrusClobTest.java index 7330d8d..892ec45 100644 --- a/driver/src/test/java/com/consol/citrus/db/driver/data/CitrusClobTest.java +++ b/driver/src/test/java/com/consol/citrus/db/driver/data/CitrusClobTest.java @@ -282,6 +282,23 @@ public void testTruncate() throws Exception { assertEquals(clobContent, expectedTruncatedString); } + @Test + public void testFree() throws SQLException { + //We break with the jdbc contract here as it is might cause issues + //to throw such an exceptions during testing. + //The subject to test is the system using the database and not the database + //integration itself. + + //GIVEN + citrusClob.setString(1, sampleText); + + //WHEN + citrusClob.free(); + + //THEN + assertEquals(citrusClob.length(), 0); + } + @Test public void testEqualsContract(){ EqualsVerifier