Skip to content

Commit 4ecc5ad

Browse files
qtranlaeubi
authored andcommitted
Added test
1 parent 77082fc commit 4ecc5ad

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2011 Sonatype Inc. and others.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License 2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Sonatype Inc. - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.tycho.test.product;
14+
15+
import static org.junit.Assert.assertTrue;
16+
import static org.junit.jupiter.api.Assertions.assertEquals;
17+
18+
import java.io.File;
19+
import java.nio.file.Files;
20+
import java.util.List;
21+
22+
import org.apache.maven.it.Verifier;
23+
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
24+
import org.junit.Test;
25+
26+
public class ProductProgramArgsTest extends AbstractTychoIntegrationTest {
27+
@Test
28+
public void test() throws Exception {
29+
Verifier verifier = getVerifier("/product.programArgs", true);
30+
verifier.executeGoals(List.of("clean", "verify"));
31+
verifier.verifyErrorFreeLog();
32+
33+
File basedir = new File(verifier.getBasedir());
34+
File productDir = new File(basedir, "target/products/ppa.product/win32/win32/x86");
35+
36+
assertFileExists(productDir, "eclipse.ini");
37+
38+
File initFile = new File(productDir, "eclipse.ini");
39+
40+
List<String> lines = Files.readAllLines(initFile.toPath());
41+
assertTrue(lines.indexOf("-blah1") >= 0);
42+
assertTrue(lines.indexOf("-blah2") >= 0);
43+
44+
int configurationLineIndex = lines.indexOf("-configuration");
45+
assertTrue(configurationLineIndex >= 0);
46+
assertEquals(configurationLineIndex + 1, lines.indexOf("@user.dir/configuration"));
47+
}
48+
49+
}

0 commit comments

Comments
 (0)