[Notice] Announcing the End of Demo Server [Read me]
--- test/controllers/UserAppTest.java
+++ test/controllers/UserAppTest.java
... | ... | @@ -38,7 +38,7 @@ |
38 | 38 |
|
39 | 39 |
//Then |
40 | 40 |
assertThat(status(result)).isEqualTo(OK); |
41 |
- assertThat(contentAsString(result)).contains("{\"isExist\":\"false\"}"); |
|
41 |
+ assertThat(contentAsString(result)).contains("{\"isExist\":false}"); |
|
42 | 42 |
} |
43 | 43 |
}); |
44 | 44 |
} |
... | ... | @@ -59,7 +59,24 @@ |
59 | 59 |
|
60 | 60 |
//Then |
61 | 61 |
assertThat(status(result)).isEqualTo(OK); |
62 |
- assertThat(contentAsString(result)).contains("{\"isExist\":\"true\"}"); |
|
62 |
+ assertThat(contentAsString(result)).contains("{\"isExist\":true}"); |
|
63 |
+ } |
|
64 |
+ }); |
|
65 |
+ } |
|
66 |
+ |
|
67 |
+ @Test |
|
68 |
+ public void isEmailExist() { |
|
69 |
+ running(fakeApplication(), new Runnable() { |
|
70 |
+ public void run() { |
|
71 |
+ //Given |
|
72 |
+ //When |
|
73 |
+ Result result = callAction( |
|
74 |
+ controllers.routes.ref.UserApp.isEmailExist("doortts@gmail.com") |
|
75 |
+ ); |
|
76 |
+ |
|
77 |
+ //Then |
|
78 |
+ assertThat(status(result)).isEqualTo(OK); |
|
79 |
+ assertThat(contentAsString(result)).contains("{\"isExist\":true}"); |
|
63 | 80 |
} |
64 | 81 |
}); |
65 | 82 |
} |
--- test/models/UserTest.java
+++ test/models/UserTest.java
... | ... | @@ -101,4 +101,23 @@ |
101 | 101 |
assertThat(result2).isEqualTo(false); |
102 | 102 |
assertThat(result3).isEqualTo(false); |
103 | 103 |
} |
104 |
+ |
|
105 |
+ @Test |
|
106 |
+ public void isEmailExist() throws Exception { |
|
107 |
+ // Given |
|
108 |
+ String expectedUser = "doortts@gmail.com"; |
|
109 |
+ |
|
110 |
+ // When // Then |
|
111 |
+ assertThat(User.isEmailExist(expectedUser)).isTrue(); |
|
112 |
+ } |
|
113 |
+ |
|
114 |
+ @Test |
|
115 |
+ public void isEmailExist_nonExist() throws Exception { |
|
116 |
+ // Given |
|
117 |
+ String expectedEmail = "nekure@gmail.com"; |
|
118 |
+ |
|
119 |
+ // When // Then |
|
120 |
+ assertThat(User.isEmailExist(expectedEmail)).isFalse(); |
|
121 |
+ } |
|
122 |
+ |
|
104 | 123 |
} |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?