add BoardPrototypeBuilder
This commit is contained in:
parent
fda9488120
commit
9ea7914e91
@ -1,6 +1,36 @@
|
|||||||
package wekan.wrapper.entity;
|
package wekan.wrapper.entity;
|
||||||
|
|
||||||
public class BoardPrototype {
|
public class BoardPrototype {
|
||||||
|
private String title;
|
||||||
|
private String owner;
|
||||||
|
private boolean isAdmin;
|
||||||
|
private boolean isActive;
|
||||||
|
private boolean isNoComments;
|
||||||
|
private boolean isCommentOnly;
|
||||||
|
private Permission permission;
|
||||||
|
private Color color;
|
||||||
|
|
||||||
|
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 static class Builder {
|
||||||
private String title;
|
private String title;
|
||||||
private String owner;
|
private String owner;
|
||||||
private boolean isAdmin = true;
|
private boolean isAdmin = true;
|
||||||
@ -10,15 +40,61 @@ public class BoardPrototype {
|
|||||||
private Permission permission = Permission.PRIVATE;
|
private Permission permission = Permission.PRIVATE;
|
||||||
private Color color = Color.BELIZE;
|
private Color color = Color.BELIZE;
|
||||||
|
|
||||||
public BoardPrototype(String title, String owner) {
|
public Builder() {
|
||||||
this.title = title;
|
|
||||||
this.owner = owner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoardPrototype(String title, String owner, Color color) {
|
public BoardPrototype build() {
|
||||||
|
return new BoardPrototype(
|
||||||
|
title,
|
||||||
|
owner,
|
||||||
|
isAdmin,
|
||||||
|
isActive,
|
||||||
|
isNoComments,
|
||||||
|
isCommentOnly,
|
||||||
|
permission,
|
||||||
|
color
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setOwner(String owner) {
|
||||||
this.owner = 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;
|
this.color = color;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,12 @@ public class BoardServiceTest {
|
|||||||
mockWebServer.enqueue(response);
|
mockWebServer.enqueue(response);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Board board = service.newBoard(new BoardPrototype("title", "owner"))
|
Board board = service.newBoard(
|
||||||
|
new BoardPrototype.Builder()
|
||||||
|
.setTitle("title")
|
||||||
|
.setOwner("owner")
|
||||||
|
.build()
|
||||||
|
)
|
||||||
.execute().body();
|
.execute().body();
|
||||||
|
|
||||||
assertNotNull(board);
|
assertNotNull(board);
|
||||||
|
Loading…
Reference in New Issue
Block a user