From fb0afc90685a59cd7ad3c2cf2c62d26aceb3dfd0 Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Sat, 1 Jul 2023 16:07:01 -0600 Subject: [PATCH] Use an import to simplify reading the test --- .../plugins/git/GitSCMFileSystemTest.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/test/java/jenkins/plugins/git/GitSCMFileSystemTest.java b/src/test/java/jenkins/plugins/git/GitSCMFileSystemTest.java index 011f42e583..6873c90ee6 100644 --- a/src/test/java/jenkins/plugins/git/GitSCMFileSystemTest.java +++ b/src/test/java/jenkins/plugins/git/GitSCMFileSystemTest.java @@ -72,6 +72,8 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertTrue; +import jenkins.plugins.git.GitSCMFileSystem.BuilderImpl.HeadNameResult; + /** * Tests for {@link AbstractGitSCMSource} */ @@ -475,33 +477,27 @@ public void filesystem_supports_descriptor() throws Exception { @Test public void calculate_head_name_with_env() throws Exception { String remote = "origin"; - GitSCMFileSystem.BuilderImpl.HeadNameResult result1 = GitSCMFileSystem.BuilderImpl.HeadNameResult.calculate(new BranchSpec("${BRANCH}"), null, null, - new EnvVars("BRANCH", "master-a"), remote); + HeadNameResult result1 = HeadNameResult.calculate(new BranchSpec("${BRANCH}"), null, null, new EnvVars("BRANCH", "master-a"), remote); assertEquals("master-a", result1.headName); assertTrue(result1.refspec.startsWith("+" + Constants.R_HEADS)); - GitSCMFileSystem.BuilderImpl.HeadNameResult result2 = GitSCMFileSystem.BuilderImpl.HeadNameResult.calculate(new BranchSpec("${BRANCH}"), null, null, - new EnvVars("BRANCH", "refs/heads/master-b"), remote); + HeadNameResult result2 = HeadNameResult.calculate(new BranchSpec("${BRANCH}"), null, null, new EnvVars("BRANCH", "refs/heads/master-b"), remote); assertEquals("master-b", result2.headName); assertTrue(result2.refspec.startsWith("+" + Constants.R_HEADS)); - GitSCMFileSystem.BuilderImpl.HeadNameResult result3 = GitSCMFileSystem.BuilderImpl.HeadNameResult.calculate(new BranchSpec("refs/heads/${BRANCH}"), null,null, - new EnvVars("BRANCH", "master-c"), remote); + HeadNameResult result3 = HeadNameResult.calculate(new BranchSpec("refs/heads/${BRANCH}"), null, null, new EnvVars("BRANCH", "master-c"), remote); assertEquals("master-c", result3.headName); assertTrue(result3.refspec.startsWith("+" + Constants.R_HEADS)); - GitSCMFileSystem.BuilderImpl.HeadNameResult result4 = GitSCMFileSystem.BuilderImpl.HeadNameResult.calculate(new BranchSpec("${BRANCH}"), null, null, - null, remote); + HeadNameResult result4 = HeadNameResult.calculate(new BranchSpec("${BRANCH}"), null, null, null, remote); assertEquals("${BRANCH}", result4.headName); assertTrue(result4.refspec.startsWith("+" + Constants.R_HEADS)); - GitSCMFileSystem.BuilderImpl.HeadNameResult result5 = GitSCMFileSystem.BuilderImpl.HeadNameResult.calculate(new BranchSpec("*/${BRANCH}"), null, null, - new EnvVars("BRANCH", "master-d"), remote); + HeadNameResult result5 = HeadNameResult.calculate(new BranchSpec("*/${BRANCH}"), null, null, new EnvVars("BRANCH", "master-d"), remote); assertEquals("master-d", result5.headName); assertTrue(result5.refspec.startsWith("+" + Constants.R_HEADS)); - GitSCMFileSystem.BuilderImpl.HeadNameResult result6 = GitSCMFileSystem.BuilderImpl.HeadNameResult.calculate(new BranchSpec("*/master-e"), null, null, - new EnvVars("BRANCH", "dummy"), remote); + HeadNameResult result6 = HeadNameResult.calculate(new BranchSpec("*/master-e"), null, null, new EnvVars("BRANCH", "dummy"), remote); assertEquals("master-e", result6.headName); assertTrue(result6.refspec.startsWith("+" + Constants.R_HEADS)); }