### Question:
KieContainerResourceFilter { public String toURLQueryString() { StringJoiner joiner = new StringJoiner("&"); if (releaseIdFilter.getGroupId() != null) { joiner.add("groupId=" + releaseIdFilter.getGroupId()); } if (releaseIdFilter.getArtifactId() != null) { joiner.add("artifactId=" + releaseIdFilter.getArtifactId()); } if (releaseIdFilter.getVersion() != null) { joiner.add("version=" + releaseIdFilter.getVersion()); } if (!statusFilter.equals(KieContainerStatusFilter.ACCEPT_ALL)) { String status = statusFilter.getAcceptedStatuses() .stream() .map(s -> s.toString()) .collect(Collectors.joining(",")); joiner.add("status=" + status); } return joiner.toString(); } private  KieContainerResourceFilter();  KieContainerResourceFilter(ReleaseIdFilter releaseIdFilter, KieContainerStatusFilter statusFilter);  KieContainerResourceFilter(ReleaseIdFilter releaseIdFilter); ReleaseIdFilter getReleaseIdFilter(); KieContainerStatusFilter getStatusFilter(); boolean accept(KieContainerResource kieContainerResource); String toURLQueryString(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static final KieContainerResourceFilter ACCEPT_ALL; }### Answer:
@Test public void toURLQueryStringGroupIdOnly() { KieContainerResourceFilter filter = new KieContainerResourceFilter.Builder() .releaseId(new ReleaseId(GROUP_ID, null, null)).build(); Assertions.assertThat(filter.toURLQueryString()).isEqualTo("groupId=" + GROUP_ID); }
@Test public void toURLQueryStringArtifactIdOnly() { KieContainerResourceFilter filter = new KieContainerResourceFilter.Builder() .releaseId(new ReleaseId(null, ARTIFACT_ID, null)).build(); Assertions.assertThat(filter.toURLQueryString()).isEqualTo("artifactId=" + ARTIFACT_ID); }
@Test public void toURLQueryStringVersionOnly() { KieContainerResourceFilter filter = new KieContainerResourceFilter.Builder() .releaseId(new ReleaseId(null, null, VERSION)).build(); Assertions.assertThat(filter.toURLQueryString()).isEqualTo("version=" + VERSION); }
@Test public void toURLQueryStringReleaseIdOnly() { KieContainerResourceFilter filter = new KieContainerResourceFilter.Builder().releaseId(RELEASE_ID).build(); Assertions.assertThat(filter.toURLQueryString()) .isEqualTo("groupId=" + GROUP_ID + "&artifactId=" + ARTIFACT_ID + "&version=" + VERSION); }
@Test public void toURLQueryStringSingleStatus() { KieContainerResourceFilter filter = new KieContainerResourceFilter.Builder().status(KieContainerStatus.STARTED).build(); Assertions.assertThat(filter.toURLQueryString()).isEqualTo("status=STARTED"); }
@Test public void toURLQueryStringMultipleStatuses() { KieContainerResourceFilter filter = new KieContainerResourceFilter.Builder() .statuses(KieContainerStatus.CREATING, KieContainerStatus.STARTED, KieContainerStatus.FAILED) .build(); Assertions.assertThat(filter.toURLQueryString()).isEqualTo("status=CREATING,STARTED,FAILED"); }
@Test public void toURLQueryStringReleaseIdWithStatus() { KieContainerResourceFilter filter = new KieContainerResourceFilter.Builder() .releaseId(RELEASE_ID) .status(KieContainerStatus.STARTED) .build(); Assertions.assertThat(filter.toURLQueryString()) .isEqualTo("groupId=" + GROUP_ID + "&artifactId=" + ARTIFACT_ID + "&version=" + VERSION + "&status=STARTED"); }