Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Commit 556f8c2

Browse files
authored
Using groovy for test
1 parent edeac70 commit 556f8c2

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed
Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
import static org.junit.Assert.*
2-
import org.junit.Test
1+
package com.genexus
2+
3+
import com.genexus.FileHelper
34

45
class FileHelperTest {
5-
@Test
6-
void testStandardizeVersionForSemVer() {
7-
FileHelper fileHelper = new FileHelper()
86

9-
// Test case 1: Standard version without label
10-
String result1 = fileHelper.standarizeVersionForSemVer("1.3.5", "88", "")
11-
assertEquals("1.3.88", result1)
7+
static void main(String[] args) {
8+
def instance = new FileHelper() // Create an instance of your class
9+
10+
// Define test cases
11+
def tests = [
12+
['1.3.5', '88', '', 0, '1.3.88'],
13+
['2.1.5', '457', 'beta', 0, '2.1.0-beta.457'],
14+
['1.3.5', '88', '', 100, '101.3.88']
15+
]
1216

13-
// Test case 2: Version with 'beta' label
14-
String result2 = fileHelper.standarizeVersionForSemVer("2.1.5", "457", "beta")
15-
assertEquals("2.1.0-beta.457", result2)
17+
// Run tests
18+
tests.each { testCase ->
19+
String version = instance.standarizeVersionForSemVer(testCase[0], testCase[1], testCase[2], testCase[3])
20+
assert version == testCase[4] : "Expected ${testCase[4]}, but got ${version}"
21+
}
1622

17-
// Test case 3: Increase major version by 100 without label
18-
String result3 = fileHelper.standarizeVersionForSemVer("1.3.5", "88", "", 100)
19-
assertEquals("101.3.88", result3)
23+
println "All tests passed!"
2024
}
2125
}

0 commit comments

Comments
 (0)