Commit ddbf5a14580c745f37760dd8edbe58a7cb7bd254
1 parent
ad7c0a5e
Exists in
master
Adição de teste de erro durante consulta checkLoggedIn
Showing
1 changed file
with
15 additions
and
0 deletions
Show diff stats
impl/core/src/test/java/security/athentication/error/LoginErrorAuthenticatorTest.java
| ... | ... | @@ -49,7 +49,11 @@ import org.junit.runner.RunWith; |
| 49 | 49 | |
| 50 | 50 | import test.Tests; |
| 51 | 51 | import br.gov.frameworkdemoiselle.security.AuthenticationException; |
| 52 | +import br.gov.frameworkdemoiselle.security.NotLoggedInException; | |
| 52 | 53 | import br.gov.frameworkdemoiselle.security.SecurityContext; |
| 54 | +import br.gov.frameworkdemoiselle.util.Beans; | |
| 55 | +import br.gov.frameworkdemoiselle.util.NameQualifier; | |
| 56 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
| 53 | 57 | import configuration.resource.ConfigurationResourceTest; |
| 54 | 58 | |
| 55 | 59 | @RunWith(Arquillian.class) |
| ... | ... | @@ -76,4 +80,15 @@ public class LoginErrorAuthenticatorTest { |
| 76 | 80 | } |
| 77 | 81 | } |
| 78 | 82 | |
| 83 | + @Test | |
| 84 | + public void errorDurindCheckLoggedIn() { | |
| 85 | + try { | |
| 86 | + context.checkLoggedIn(); | |
| 87 | + fail("checkLoggedIn deveria disparar exceção de NotLoggedIn"); | |
| 88 | + } catch (NotLoggedInException cause) { | |
| 89 | + assertEquals(Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle")) | |
| 90 | + .getString("user-not-authenticated"), cause.getMessage()); | |
| 91 | + } | |
| 92 | + } | |
| 93 | + | |
| 79 | 94 | } | ... | ... |