add BoardPrototypeBuilder
This commit is contained in:
parent
fda9488120
commit
9ea7914e91
@ -3,22 +3,98 @@ package wekan.wrapper.entity;
|
||||
public class BoardPrototype {
|
||||
private String title;
|
||||
private String owner;
|
||||
private boolean isAdmin = true;
|
||||
private boolean isActive = true;
|
||||
private boolean isNoComments = false;
|
||||
private boolean isCommentOnly = false;
|
||||
private Permission permission = Permission.PRIVATE;
|
||||
private Color color = Color.BELIZE;
|
||||
private boolean isAdmin;
|
||||
private boolean isActive;
|
||||
private boolean isNoComments;
|
||||
private boolean isCommentOnly;
|
||||
private Permission permission;
|
||||
private Color color;
|
||||
|
||||
public BoardPrototype(String title, String owner) {
|
||||
private BoardPrototype(
|
||||
String title,
|
||||
String owner,
|
||||
boolean isAdmin,
|
||||
boolean isActive,
|
||||
boolean isNoComments,
|
||||
boolean isCommentOnly,
|
||||
Permission permission,
|
||||
Color color
|
||||
) {
|
||||
this.title = title;
|
||||
this.owner = owner;
|
||||
this.isAdmin = isAdmin;
|
||||
this.isActive = isActive;
|
||||
this.isNoComments = isNoComments;
|
||||
this.isCommentOnly = isCommentOnly;
|
||||
this.permission = permission;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public BoardPrototype(String title, String owner, Color color) {
|
||||
this.title = title;
|
||||
this.owner = owner;
|
||||
this.color = color;
|
||||
public static class Builder {
|
||||
private String title;
|
||||
private String owner;
|
||||
private boolean isAdmin = true;
|
||||
private boolean isActive = true;
|
||||
private boolean isNoComments = false;
|
||||
private boolean isCommentOnly = false;
|
||||
private Permission permission = Permission.PRIVATE;
|
||||
private Color color = Color.BELIZE;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public BoardPrototype build() {
|
||||
return new BoardPrototype(
|
||||
title,
|
||||
owner,
|
||||
isAdmin,
|
||||
isActive,
|
||||
isNoComments,
|
||||
isCommentOnly,
|
||||
permission,
|
||||
color
|
||||
);
|
||||
}
|
||||
|
||||
public Builder setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setOwner(String owner) {
|
||||
this.owner = owner;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAdmin(boolean admin) {
|
||||
isAdmin = admin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setActive(boolean active) {
|
||||
isActive = active;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNoComments(boolean noComments) {
|
||||
isNoComments = noComments;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCommentOnly(boolean commentOnly) {
|
||||
isCommentOnly = commentOnly;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPermission(Permission permission) {
|
||||
this.permission = permission;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setColor(Color color) {
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,12 @@ public class BoardServiceTest {
|
||||
mockWebServer.enqueue(response);
|
||||
|
||||
try {
|
||||
Board board = service.newBoard(new BoardPrototype("title", "owner"))
|
||||
Board board = service.newBoard(
|
||||
new BoardPrototype.Builder()
|
||||
.setTitle("title")
|
||||
.setOwner("owner")
|
||||
.build()
|
||||
)
|
||||
.execute().body();
|
||||
|
||||
assertNotNull(board);
|
||||
@ -99,25 +104,25 @@ public class BoardServiceTest {
|
||||
MockResponse response = new MockResponse()
|
||||
.setResponseCode(HttpURLConnection.HTTP_OK)
|
||||
.setBody(
|
||||
"{" +
|
||||
"\"_id\":\"id\"," +
|
||||
"\"title\":\"my title\"," +
|
||||
"\"members\":[{\"userId\":\"Si69gNgkJfQuk6uiJ\",\"isAdmin\":true,\"isActive\":true,\"isNoComments\":false,\"isCommentOnly\":false}]," +
|
||||
"\"permission\":\"private\"," +
|
||||
"\"color\":\"corteza\"," +
|
||||
"\"slug\":\"my-title\"," +
|
||||
"\"archived\":false," +
|
||||
"\"createdAt\":\"2019-11-09T10:01:21.280Z\"," +
|
||||
"\"modifiedAt\":\"2019-11-09T10:01:21.280Z\"," +
|
||||
"\"stars\":0," +
|
||||
"\"labels\":[{\"color\":\"green\",\"_id\":\"3NvZnG\",\"name\":\"\"},{\"color\":\"yellow\",\"_id\":\"AcBqR9\",\"name\":\"\"},{\"color\":\"orange\",\"_id\":\"JxEw9Z\",\"name\":\"\"},{\"color\":\"red\",\"_id\":\"grdRCS\",\"name\":\"\"},{\"color\":\"purple\",\"_id\":\"buMfKA\",\"name\":\"\"},{\"color\":\"blue\",\"_id\":\"sbi9FZ\",\"name\":\"\"}]," +
|
||||
"\"subtasksDefaultBoardId\":null," +
|
||||
"\"subtasksDefaultListId\":null," +
|
||||
"\"allowsSubtasks\":true," +
|
||||
"\"presentParentTask\":\"no-parent\"," +
|
||||
"\"isOvertime\":false," +
|
||||
"\"type\":\"board\"" +
|
||||
"}"
|
||||
"{" +
|
||||
"\"_id\":\"id\"," +
|
||||
"\"title\":\"my title\"," +
|
||||
"\"members\":[{\"userId\":\"Si69gNgkJfQuk6uiJ\",\"isAdmin\":true,\"isActive\":true,\"isNoComments\":false,\"isCommentOnly\":false}]," +
|
||||
"\"permission\":\"private\"," +
|
||||
"\"color\":\"corteza\"," +
|
||||
"\"slug\":\"my-title\"," +
|
||||
"\"archived\":false," +
|
||||
"\"createdAt\":\"2019-11-09T10:01:21.280Z\"," +
|
||||
"\"modifiedAt\":\"2019-11-09T10:01:21.280Z\"," +
|
||||
"\"stars\":0," +
|
||||
"\"labels\":[{\"color\":\"green\",\"_id\":\"3NvZnG\",\"name\":\"\"},{\"color\":\"yellow\",\"_id\":\"AcBqR9\",\"name\":\"\"},{\"color\":\"orange\",\"_id\":\"JxEw9Z\",\"name\":\"\"},{\"color\":\"red\",\"_id\":\"grdRCS\",\"name\":\"\"},{\"color\":\"purple\",\"_id\":\"buMfKA\",\"name\":\"\"},{\"color\":\"blue\",\"_id\":\"sbi9FZ\",\"name\":\"\"}]," +
|
||||
"\"subtasksDefaultBoardId\":null," +
|
||||
"\"subtasksDefaultListId\":null," +
|
||||
"\"allowsSubtasks\":true," +
|
||||
"\"presentParentTask\":\"no-parent\"," +
|
||||
"\"isOvertime\":false," +
|
||||
"\"type\":\"board\"" +
|
||||
"}"
|
||||
);
|
||||
|
||||
mockWebServer.enqueue(response);
|
||||
|
Loading…
Reference in New Issue
Block a user