private ModelInfo createModelInfo() {

    ModelInfo info = new ModelInfo();

    info.setGroupId(GROUP_ID);
    info.setDescription("Test model description");
    info.setModelId(MODEL_ID);
    info.setName("Test model name");
    info.setProvider(provider);

    return info;
  }
  @Test
  public void testConvertQuery() {
    String domainName = "test_domain";
    String modelId = "model_id";
    String columnId = "column_id";
    LogicalColumn mockColumn = mock(LogicalColumn.class);
    doReturn(DataType.STRING).when(mockColumn).getDataType();
    doReturn(columnId).when(mockColumn).getId();
    LogicalModel mockModel = mock(LogicalModel.class);
    doReturn(mockColumn).when(mockModel).findLogicalColumn(columnId);
    Domain mockDomain = mock(Domain.class);
    doReturn(mockModel).when(mockDomain).findLogicalModel(modelId);
    IMetadataDomainRepository mockRepo = mock(IMetadataDomainRepository.class);
    doReturn(mockDomain).when(mockRepo).getDomain(domainName);
    org.pentaho.metadata.model.Category category = mock(org.pentaho.metadata.model.Category.class);
    doReturn(category).when(spyMetadataServiceUtil).getCategory(columnId, mockModel);
    doReturn(mockRepo).when(spyMetadataServiceUtil).getDomainRepository();

    Query srcQuery = createMockQuery(domainName, modelId, columnId);
    ModelInfo info = new ModelInfo();
    info.setGroupId(domainName);
    info.setModelId(modelId);

    org.pentaho.metadata.query.model.Query result =
        spyMetadataServiceUtil.convertQuery(srcQuery, info);

    assertNotNull(result);
    assertEquals(mockDomain, result.getDomain());
    assertFalse(result.getDisableDistinct());
    assertEquals(mockModel, result.getLogicalModel());
    assertEquals(1, result.getSelections().size());
    Selection selection = result.getSelections().get(0);
    assertEquals(mockColumn, selection.getLogicalColumn());
    assertEquals(category, selection.getCategory());
    assertEquals(AggregationType.SUM, selection.getActiveAggregationType());
    assertEquals(AggregationType.SUM, selection.getAggregationType());
    assertEquals(1, result.getConstraints().size());
    Constraint constraint = result.getConstraints().get(0);
    assertEquals(CombinationType.AND, constraint.getCombinationType());
    assertNull(constraint.getFormula());
    assertEquals(1, result.getOrders().size());
    org.pentaho.metadata.query.model.Order resOrder = result.getOrders().get(0);
    assertEquals(selection, resOrder.getSelection());
    assertEquals(Type.ASC, resOrder.getType());
    assertEquals(1, result.getParameters().size());
    org.pentaho.metadata.query.model.Parameter param = result.getParameters().get(0);
    assertEquals("parameter_name", param.getName());
    assertEquals("val_0", param.getDefaultValue());
    assertEquals(DataType.STRING, param.getType());
  }