Skip to content

Commit 1b3268d

Browse files
author
Martin Plieske
committed
added Tests for filter method
1 parent 3552069 commit 1b3268d

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package de.doubleslash.keeptime.view;
2+
3+
import static org.junit.Assert.assertTrue;
4+
5+
import org.junit.Test;
6+
7+
import de.doubleslash.keeptime.model.Project;
8+
9+
public class ProjectsListViewControllerTest {
10+
11+
@Test
12+
public void shouldMatchWhenSearchTermIsInDescription() {
13+
final Project project = new Project();
14+
15+
project.setName("NotSearchTerm");
16+
project.setDescription("Searchterm_test");
17+
18+
assertTrue(ProjectsListViewController.doesProjectMatchSearchFilter("test", project));
19+
}
20+
21+
@Test
22+
public void shouldMatchWhenSearchTermIsInName() {
23+
final Project project = new Project();
24+
25+
project.setName("SearchTerm_CZ");
26+
project.setDescription("NotSearchTerm");
27+
28+
assertTrue(ProjectsListViewController.doesProjectMatchSearchFilter("CZ", project));
29+
}
30+
31+
@Test
32+
public void shouldMatchWhenSearchTermIsNameAndDescription() {
33+
final Project project = new Project();
34+
35+
project.setName("SearchTerm_Peter");
36+
project.setDescription("Peter_IsSearchTerm");
37+
38+
assertTrue(ProjectsListViewController.doesProjectMatchSearchFilter("Peter", project));
39+
}
40+
41+
@Test
42+
public void shouldMatchWhenCaseDiffersInNameAsSearchTerm() {
43+
final Project project = new Project();
44+
45+
project.setName("PeTerPAn");
46+
project.setDescription("");
47+
48+
assertTrue(ProjectsListViewController.doesProjectMatchSearchFilter("pEtErpAn", project));
49+
}
50+
51+
@Test
52+
public void shouldMatchWhenCaseDiffersInDescriptionAsSearchTerm() {
53+
final Project project = new Project();
54+
55+
project.setName("");
56+
project.setDescription("MylItTLeaNT");
57+
58+
assertTrue(ProjectsListViewController.doesProjectMatchSearchFilter("mYliTTlEAnT", project));
59+
}
60+
61+
}

0 commit comments

Comments
 (0)