@Test void testValidateNumericalQueryFieldInt() { Attribute attribute = when(mock(Attribute.class).getDataType()).thenReturn(INT).getMock(); assertDoesNotThrow(() -> queryGenerator.validateNumericalQueryField(attribute)); }
void validateNumericalQueryField(Attribute attr) { AttributeType dataType = attr.getDataType(); switch (dataType) { case DATE: case DATE_TIME: case DECIMAL: case INT: case LONG: break; case BOOL: case CATEGORICAL: case CATEGORICAL_MREF: case COMPOUND: case EMAIL: case ENUM: case FILE: case HTML: case HYPERLINK: case MREF: case ONE_TO_MANY: case SCRIPT: case STRING: case TEXT: case XREF: throw new MolgenisQueryException("Range query not allowed for type [" + dataType + "]"); default: throw new UnexpectedEnumException(dataType); } }
BaseQueryClauseGenerator implements QueryClauseGenerator { void validateNumericalQueryField(Attribute attr) { AttributeType dataType = attr.getDataType(); switch (dataType) { case DATE: case DATE_TIME: case DECIMAL: case INT: case LONG: break; case BOOL: case CATEGORICAL: case CATEGORICAL_MREF: case COMPOUND: case EMAIL: case ENUM: case FILE: case HTML: case HYPERLINK: case MREF: case ONE_TO_MANY: case SCRIPT: case STRING: case TEXT: case XREF: throw new MolgenisQueryException("Range query not allowed for type [" + dataType + "]"); default: throw new UnexpectedEnumException(dataType); } } }
BaseQueryClauseGenerator implements QueryClauseGenerator { void validateNumericalQueryField(Attribute attr) { AttributeType dataType = attr.getDataType(); switch (dataType) { case DATE: case DATE_TIME: case DECIMAL: case INT: case LONG: break; case BOOL: case CATEGORICAL: case CATEGORICAL_MREF: case COMPOUND: case EMAIL: case ENUM: case FILE: case HTML: case HYPERLINK: case MREF: case ONE_TO_MANY: case SCRIPT: case STRING: case TEXT: case XREF: throw new MolgenisQueryException("Range query not allowed for type [" + dataType + "]"); default: throw new UnexpectedEnumException(dataType); } } BaseQueryClauseGenerator(DocumentIdGenerator documentIdGenerator, Operator operator); }
BaseQueryClauseGenerator implements QueryClauseGenerator { void validateNumericalQueryField(Attribute attr) { AttributeType dataType = attr.getDataType(); switch (dataType) { case DATE: case DATE_TIME: case DECIMAL: case INT: case LONG: break; case BOOL: case CATEGORICAL: case CATEGORICAL_MREF: case COMPOUND: case EMAIL: case ENUM: case FILE: case HTML: case HYPERLINK: case MREF: case ONE_TO_MANY: case SCRIPT: case STRING: case TEXT: case XREF: throw new MolgenisQueryException("Range query not allowed for type [" + dataType + "]"); default: throw new UnexpectedEnumException(dataType); } } BaseQueryClauseGenerator(DocumentIdGenerator documentIdGenerator, Operator operator); @Override Operator getOperator(); @Override QueryBuilder createQueryClause(QueryRule queryRule, EntityType entityType); }
BaseQueryClauseGenerator implements QueryClauseGenerator { void validateNumericalQueryField(Attribute attr) { AttributeType dataType = attr.getDataType(); switch (dataType) { case DATE: case DATE_TIME: case DECIMAL: case INT: case LONG: break; case BOOL: case CATEGORICAL: case CATEGORICAL_MREF: case COMPOUND: case EMAIL: case ENUM: case FILE: case HTML: case HYPERLINK: case MREF: case ONE_TO_MANY: case SCRIPT: case STRING: case TEXT: case XREF: throw new MolgenisQueryException("Range query not allowed for type [" + dataType + "]"); default: throw new UnexpectedEnumException(dataType); } } BaseQueryClauseGenerator(DocumentIdGenerator documentIdGenerator, Operator operator); @Override Operator getOperator(); @Override QueryBuilder createQueryClause(QueryRule queryRule, EntityType entityType);  }