private static void setBranch(IssueQuery.Builder builder, ComponentDto component, @Nullable String branch) {
builder.branchUuid(branch == null ? null : component.projectUuid());
- builder.mainBranch(branch == null || !branch.equals(component.getBranch()));
+ builder.mainBranch(branch == null || component.equals(UNKNOWN_COMPONENT) || !branch.equals(component.getBranch()));
}
}
"Portfolios are not supported. If this parameter is set, 'projects' must not be set.");
}
+ //SONAR-10217
+ @Test
+ public void empty_search_with_unknown_branch() throws Exception {
+ TestResponse result = ws.newRequest()
+ .setParam("onComponentOnly", "true")
+ .setParam("componentKeys", "foo")
+ .setParam("branch", "bar")
+ .execute();
+
+ assertThat(result).isNotNull();
+ result.assertJson(this.getClass(), "empty_result.json");
+ }
+
@Test
public void empty_search() throws Exception {
TestResponse result = ws.newRequest()