From 0db32ecaa123727e8a0761c8335fa5767ec510ae Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Fri, 14 Mar 2014 14:42:51 -0700 Subject: [PATCH] Clarifying assertions that they are trying to test. --- test/src/test/java/hudson/model/UserTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/src/test/java/hudson/model/UserTest.java b/test/src/test/java/hudson/model/UserTest.java index 8e57f81b08..2e45014c7f 100644 --- a/test/src/test/java/hudson/model/UserTest.java +++ b/test/src/test/java/hudson/model/UserTest.java @@ -408,19 +408,19 @@ public class UserTest { User user = realm.createAccount("John Smith","password"); User user2 = realm.createAccount("John Smith2","password"); user2.save(); - User user3 = User.get("Random Somebody"); SecurityContextHolder.getContext().setAuthentication(user.impersonate()); - assertFalse("User should not be able delete because he does not have administer permission.", user2.canDelete()); + assertFalse("Ordinary user cannot delete somebody else", user2.canDelete()); auth.add(Jenkins.ADMINISTER, user.getId()); - assertTrue("User should be able to delete.", user2.canDelete()); - assertFalse("User should not be able to delete because it is current user.", user.canDelete()); + assertTrue("Administrator can delete anybody else", user2.canDelete()); + assertFalse("User (even admin) cannot delete himself", user.canDelete()); SecurityContextHolder.getContext().setAuthentication(user2.impersonate()); auth.add(Jenkins.ADMINISTER, user2.getId()); - assertFalse("User should not be able to delete because he is not saved.", user3.canDelete()); + User user3 = User.get("Random Somebody"); + assertFalse("Storage-less temporary user cannot be deleted", user3.canDelete()); user3.save(); - assertTrue("User should be able to delete.", user3.canDelete()); + assertTrue("But once storage is allocated, he can be deleted", user3.canDelete()); } @Test