Search in sources :

Example 6 with WorkItemQuery

use of com.synopsys.integration.azure.boards.common.service.query.fluent.WorkItemQuery in project hub-alert by blackducksoftware.

the class WorkItemQueryTest method whereMultiGroupTest.

@Test
public void whereMultiGroupTest() {
    String expectedQueryString = "SELECT [Field]" + " FROM WorkItems" + " WHERE ( [Field] = 'a value' OR [Other Field] Contains 'something else' )" + " AND [Thing] Was Ever 'not a thing'" + " AND ( [Something] Does Not Contain 'forbidden phrase' AND [Something Else] <> '' )" + " ORDER BY [Other Field]";
    WorkItemQuery workItemQuery = WorkItemQuery.select("Field").fromWorkItems().whereGroup("Field", WorkItemQueryWhereOperator.EQ, "a value").or("Other Field", WorkItemQueryWhereOperator.CONTAINS, "something else").endGroup().and("Thing", WorkItemQueryWhereOperator.WAS_EVER, "not a thing").beginGroup().and("Something", WorkItemQueryWhereOperator.DOES_NOT_CONTAIN, "forbidden phrase").and("Something Else", WorkItemQueryWhereOperator.NOT_EQUALS, null).orderBy("Other Field").build();
    assertEquals(expectedQueryString, workItemQuery.toString());
}
Also used : WorkItemQuery(com.synopsys.integration.azure.boards.common.service.query.fluent.WorkItemQuery) Test(org.junit.jupiter.api.Test)

Aggregations

WorkItemQuery (com.synopsys.integration.azure.boards.common.service.query.fluent.WorkItemQuery)6 Test (org.junit.jupiter.api.Test)5 AzureBoardsIssueTrackerQueryManager (com.synopsys.integration.alert.channel.azure.boards.distribution.AzureBoardsIssueTrackerQueryManager)2 LinkableItem (com.synopsys.integration.alert.common.message.model.LinkableItem)2 WorkItemQueryWhere (com.synopsys.integration.azure.boards.common.service.query.fluent.WorkItemQueryWhere)1 LocalDate (java.time.LocalDate)1 DateTimeFormatter (java.time.format.DateTimeFormatter)1