Move findValues method to EditScrtuinzer (#2941)
* Move findValues method to EditScrtuinzer As findValues method is not concerned with fetching, therefore moving it to EditScrtuinizer * updated test classes accordingly * updated test classes accordingly * test files updated after shifting the findValues method
This commit is contained in:
parent
a3fab26cca
commit
fe275ae634
@ -24,9 +24,7 @@
|
|||||||
package org.openrefine.wikidata.qa;
|
package org.openrefine.wikidata.qa;
|
||||||
|
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
|
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.SnakGroup;
|
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.Value;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -49,15 +47,4 @@ public interface ConstraintFetcher {
|
|||||||
*/
|
*/
|
||||||
List<Statement> getConstraintsByType(PropertyIdValue pid, String qid);
|
List<Statement> getConstraintsByType(PropertyIdValue pid, String qid);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the values of a given property in qualifiers
|
|
||||||
*
|
|
||||||
* @param groups
|
|
||||||
* the qualifiers
|
|
||||||
* @param pid
|
|
||||||
* the property to filter on
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<Value> findValues(List<SnakGroup> groups, String pid);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,10 @@ import org.openrefine.wikidata.utils.EntityCache;
|
|||||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.PropertyDocument;
|
import org.wikidata.wdtk.datamodel.interfaces.PropertyDocument;
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
|
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.SnakGroup;
|
import org.wikidata.wdtk.datamodel.interfaces.SnakGroup;
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.StatementGroup;
|
import org.wikidata.wdtk.datamodel.interfaces.StatementGroup;
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.StatementRank;
|
import org.wikidata.wdtk.datamodel.interfaces.StatementRank;
|
||||||
import org.wikidata.wdtk.datamodel.interfaces.Value;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -118,25 +116,4 @@ public class WikidataConstraintFetcher implements ConstraintFetcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the values of a given property in qualifiers
|
|
||||||
*
|
|
||||||
* @param groups
|
|
||||||
* the qualifiers
|
|
||||||
* @param pid
|
|
||||||
* the property to filter on
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Value> findValues(List<SnakGroup> groups, String pid) {
|
|
||||||
List<Value> results = new ArrayList<>();
|
|
||||||
for (SnakGroup group : groups) {
|
|
||||||
if (group.getProperty().getId().equals(pid)) {
|
|
||||||
for (Snak snak : group.getSnaks())
|
|
||||||
results.add(snak.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ public class DifferenceWithinRangeScrutinizer extends EditScrutinizer {
|
|||||||
DifferenceWithinRangeConstraint(Statement statement) {
|
DifferenceWithinRangeConstraint(Statement statement) {
|
||||||
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
||||||
if (specs != null) {
|
if (specs != null) {
|
||||||
List<Value> lowerValueProperty = _fetcher.findValues(specs, DIFFERENCE_WITHIN_RANGE_CONSTRAINT_PID);
|
List<Value> lowerValueProperty = findValues(specs, DIFFERENCE_WITHIN_RANGE_CONSTRAINT_PID);
|
||||||
List<Value> minValue = _fetcher.findValues(specs, MINIMUM_VALUE_PID);
|
List<Value> minValue = findValues(specs, MINIMUM_VALUE_PID);
|
||||||
List<Value> maxValue = _fetcher.findValues(specs, MAXIMUM_VALUE_PID);
|
List<Value> maxValue = findValues(specs, MAXIMUM_VALUE_PID);
|
||||||
if (!lowerValueProperty.isEmpty()) {
|
if (!lowerValueProperty.isEmpty()) {
|
||||||
lowerPropertyIdValue = (PropertyIdValue) lowerValueProperty.get(0);
|
lowerPropertyIdValue = (PropertyIdValue) lowerValueProperty.get(0);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,12 @@ import org.openrefine.wikidata.qa.QAWarning;
|
|||||||
import org.openrefine.wikidata.qa.QAWarning.Severity;
|
import org.openrefine.wikidata.qa.QAWarning.Severity;
|
||||||
import org.openrefine.wikidata.qa.QAWarningStore;
|
import org.openrefine.wikidata.qa.QAWarningStore;
|
||||||
import org.openrefine.wikidata.updates.ItemUpdate;
|
import org.openrefine.wikidata.updates.ItemUpdate;
|
||||||
|
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||||
|
import org.wikidata.wdtk.datamodel.interfaces.SnakGroup;
|
||||||
|
import org.wikidata.wdtk.datamodel.interfaces.Value;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inspects an edit batch and emits warnings.
|
* Inspects an edit batch and emits warnings.
|
||||||
@ -125,4 +131,24 @@ public abstract class EditScrutinizer {
|
|||||||
protected void critical(String type) {
|
protected void critical(String type) {
|
||||||
addIssue(type, null, QAWarning.Severity.CRITICAL, 1);
|
addIssue(type, null, QAWarning.Severity.CRITICAL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the values of a given property in qualifiers
|
||||||
|
*
|
||||||
|
* @param groups
|
||||||
|
* the qualifiers
|
||||||
|
* @param pid
|
||||||
|
* the property to filter on
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected List<Value> findValues(List<SnakGroup> groups, String pid) {
|
||||||
|
List<Value> results = new ArrayList<>();
|
||||||
|
for (SnakGroup group : groups) {
|
||||||
|
if (group.getProperty().getId().equals(pid)) {
|
||||||
|
for (Snak snak : group.getSnaks())
|
||||||
|
results.add(snak.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public class EntityTypeScrutinizer extends SnakScrutinizer {
|
|||||||
List<SnakGroup> constraint = statementList.get(0).getClaim().getQualifiers();
|
List<SnakGroup> constraint = statementList.get(0).getClaim().getQualifiers();
|
||||||
boolean isUsable = true;
|
boolean isUsable = true;
|
||||||
if (constraint != null) {
|
if (constraint != null) {
|
||||||
isUsable = _fetcher.findValues(constraint, ALLOWED_ENTITY_TYPES_PID).contains(
|
isUsable = findValues(constraint, ALLOWED_ENTITY_TYPES_PID).contains(
|
||||||
Datamodel.makeWikidataItemIdValue(ALLOWED_ITEM_TYPE_QID));
|
Datamodel.makeWikidataItemIdValue(ALLOWED_ITEM_TYPE_QID));
|
||||||
}
|
}
|
||||||
if (!isUsable) {
|
if (!isUsable) {
|
||||||
|
@ -60,7 +60,7 @@ public class FormatScrutinizer extends SnakScrutinizer {
|
|||||||
FormatConstraint(Statement statement) {
|
FormatConstraint(Statement statement) {
|
||||||
List<SnakGroup> constraint = statement.getClaim().getQualifiers();
|
List<SnakGroup> constraint = statement.getClaim().getQualifiers();
|
||||||
if (constraint != null) {
|
if (constraint != null) {
|
||||||
List<Value> regexes = _fetcher.findValues(constraint, FORMAT_REGEX_PID);
|
List<Value> regexes = findValues(constraint, FORMAT_REGEX_PID);
|
||||||
if (!regexes.isEmpty()) {
|
if (!regexes.isEmpty()) {
|
||||||
regularExpressionFormat = ((StringValue) regexes.get(0)).getString();
|
regularExpressionFormat = ((StringValue) regexes.get(0)).getString();
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class InverseConstraintScrutinizer extends StatementScrutinizer {
|
|||||||
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
||||||
|
|
||||||
if (specs != null) {
|
if (specs != null) {
|
||||||
List<Value> inverses = _fetcher.findValues(specs, INVERSE_PROPERTY_PID);
|
List<Value> inverses = findValues(specs, INVERSE_PROPERTY_PID);
|
||||||
if (!inverses.isEmpty()) {
|
if (!inverses.isEmpty()) {
|
||||||
propertyParameterValue = (PropertyIdValue) inverses.get(0);
|
propertyParameterValue = (PropertyIdValue) inverses.get(0);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class QualifierCompatibilityScrutinizer extends StatementScrutinizer {
|
|||||||
allowedProperties = new HashSet<>();
|
allowedProperties = new HashSet<>();
|
||||||
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
||||||
if (specs != null) {
|
if (specs != null) {
|
||||||
List<Value> properties = _fetcher.findValues(specs, ALLOWED_QUALIFIERS_CONSTRAINT_PID);
|
List<Value> properties = findValues(specs, ALLOWED_QUALIFIERS_CONSTRAINT_PID);
|
||||||
allowedProperties = properties.stream()
|
allowedProperties = properties.stream()
|
||||||
.filter(e -> e != null)
|
.filter(e -> e != null)
|
||||||
.map(e -> (PropertyIdValue) e)
|
.map(e -> (PropertyIdValue) e)
|
||||||
@ -75,7 +75,7 @@ public class QualifierCompatibilityScrutinizer extends StatementScrutinizer {
|
|||||||
mandatoryProperties = new HashSet<>();
|
mandatoryProperties = new HashSet<>();
|
||||||
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
||||||
if (specs != null) {
|
if (specs != null) {
|
||||||
List<Value> properties = _fetcher.findValues(specs, MANDATORY_QUALIFIERS_CONSTRAINT_PID);
|
List<Value> properties = findValues(specs, MANDATORY_QUALIFIERS_CONSTRAINT_PID);
|
||||||
mandatoryProperties = properties.stream()
|
mandatoryProperties = properties.stream()
|
||||||
.filter(e -> e != null)
|
.filter(e -> e != null)
|
||||||
.map(e -> (PropertyIdValue) e)
|
.map(e -> (PropertyIdValue) e)
|
||||||
|
@ -38,7 +38,7 @@ public class QuantityScrutinizer extends SnakScrutinizer {
|
|||||||
AllowedUnitsConstraint(Statement statement) {
|
AllowedUnitsConstraint(Statement statement) {
|
||||||
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
||||||
if (specs != null) {
|
if (specs != null) {
|
||||||
List<Value> properties = _fetcher.findValues(specs, ALLOWED_UNITS_CONSTRAINT_PID);
|
List<Value> properties = findValues(specs, ALLOWED_UNITS_CONSTRAINT_PID);
|
||||||
allowedUnits = properties.stream()
|
allowedUnits = properties.stream()
|
||||||
.map(e -> e == null ? null : (ItemIdValue) e)
|
.map(e -> e == null ? null : (ItemIdValue) e)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
@ -57,7 +57,7 @@ public class RestrictedPositionScrutinizer extends StatementScrutinizer {
|
|||||||
ItemIdValue targetValue = Datamodel.makeWikidataItemIdValue(SCOPE_CONSTRAINT_VALUE_QID);
|
ItemIdValue targetValue = Datamodel.makeWikidataItemIdValue(SCOPE_CONSTRAINT_VALUE_QID);
|
||||||
ItemIdValue targetQualifier = Datamodel.makeWikidataItemIdValue(SCOPE_CONSTRAINT_QUALIFIER_QID);
|
ItemIdValue targetQualifier = Datamodel.makeWikidataItemIdValue(SCOPE_CONSTRAINT_QUALIFIER_QID);
|
||||||
ItemIdValue targetReference = Datamodel.makeWikidataItemIdValue(SCOPE_CONSTRAINT_REFERENCE_QID);
|
ItemIdValue targetReference = Datamodel.makeWikidataItemIdValue(SCOPE_CONSTRAINT_REFERENCE_QID);
|
||||||
List<Value> snakValues = _fetcher.findValues(specs, SCOPE_CONSTRAINT_PID);
|
List<Value> snakValues = findValues(specs, SCOPE_CONSTRAINT_PID);
|
||||||
isAllowedAsValue = snakValues.contains(targetValue);
|
isAllowedAsValue = snakValues.contains(targetValue);
|
||||||
isAllowedAsQualifier = snakValues.contains(targetQualifier);
|
isAllowedAsQualifier = snakValues.contains(targetQualifier);
|
||||||
isAllowedAsReference = snakValues.contains(targetReference);
|
isAllowedAsReference = snakValues.contains(targetReference);
|
||||||
|
@ -27,7 +27,7 @@ public class RestrictedValuesScrutinizer extends SnakScrutinizer {
|
|||||||
AllowedValueConstraint(Statement statement) {
|
AllowedValueConstraint(Statement statement) {
|
||||||
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
||||||
if (specs != null) {
|
if (specs != null) {
|
||||||
List<Value> properties = _fetcher.findValues(specs, ALLOWED_VALUES_CONSTRAINT_PID);
|
List<Value> properties = findValues(specs, ALLOWED_VALUES_CONSTRAINT_PID);
|
||||||
allowedValues = properties.stream().collect(Collectors.toSet());
|
allowedValues = properties.stream().collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ public class RestrictedValuesScrutinizer extends SnakScrutinizer {
|
|||||||
DisallowedValueConstraint(Statement statement) {
|
DisallowedValueConstraint(Statement statement) {
|
||||||
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
List<SnakGroup> specs = statement.getClaim().getQualifiers();
|
||||||
if (specs != null) {
|
if (specs != null) {
|
||||||
List<Value> properties = _fetcher.findValues(specs, DISALLOWED_VALUES_CONSTRAINT_PID);
|
List<Value> properties = findValues(specs, DISALLOWED_VALUES_CONSTRAINT_PID);
|
||||||
disallowedValues = properties.stream().collect(Collectors.toSet());
|
disallowedValues = properties.stream().collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ import org.wikidata.wdtk.datamodel.interfaces.TimeValue;
|
|||||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
@ -64,9 +63,6 @@ public class DifferenceWithinScrutinizerTest extends ScrutinizerTest{
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(upperBoundPid, DIFFERENCE_WITHIN_RANGE_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
when(fetcher.getConstraintsByType(upperBoundPid, DIFFERENCE_WITHIN_RANGE_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
||||||
when(fetcher.findValues(constraintQualifiers, DIFFERENCE_WITHIN_RANGE_CONSTRAINT_PID)).thenReturn(Collections.singletonList(lowerBoundPid));
|
|
||||||
when(fetcher.findValues(constraintQualifiers, MINIMUM_VALUE_PID)).thenReturn(Collections.singletonList(minValue));
|
|
||||||
when(fetcher.findValues(constraintQualifiers, MAXIMUM_VALUE_PID)).thenReturn(Collections.singletonList(maxValue));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(updateA);
|
scrutinize(updateA);
|
||||||
@ -92,9 +88,6 @@ public class DifferenceWithinScrutinizerTest extends ScrutinizerTest{
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(upperBoundPid, DIFFERENCE_WITHIN_RANGE_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
when(fetcher.getConstraintsByType(upperBoundPid, DIFFERENCE_WITHIN_RANGE_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
||||||
when(fetcher.findValues(constraintQualifiers, DIFFERENCE_WITHIN_RANGE_CONSTRAINT_PID)).thenReturn(Collections.singletonList(lowerBoundPid));
|
|
||||||
when(fetcher.findValues(constraintQualifiers, MINIMUM_VALUE_PID)).thenReturn(Collections.singletonList(minValue));
|
|
||||||
when(fetcher.findValues(constraintQualifiers, MAXIMUM_VALUE_PID)).thenReturn(Collections.singletonList(maxValue));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(updateA);
|
scrutinize(updateA);
|
||||||
|
@ -50,7 +50,7 @@ public class EntityTypeScrutinizerTest extends StatementScrutinizerTest {
|
|||||||
|
|
||||||
ItemUpdate update = new ItemUpdateBuilder(idA).addStatement(statement).build();
|
ItemUpdate update = new ItemUpdateBuilder(idA).addStatement(statement).build();
|
||||||
|
|
||||||
Snak qualifierSnak = Datamodel.makeValueSnak(itemParameterPID, itemValue);
|
Snak qualifierSnak = Datamodel.makeValueSnak(itemParameterPID, allowedValue);
|
||||||
List<Snak> qualifierSnakList = Collections.singletonList(qualifierSnak);
|
List<Snak> qualifierSnakList = Collections.singletonList(qualifierSnak);
|
||||||
SnakGroup qualifierSnakGroup = Datamodel.makeSnakGroup(qualifierSnakList);
|
SnakGroup qualifierSnakGroup = Datamodel.makeSnakGroup(qualifierSnakList);
|
||||||
List<SnakGroup> snakGroupList = Collections.singletonList(qualifierSnakGroup);
|
List<SnakGroup> snakGroupList = Collections.singletonList(qualifierSnakGroup);
|
||||||
@ -58,7 +58,6 @@ public class EntityTypeScrutinizerTest extends StatementScrutinizerTest {
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyIdValue,ALLOWED_ENTITY_TYPES_QID)).thenReturn(statementList);
|
when(fetcher.getConstraintsByType(propertyIdValue,ALLOWED_ENTITY_TYPES_QID)).thenReturn(statementList);
|
||||||
when(fetcher.findValues(snakGroupList, ALLOWED_ENTITY_TYPES_PID)).thenReturn(Collections.singletonList(allowedValue));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
@ -82,7 +81,6 @@ public class EntityTypeScrutinizerTest extends StatementScrutinizerTest {
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyIdValue,ALLOWED_ENTITY_TYPES_QID)).thenReturn(statementList);
|
when(fetcher.getConstraintsByType(propertyIdValue,ALLOWED_ENTITY_TYPES_QID)).thenReturn(statementList);
|
||||||
when(fetcher.findValues(snakGroupList, ALLOWED_ENTITY_TYPES_PID)).thenReturn(Collections.singletonList(itemValue));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
|
@ -79,7 +79,6 @@ public class FormatScrutinizerTest extends ScrutinizerTest {
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyIdValue, FORMAT_CONSTRAINT_QID)).thenReturn(statementList);
|
when(fetcher.getConstraintsByType(propertyIdValue, FORMAT_CONSTRAINT_QID)).thenReturn(statementList);
|
||||||
when(fetcher.findValues(snakGroupList, FORMAT_REGEX_PID)).thenReturn(Collections.singletonList(regularExpressionFormat));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
scrutinize(updateA);
|
scrutinize(updateA);
|
||||||
assertWarningsRaised(FormatScrutinizer.type);
|
assertWarningsRaised(FormatScrutinizer.type);
|
||||||
@ -100,7 +99,6 @@ public class FormatScrutinizerTest extends ScrutinizerTest {
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyIdValue, FORMAT_CONSTRAINT_QID)).thenReturn(statementList);
|
when(fetcher.getConstraintsByType(propertyIdValue, FORMAT_CONSTRAINT_QID)).thenReturn(statementList);
|
||||||
when(fetcher.findValues(snakGroupList, FORMAT_REGEX_PID)).thenReturn(Collections.singletonList(regularExpressionFormat));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
scrutinize(updateA);
|
scrutinize(updateA);
|
||||||
assertNoWarningRaised();
|
assertNoWarningRaised();
|
||||||
@ -121,7 +119,6 @@ public class FormatScrutinizerTest extends ScrutinizerTest {
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyIdValue, FORMAT_CONSTRAINT_QID)).thenReturn(statementList);
|
when(fetcher.getConstraintsByType(propertyIdValue, FORMAT_CONSTRAINT_QID)).thenReturn(statementList);
|
||||||
when(fetcher.findValues(snakGroupList, FORMAT_REGEX_PID)).thenReturn(Collections.singletonList(regularExpressionFormat));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
scrutinize(updateA);
|
scrutinize(updateA);
|
||||||
assertWarningsRaised(FormatScrutinizer.type);
|
assertWarningsRaised(FormatScrutinizer.type);
|
||||||
|
@ -69,7 +69,7 @@ public class InverseConstaintScrutinizerTest extends StatementScrutinizerTest {
|
|||||||
Statement statement = new StatementImpl("P25", mainSnak, idA);
|
Statement statement = new StatementImpl("P25", mainSnak, idA);
|
||||||
ItemUpdate update = new ItemUpdateBuilder(idA).addStatement(statement).build();
|
ItemUpdate update = new ItemUpdateBuilder(idA).addStatement(statement).build();
|
||||||
|
|
||||||
Snak qualifierSnak = Datamodel.makeValueSnak(propertyParameter, inverseEntityIdValue);
|
Snak qualifierSnak = Datamodel.makeValueSnak(propertyParameter, inversePropertyID);
|
||||||
List<Snak> qualifierSnakList = Collections.singletonList(qualifierSnak);
|
List<Snak> qualifierSnakList = Collections.singletonList(qualifierSnak);
|
||||||
SnakGroup qualifierSnakGroup = Datamodel.makeSnakGroup(qualifierSnakList);
|
SnakGroup qualifierSnakGroup = Datamodel.makeSnakGroup(qualifierSnakList);
|
||||||
List<SnakGroup> snakGroupList = Collections.singletonList(qualifierSnakGroup);
|
List<SnakGroup> snakGroupList = Collections.singletonList(qualifierSnakGroup);
|
||||||
@ -77,7 +77,6 @@ public class InverseConstaintScrutinizerTest extends StatementScrutinizerTest {
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyId, INVERSE_CONSTRAINT_QID)).thenReturn(statementList);
|
when(fetcher.getConstraintsByType(propertyId, INVERSE_CONSTRAINT_QID)).thenReturn(statementList);
|
||||||
when(fetcher.findValues(snakGroupList, INVERSE_PROPERTY_PID)).thenReturn(Collections.singletonList(inversePropertyID));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
assertWarningsRaised(InverseConstraintScrutinizer.type);
|
assertWarningsRaised(InverseConstraintScrutinizer.type);
|
||||||
@ -98,7 +97,6 @@ public class InverseConstaintScrutinizerTest extends StatementScrutinizerTest {
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(symmetricPropertyID, SYMMETRIC_CONSTRAINT_QID)).thenReturn(statementList);
|
when(fetcher.getConstraintsByType(symmetricPropertyID, SYMMETRIC_CONSTRAINT_QID)).thenReturn(statementList);
|
||||||
when(fetcher.findValues(snakGroupList, INVERSE_PROPERTY_PID)).thenReturn(Collections.singletonList(symmetricPropertyID));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
assertWarningsRaised(InverseConstraintScrutinizer.type);
|
assertWarningsRaised(InverseConstraintScrutinizer.type);
|
||||||
@ -119,7 +117,6 @@ public class InverseConstaintScrutinizerTest extends StatementScrutinizerTest {
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyId, INVERSE_CONSTRAINT_QID)).thenReturn(statementList);
|
when(fetcher.getConstraintsByType(propertyId, INVERSE_CONSTRAINT_QID)).thenReturn(statementList);
|
||||||
when(fetcher.findValues(snakGroupList, INVERSE_PROPERTY_PID)).thenReturn(Collections.singletonList(inversePropertyID));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
assertNoWarningRaised();
|
assertNoWarningRaised();
|
||||||
|
@ -46,7 +46,6 @@ import static org.mockito.Mockito.mock;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.openrefine.wikidata.qa.scrutinizers.QualifierCompatibilityScrutinizer.ALLOWED_QUALIFIERS_CONSTRAINT_PID;
|
import static org.openrefine.wikidata.qa.scrutinizers.QualifierCompatibilityScrutinizer.ALLOWED_QUALIFIERS_CONSTRAINT_PID;
|
||||||
import static org.openrefine.wikidata.qa.scrutinizers.QualifierCompatibilityScrutinizer.ALLOWED_QUALIFIERS_CONSTRAINT_QID;
|
import static org.openrefine.wikidata.qa.scrutinizers.QualifierCompatibilityScrutinizer.ALLOWED_QUALIFIERS_CONSTRAINT_QID;
|
||||||
import static org.openrefine.wikidata.qa.scrutinizers.QualifierCompatibilityScrutinizer.MANDATORY_QUALIFIERS_CONSTRAINT_PID;
|
|
||||||
import static org.openrefine.wikidata.qa.scrutinizers.QualifierCompatibilityScrutinizer.MANDATORY_QUALIFIERS_CONSTRAINT_QID;
|
import static org.openrefine.wikidata.qa.scrutinizers.QualifierCompatibilityScrutinizer.MANDATORY_QUALIFIERS_CONSTRAINT_QID;
|
||||||
|
|
||||||
public class QualifierCompatibilityScrutinizerTest extends StatementScrutinizerTest {
|
public class QualifierCompatibilityScrutinizerTest extends StatementScrutinizerTest {
|
||||||
@ -82,7 +81,6 @@ public class QualifierCompatibilityScrutinizerTest extends StatementScrutinizerT
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(allowedPropertyIdValue, ALLOWED_QUALIFIERS_CONSTRAINT_QID)).thenReturn(statementList);
|
when(fetcher.getConstraintsByType(allowedPropertyIdValue, ALLOWED_QUALIFIERS_CONSTRAINT_QID)).thenReturn(statementList);
|
||||||
when(fetcher.findValues(snakGroupList, ALLOWED_QUALIFIERS_CONSTRAINT_PID)).thenReturn(Collections.singletonList(qualifierProperty));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
@ -104,7 +102,6 @@ public class QualifierCompatibilityScrutinizerTest extends StatementScrutinizerT
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(mandatoryPropertyIdValue, MANDATORY_QUALIFIERS_CONSTRAINT_QID)).thenReturn(statementList);
|
when(fetcher.getConstraintsByType(mandatoryPropertyIdValue, MANDATORY_QUALIFIERS_CONSTRAINT_QID)).thenReturn(statementList);
|
||||||
when(fetcher.findValues(snakGroupList, MANDATORY_QUALIFIERS_CONSTRAINT_PID)).thenReturn(Collections.singletonList(qualifierProperty));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
@ -127,7 +124,6 @@ public class QualifierCompatibilityScrutinizerTest extends StatementScrutinizerT
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(allowedPropertyIdValue, ALLOWED_QUALIFIERS_CONSTRAINT_QID)).thenReturn(statementList);
|
when(fetcher.getConstraintsByType(allowedPropertyIdValue, ALLOWED_QUALIFIERS_CONSTRAINT_QID)).thenReturn(statementList);
|
||||||
when(fetcher.findValues(snakGroupList, ALLOWED_QUALIFIERS_CONSTRAINT_PID)).thenReturn(Collections.singletonList(qualifierProperty));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
|
@ -20,8 +20,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.openrefine.wikidata.qa.scrutinizers.QuantityScrutinizer.ALLOWED_UNITS_CONSTRAINT_PID;
|
import static org.openrefine.wikidata.qa.scrutinizers.QuantityScrutinizer.ALLOWED_UNITS_CONSTRAINT_PID;
|
||||||
@ -212,7 +210,6 @@ public class QuantityScrutinizerTest extends ValueScrutinizerTest{
|
|||||||
List<Statement> constraintDefinitions = constraintParameterStatementList(allowedUnitEntity, constraintQualifiers);
|
List<Statement> constraintDefinitions = constraintParameterStatementList(allowedUnitEntity, constraintQualifiers);
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyIdValue, ALLOWED_UNITS_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
when(fetcher.getConstraintsByType(propertyIdValue, ALLOWED_UNITS_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
||||||
when(fetcher.findValues(constraintQualifiers, ALLOWED_UNITS_CONSTRAINT_PID)).thenReturn(Collections.singletonList(allowedUnit));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
@ -229,7 +226,6 @@ public class QuantityScrutinizerTest extends ValueScrutinizerTest{
|
|||||||
List<Statement> constraintDefinitions = constraintParameterStatementList(allowedUnitEntity, new ArrayList<>());
|
List<Statement> constraintDefinitions = constraintParameterStatementList(allowedUnitEntity, new ArrayList<>());
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyIdValue, ALLOWED_UNITS_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
when(fetcher.getConstraintsByType(propertyIdValue, ALLOWED_UNITS_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
||||||
when(fetcher.findValues(any(), eq(ALLOWED_UNITS_CONSTRAINT_PID))).thenReturn(new ArrayList<>());
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
@ -245,7 +241,6 @@ public class QuantityScrutinizerTest extends ValueScrutinizerTest{
|
|||||||
|
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyIdValue, ALLOWED_UNITS_CONSTRAINT_QID)).thenReturn(new ArrayList<>());
|
when(fetcher.getConstraintsByType(propertyIdValue, ALLOWED_UNITS_CONSTRAINT_QID)).thenReturn(new ArrayList<>());
|
||||||
when(fetcher.findValues(any(), eq(ALLOWED_UNITS_CONSTRAINT_PID))).thenReturn(new ArrayList<>());
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
|
@ -73,7 +73,6 @@ public class RestrictedPositionScrutinizerTest extends SnakScrutinizerTest {
|
|||||||
List<Statement> constraintDefinitions = constraintParameterStatementList(entityIdValue, constraintQualifiers);
|
List<Statement> constraintDefinitions = constraintParameterStatementList(entityIdValue, constraintQualifiers);
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyIdValue, SCOPE_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
when(fetcher.getConstraintsByType(propertyIdValue, SCOPE_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
||||||
when(fetcher.findValues(constraintQualifiers, SCOPE_CONSTRAINT_PID)).thenReturn(Collections.singletonList(asQualifier));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
@ -92,7 +91,6 @@ public class RestrictedPositionScrutinizerTest extends SnakScrutinizerTest {
|
|||||||
List<Statement> constraintDefinitions = constraintParameterStatementList(entityIdValue, constraintQualifiers);
|
List<Statement> constraintDefinitions = constraintParameterStatementList(entityIdValue, constraintQualifiers);
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyIdValue, SCOPE_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
when(fetcher.getConstraintsByType(propertyIdValue, SCOPE_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
||||||
when(fetcher.findValues(constraintQualifiers, SCOPE_CONSTRAINT_PID)).thenReturn(Collections.singletonList(asMainSnak));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
@ -130,7 +128,6 @@ public class RestrictedPositionScrutinizerTest extends SnakScrutinizerTest {
|
|||||||
List<Statement> constraintDefinitions = constraintParameterStatementList(entityIdValue, constraintQualifiers);
|
List<Statement> constraintDefinitions = constraintParameterStatementList(entityIdValue, constraintQualifiers);
|
||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(propertyIdValue, SCOPE_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
when(fetcher.getConstraintsByType(propertyIdValue, SCOPE_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
||||||
when(fetcher.findValues(constraintQualifiers, SCOPE_CONSTRAINT_PID)).thenReturn(Collections.singletonList(asMainSnak));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(update);
|
scrutinize(update);
|
||||||
|
@ -12,7 +12,6 @@ import org.wikidata.wdtk.datamodel.interfaces.SnakGroup;
|
|||||||
import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
@ -21,7 +20,6 @@ import static org.mockito.Mockito.mock;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.openrefine.wikidata.qa.scrutinizers.RestrictedValuesScrutinizer.ALLOWED_VALUES_CONSTRAINT_PID;
|
import static org.openrefine.wikidata.qa.scrutinizers.RestrictedValuesScrutinizer.ALLOWED_VALUES_CONSTRAINT_PID;
|
||||||
import static org.openrefine.wikidata.qa.scrutinizers.RestrictedValuesScrutinizer.ALLOWED_VALUES_CONSTRAINT_QID;
|
import static org.openrefine.wikidata.qa.scrutinizers.RestrictedValuesScrutinizer.ALLOWED_VALUES_CONSTRAINT_QID;
|
||||||
import static org.openrefine.wikidata.qa.scrutinizers.RestrictedValuesScrutinizer.DISALLOWED_VALUES_CONSTRAINT_PID;
|
|
||||||
import static org.openrefine.wikidata.qa.scrutinizers.RestrictedValuesScrutinizer.DISALLOWED_VALUES_CONSTRAINT_QID;
|
import static org.openrefine.wikidata.qa.scrutinizers.RestrictedValuesScrutinizer.DISALLOWED_VALUES_CONSTRAINT_QID;
|
||||||
|
|
||||||
public class RestrictedValuesScrutinizerTest extends SnakScrutinizerTest {
|
public class RestrictedValuesScrutinizerTest extends SnakScrutinizerTest {
|
||||||
@ -64,7 +62,6 @@ public class RestrictedValuesScrutinizerTest extends SnakScrutinizerTest {
|
|||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(allowedPropertyIdValue, ALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
when(fetcher.getConstraintsByType(allowedPropertyIdValue, ALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
||||||
when(fetcher.getConstraintsByType(allowedPropertyIdValue, DISALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(new ArrayList<>());
|
when(fetcher.getConstraintsByType(allowedPropertyIdValue, DISALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(new ArrayList<>());
|
||||||
when(fetcher.findValues(constraintQualifiers, ALLOWED_VALUES_CONSTRAINT_PID)).thenReturn(Collections.singletonList(allowedValue));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(statement);
|
scrutinize(statement);
|
||||||
@ -82,7 +79,6 @@ public class RestrictedValuesScrutinizerTest extends SnakScrutinizerTest {
|
|||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(allowedPropertyIdValue, ALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
when(fetcher.getConstraintsByType(allowedPropertyIdValue, ALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
||||||
when(fetcher.getConstraintsByType(allowedPropertyIdValue, DISALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(new ArrayList<>());
|
when(fetcher.getConstraintsByType(allowedPropertyIdValue, DISALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(new ArrayList<>());
|
||||||
when(fetcher.findValues(constraintQualifiers, ALLOWED_VALUES_CONSTRAINT_PID)).thenReturn(Collections.singletonList(allowedValue));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(statement);
|
scrutinize(statement);
|
||||||
@ -100,7 +96,6 @@ public class RestrictedValuesScrutinizerTest extends SnakScrutinizerTest {
|
|||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(disallowedPropertyIdValue, ALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(new ArrayList<>());
|
when(fetcher.getConstraintsByType(disallowedPropertyIdValue, ALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(new ArrayList<>());
|
||||||
when(fetcher.getConstraintsByType(disallowedPropertyIdValue, DISALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
when(fetcher.getConstraintsByType(disallowedPropertyIdValue, DISALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
||||||
when(fetcher.findValues(constraintQualifiers, DISALLOWED_VALUES_CONSTRAINT_PID)).thenReturn(Collections.singletonList(disallowedValue));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(statement);
|
scrutinize(statement);
|
||||||
@ -118,7 +113,6 @@ public class RestrictedValuesScrutinizerTest extends SnakScrutinizerTest {
|
|||||||
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
ConstraintFetcher fetcher = mock(ConstraintFetcher.class);
|
||||||
when(fetcher.getConstraintsByType(disallowedPropertyIdValue, ALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(new ArrayList<>());
|
when(fetcher.getConstraintsByType(disallowedPropertyIdValue, ALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(new ArrayList<>());
|
||||||
when(fetcher.getConstraintsByType(disallowedPropertyIdValue, DISALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
when(fetcher.getConstraintsByType(disallowedPropertyIdValue, DISALLOWED_VALUES_CONSTRAINT_QID)).thenReturn(constraintDefinitions);
|
||||||
when(fetcher.findValues(constraintQualifiers, DISALLOWED_VALUES_CONSTRAINT_PID)).thenReturn(Collections.singletonList(disallowedValue));
|
|
||||||
setFetcher(fetcher);
|
setFetcher(fetcher);
|
||||||
|
|
||||||
scrutinize(statement);
|
scrutinize(statement);
|
||||||
|
Loading…
Reference in New Issue
Block a user