Skip to content

Commit

Permalink
[3.x]: Use Hamcrest assertions instead of JUnit in security/providers…
Browse files Browse the repository at this point in the history
  • Loading branch information
Captain1653 authored Mar 19, 2023
1 parent 695cd6e commit 7fce9f8
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates.
* Copyright (c) 2021, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,6 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertTrue;

class CredentialPatternTest {

Expand All @@ -31,20 +30,20 @@ class CredentialPatternTest {
@Test
void testPatternNormal() {
Matcher m = pattern.matcher("user:password");
assertTrue(m.matches());
assertThat(m.matches(), is(true));
assertThat(m.group(1), is("user"));
assertThat(m.group(2), is("password"));
}

@Test
void testPatternColonInPassword() {
Matcher m = pattern.matcher("user:pass:word");
assertTrue(m.matches());
assertThat(m.matches(), is(true));
assertThat(m.group(1), is("user"));
assertThat(m.group(2), is("pass:word"));

m = pattern.matcher("user::pass:word:");
assertTrue(m.matches());
assertThat(m.matches(), is(true));
assertThat(m.group(1), is("user"));
assertThat(m.group(2), is(":pass:word:"));
}
Expand Down

0 comments on commit 7fce9f8

Please sign in to comment.