Skip to content

Commit 6288a5b

Browse files
Improve assertions in AcceptFirstConnectionVerifierTest for clarity and accuracy
1 parent c2c0918 commit 6288a5b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/test/java/org/jenkinsci/plugins/gitclient/verifier/AcceptFirstConnectionVerifierTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
import static org.hamcrest.MatcherAssert.assertThat;
44
import static org.hamcrest.Matchers.containsString;
5+
import static org.hamcrest.Matchers.greaterThan;
56
import static org.hamcrest.Matchers.hasItem;
67
import static org.hamcrest.Matchers.is;
8+
import static org.hamcrest.Matchers.not;
9+
import static org.hamcrest.Matchers.startsWith;
710
import static org.hamcrest.io.FileMatchers.anExistingFile;
811
import static org.jenkinsci.plugins.gitclient.verifier.KnownHostsTestUtil.runKnownHostsTests;
912
import static org.junit.jupiter.api.Assumptions.assumeTrue;
@@ -161,11 +164,11 @@ void testNewEntriesAreNotHashed() throws Exception {
161164

162165
// The key insight: entries should be in plain format like "github.com,140.82.121.4 ssh-ed25519 ..."
163166
// NOT hashed like "|1|hash|hash ssh-ed25519 ..."
164-
assertThat("At least one entry should be created", nonEmptyLines.size() >= 1, is(true));
167+
assertThat("At least one entry should be created", nonEmptyLines.size(), is(greaterThan(0)));
165168

166169
// Verify ALL entries are NOT hashed (no |1| prefix indicating hashed hostname)
167170
for (String entry : nonEmptyLines) {
168-
assertThat("Entry should not start with |1| (hashed format): " + entry, entry.startsWith("|1|"), is(false));
171+
assertThat("Entry should not start with |1| (hashed format): " + entry, entry, not(startsWith("|1|")));
169172

170173
// Verify it contains the key type
171174
assertThat("Entry should contain key type: " + entry, entry, containsString("ssh-ed25519"));

0 commit comments

Comments
 (0)