@Immutable
public class DeleteRequest {
- private final String id;
private final String key;
private DeleteRequest(Builder builder) {
- this.id = builder.id;
this.key = builder.key;
}
return key;
}
- @CheckForNull
- public String getId() {
- return id;
- }
-
public static Builder builder() {
return new Builder();
}
private Builder() {
}
- public Builder setId(@Nullable String id) {
- this.id = id;
- return this;
- }
-
public Builder setKey(@Nullable String key) {
this.key = key;
return this;
*/
public void delete(DeleteRequest request) {
call(new PostRequest(path("delete"))
- .setParam("id", request.getId())
- .setParam("key", request.getKey()));
+ .setParam("project", request.getKey()));
}
public void bulkDelete(BulkDeleteRequest request) {
}
@Test
- public void deletes_project_by_id() {
- underTest.delete(DeleteRequest.builder().setId("abc").build());
+ public void delete() {
+ underTest.delete(DeleteRequest.builder().setKey("P1").build());
assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/delete");
- assertThat(serviceTester.getPostRequest().getParams()).containsOnly(entry("id", "abc"));
- }
-
- @Test
- public void deletes_project_by_key() {
- underTest.delete(DeleteRequest.builder().setKey("project_key").build());
-
- assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/delete");
- assertThat(serviceTester.getPostRequest().getParams()).containsOnly(entry("key", "project_key"));
+ assertThat(serviceTester.getPostRequest().getParams()).containsOnly(entry("project", "P1"));
}
@Test