Skip to content

Commit

Permalink
Add a test for 403 error
Browse files Browse the repository at this point in the history
  • Loading branch information
pnatashap committed Feb 5, 2024
1 parent 6035677 commit 6363b89
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/test/java/org/takes/facets/auth/TkSecureTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.takes.facets.auth;

import java.net.HttpURLConnection;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assertions;
Expand All @@ -43,10 +44,14 @@ final class TkSecureTest {
@Test
void failsOnAnonymous() {
final Take secure = new TkSecure(request -> new RsEmpty());
Assertions.assertThrows(
final RsForward exception = Assertions.assertThrows(
RsForward.class,
() -> secure.act(new RqFake())
);
Assertions.assertEquals(
exception.code(),
HttpURLConnection.HTTP_UNAUTHORIZED
);
}

@Test
Expand Down

0 comments on commit 6363b89

Please sign in to comment.