Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/main/java/com/booleanuk/core/TodoItem.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.booleanuk.core;

public class TodoItem {
public String title;
public String detail;
public String status;
private String title;
private String detail;
private String status;

public TodoItem(String title, String detail, String status) {
this.title = title;
Expand All @@ -12,10 +12,27 @@ public TodoItem(String title, String detail, String status) {
}

public void setStatus(String status) {
this.status = status;
if(status.equals("complete")) this.status = status;
else if(status.equals("incomplete")) this.status = status;
}

public String getStatus() {
return this.status;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public String getDetail() {
return detail;
}

public void setDetail(String detail) {
this.detail = detail;
}
}
39 changes: 39 additions & 0 deletions src/test/java/com/booleanuk/core/TodoItemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,43 @@

class TodoItemTest {

@Test
public void GetTitleTest() {
TodoItem todoList = new TodoItem("laundry", "wash dark clothes", "incomplete");
Assertions.assertEquals("laundry", todoList.getTitle());
}

@Test
public void SetTitleTest() {
TodoItem todoList = new TodoItem("laundry", "wash dark clothes", "incomplete");
todoList.setTitle("drawing");
Assertions.assertEquals("drawing", todoList.getTitle());
}

@Test
public void GetDetailTest() {
TodoItem todoList = new TodoItem("laundry", "wash dark clothes", "incomplete");
Assertions.assertEquals("wash dark clothes", todoList.getDetail());
}

@Test
public void SetDetailTest() {
TodoItem todoList = new TodoItem("laundry", "wash dark clothes", "incomplete");
todoList.setDetail("wash white clothes");
Assertions.assertEquals("wash white clothes", todoList.getDetail());
}

@Test
public void GetStatusTest() {
TodoItem todoList = new TodoItem("laundry", "wash dark clothes", "incomplete");
Assertions.assertEquals("incomplete", todoList.getStatus());
}

@Test
public void SetStatusTest() {
TodoItem todoList = new TodoItem("laundry", "wash dark clothes", "incomplete");
todoList.setStatus("complete");
Assertions.assertEquals("complete", todoList.getStatus());
}

}
Loading