aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/test/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-12-19 16:36:16 +0300
committerGravatar Vitaly Takmazov2017-12-19 16:36:16 +0300
commit5812cbafc57658120b0d2370342efe897d39661f (patch)
tree620213f74d0442abca5601c06d77c23568286a6d /juick-server-jdbc/src/test/java/com/juick
parentedfb4c9c20bccfcf0cf87124f3946b5e24300a11 (diff)
do not delete last email
Diffstat (limited to 'juick-server-jdbc/src/test/java/com/juick')
-rw-r--r--juick-server-jdbc/src/test/java/com/juick/service/MessageServiceTest.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/juick-server-jdbc/src/test/java/com/juick/service/MessageServiceTest.java b/juick-server-jdbc/src/test/java/com/juick/service/MessageServiceTest.java
index d9b0f1c3..0f6f7c7a 100644
--- a/juick-server-jdbc/src/test/java/com/juick/service/MessageServiceTest.java
+++ b/juick-server-jdbc/src/test/java/com/juick/service/MessageServiceTest.java
@@ -62,6 +62,8 @@ public class MessageServiceTest extends AbstractJUnit4SpringContextTests {
private CrosspostService crosspostService;
@Inject
private PMQueriesService pmQueriesService;
+ @Inject
+ private EmailService emailService;
static int ugnichId, freefdId, mid;
@@ -172,10 +174,18 @@ public class MessageServiceTest extends AbstractJUnit4SpringContextTests {
}
@Test
public void lastJidShouldNotBeDeleted() {
- int ugnich_id = userService.createUser("hugnich", "x");
+ int ugnich_id = userService.createUser("hugnich2", "x");
jdbcTemplate.update("INSERT INTO jids(user_id,jid,active) VALUES(?,?,?)", ugnich_id, "firstjid@localhost", 1);
jdbcTemplate.update("INSERT INTO jids(user_id,jid,active) VALUES(?,?,?)", ugnich_id, "secondjid@localhost", 1);
assertThat(userService.deleteJID(ugnich_id, "secondjid@localhost"), equalTo(true));
assertThat(userService.deleteJID(ugnich_id, "firstjid@localhost"), equalTo(false));
}
+ @Test
+ public void lastEmailShouldNotBeDeleted() {
+ int ugnich_id = userService.createUser("hugnich3", "x");
+ jdbcTemplate.update("INSERT INTO emails(user_id,email) VALUES(?,?)", ugnich_id, "first@localhost");
+ jdbcTemplate.update("INSERT INTO emails(user_id,email) VALUES(?,?)", ugnich_id, "second@localhost");
+ assertThat(emailService.deleteEmail(ugnich_id, "second@localhost"), equalTo(true));
+ assertThat(emailService.deleteEmail(ugnich_id, "first@localhost"), equalTo(false));
+ }
}