Skip to content

Commit 0b272e5

Browse files
authored
Improved unit test coverage and enforce during all phases (#207)
Adjusted goals to invoke JaCoCo plugin for unit test coverage for all phases Included additional unit testing to improve coverage
1 parent c20078b commit 0b272e5

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

pom.xml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,17 +284,12 @@
284284
<goal>prepare-agent</goal>
285285
</goals>
286286
</execution>
287-
<execution>
288-
<id>report</id>
289-
<phase>prepare-package</phase>
290-
<goals>
291-
<goal>report</goal>
292-
</goals>
293-
</execution>
294287
<execution>
295288
<id>jacoco-check</id>
289+
<phase>test</phase>
296290
<goals>
297291
<goal>check</goal>
292+
<goal>report</goal>
298293
</goals>
299294
<configuration>
300295
<rules>
@@ -314,7 +309,7 @@
314309
<limit>
315310
<counter>LINE</counter>
316311
<value>MISSEDCOUNT</value>
317-
<maximum>1550</maximum>
312+
<maximum>1544</maximum>
318313
</limit>
319314
</limits>
320315
</rule>

src/test/java/com/datastax/cdm/cql/CommonMocks.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ public class CommonMocks {
8686
public List<DataType> originClusteringKeyTypes;
8787
public String filterCol;
8888
public DataType filterColType;
89+
public String vectorCol;
90+
public DataType vectorColType;
8991
public List<String> originValueColumns;
9092
public List<DataType> originValueColumnTypes;
9193
public List<String> originCounterColumns;
@@ -174,8 +176,10 @@ public void defaultClassVariables() {
174176
originClusteringKeyTypes = Collections.singletonList(DataTypes.TEXT);
175177
filterCol = "filter_col";
176178
filterColType = DataTypes.TEXT;
177-
originValueColumns = Arrays.asList("value1", filterCol);
178-
originValueColumnTypes = Arrays.asList(DataTypes.TEXT, filterColType);
179+
vectorCol = "vector_col";
180+
vectorColType = DataTypes.vectorOf(DataTypes.FLOAT,3);
181+
originValueColumns = Arrays.asList("value1", filterCol, vectorCol);
182+
originValueColumnTypes = Arrays.asList(DataTypes.TEXT, filterColType, vectorColType);
179183
originCounterColumns = Arrays.asList("counter1","counter2");
180184
originToTargetNameList = Collections.emptyList();
181185

src/test/java/com/datastax/cdm/cql/statement/TargetInsertStatementTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,16 @@ public void bind_withExceptionWhenBindingValue() {
191191
assertThrows(RuntimeException.class, () -> targetInsertStatement.bind(originRow, targetRow, 3600, 123456789L, explodeMapKey, explodeMapValue));
192192
}
193193

194+
195+
@Test
196+
public void bind_withVectorColumns() {
197+
targetInsertStatement = new TargetInsertStatement(propertyHelper, targetSession);
198+
assertTrue(targetInsertStatement.targetColumnNames.contains(vectorCol));
199+
assertTrue(6 == targetInsertStatement.targetColumnNames.size());
200+
assertEquals(vectorColType, targetInsertStatement.targetColumnTypes.get(5));
201+
BoundStatement result = targetInsertStatement.bind(originRow, targetRow, null, null,null, null);
202+
assertNotNull(result);
203+
verify(boundStatement, times(targetColumnNames.size())).set(anyInt(), any(), any(Class.class));
204+
}
205+
194206
}

0 commit comments

Comments
 (0)