Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Commit

Permalink
Merge branch 'develop' into feature/#144-missing-attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
David Amore committed May 22, 2019
2 parents 478f173 + dc7d930 commit 7c27b24
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Expand Up @@ -12,33 +12,33 @@
public class DataRowMatchesTest {
@Test
public void testPositive() throws ParseException {
DataRow dataRow = DataRowProvider.buildSampleDataRow(false);
DataRow dataRow = DataRowProvider.buildStringOnlyDataRow();
DataRow filter = new DataRow();
filter.setFieldValue(DataRowProvider.STRINGFIELD, "Value");
filter.setFieldValue(DataRowProvider.STRINGFIELD, DataRowProvider.STRINGFIELD_VALUE);
assertTrue(dataRow.matches(filter));
}

@Test
public void testNegative() throws ParseException {
DataRow dataRow = DataRowProvider.buildSampleDataRow(false);
DataRow dataRow = DataRowProvider.buildStringOnlyDataRow();
DataRow filter = new DataRow();
filter.setFieldValue(DataRowProvider.STRINGFIELD, "This is not the value, you are looking for");
assertFalse(dataRow.matches(filter));
}

@Test
public void testNonExistingFields() throws ParseException {
DataRow dataRow = DataRowProvider.buildSampleDataRow(false);
DataRow dataRow = DataRowProvider.buildStringOnlyDataRow();
DataRow filter = new DataRow();
filter.setFieldValue("Not a field in existance", "should not be compared");
assertTrue(dataRow.matches(filter));// not sure if it should behave like this
}

@Test
public void testRegex() throws ParseException {
DataRow dataRow = DataRowProvider.buildSampleDataRow(false);
DataRow dataRow = DataRowProvider.buildStringOnlyDataRow();
DataRow filter = new DataRow();
filter.setFieldValue(DataRowProvider.STRINGFIELD, "regex:[A-Z][a-z]*");
assertTrue(dataRow.matches(filter));
assertFalse(dataRow.matches(filter));
}
}
@@ -1,12 +1,12 @@
package com.basiscomponents.db.util;

import com.basiscomponents.db.DataRow;

import java.sql.Date;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.Calendar;

import com.basiscomponents.db.DataRow;

public class DataRowProvider {
public static final String STRINGFIELD = "STRINGFIELD";
public static final String SCD_STRINGFIELD = "SCD_STRINGFIELD";
Expand All @@ -28,6 +28,7 @@ public class DataRowProvider {
public static final String NESTEDDATAROW2 = "NESTEDDATAROW2";
public static final String NESTEDRESULTSET1 = "NESTEDRESULTSET1";
public static final String NESTEDRESULTSET2 = "NESTEDRESULTSET2";
public static final String STRINGFIELD_VALUE ="1337";

// public static final String BYTEFIELD = "BYTEFIELD";
// public static final String SCD_BYTEFIELD = "SCD_BYTEFIELD";
Expand Down Expand Up @@ -189,7 +190,7 @@ public static DataRow buildSampleDataRowMinMax() {
public static DataRow buildStringOnlyDataRow() {
DataRow dr = new DataRow();
try {
dr.setFieldValue(STRINGFIELD, "1337");
dr.setFieldValue(STRINGFIELD, STRINGFIELD_VALUE);
dr.setFieldValue(SCD_STRINGFIELD, "StringValue");
dr.setFieldValue(TRD_STRINGFIELD, "4StringValue2");
dr.setFieldValue(FRT_STRINGFIELD, "");
Expand Down

0 comments on commit 7c27b24

Please sign in to comment.