Skip to content

Commit 62a9da3

Browse files
committed
Add failing tests for unresolvable properties
This relates to #1916
1 parent 27eae6a commit 62a9da3

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

org.eclipse.m2e.jdt.tests/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Require-Bundle: org.eclipse.core.runtime,
1212
org.eclipse.m2e.core,
1313
org.eclipse.m2e.core.ui,
1414
org.eclipse.jdt.launching,
15+
org.eclipse.jdt.junit,
1516
org.eclipse.debug.core,
1617
org.eclipse.ui.tests.harness,
1718
org.eclipse.ui,

org.eclipse.m2e.jdt.tests/src/org/eclipse/m2e/jdt/tests/UnitTestLaunchConfigConfigurationTest.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import static org.hamcrest.MatcherAssert.assertThat;
1414
import static org.junit.Assert.assertEquals;
15+
import static org.junit.Assert.assertFalse;
1516
import static org.junit.Assert.assertNotNull;
1617
import static org.junit.Assert.assertTrue;
1718
import static org.junit.Assume.assumeTrue;
@@ -150,7 +151,8 @@ public void test_configuration_must_be_updated_with_surefire_config()
150151

151152
// check argLine
152153
String argLine = config.getAttribute(UnitTestSupport.LAUNCH_CONFIG_VM_ARGUMENTS, "");
153-
assertTrue(argLine.contains("--argLineItem=surefireArgLineValue"));
154+
assertThat(argLine, Matchers.containsString("--argLineItem=surefireArgLineValue --undefinedArgLineItem="));
155+
assertThat(argLine, Matchers.not(Matchers.containsString("${undefinedProperty}")));
154156

155157
// check environmentVariables
156158
Map<String, String> envVars = config.getAttribute(UnitTestSupport.LAUNCH_CONFIG_ENVIRONMENT_VARIABLES,
@@ -209,7 +211,8 @@ public void test_configuration_must_be_updated_with_failsafe_config()
209211

210212
// check argLine
211213
String argLine = config.getAttribute(UnitTestSupport.LAUNCH_CONFIG_VM_ARGUMENTS, "");
212-
assertTrue(argLine.contains("--argLineItem=failsafeArgLineValue"));
214+
assertThat(argLine, Matchers.containsString("--argLineItem=failsafeArgLineValue --undefinedArgLineItem="));
215+
assertThat(argLine, Matchers.not(Matchers.containsString("${undefinedProperty}")));
213216

214217
// check environmentVariables
215218
Map<String, String> envVars = config.getAttribute(UnitTestSupport.LAUNCH_CONFIG_ENVIRONMENT_VARIABLES,
@@ -261,7 +264,8 @@ public void test_configuration_must_be_updated_with_surefire_config_when_created
261264

262265
// check argLine
263266
String argLine = config.getAttribute(UnitTestSupport.LAUNCH_CONFIG_VM_ARGUMENTS, "");
264-
assertTrue(argLine.contains("--argLineItem=surefireArgLineValue"));
267+
assertThat(argLine, Matchers.containsString("--argLineItem=surefireArgLineValue --undefinedArgLineItem="));
268+
assertThat(argLine, Matchers.not(Matchers.containsString("${undefinedProperty}")));
265269

266270
// check environmentVariables
267271
Map<String, String> envVars = config.getAttribute(UnitTestSupport.LAUNCH_CONFIG_ENVIRONMENT_VARIABLES,
@@ -310,7 +314,8 @@ public void test_configuration_must_be_updated_with_failSafe_config_when_created
310314

311315
// check argLine
312316
String argLine = config.getAttribute(UnitTestSupport.LAUNCH_CONFIG_VM_ARGUMENTS, "");
313-
assertTrue(argLine.contains("--argLineItem=failsafeArgLineValue"));
317+
assertThat(argLine, Matchers.containsString("--argLineItem=failsafeArgLineValue --undefinedArgLineItem="));
318+
assertThat(argLine, Matchers.not(Matchers.containsString("${undefinedProperty}")));
314319

315320
// check environmentVariables
316321
Map<String, String> envVars = config.getAttribute(UnitTestSupport.LAUNCH_CONFIG_ENVIRONMENT_VARIABLES,
@@ -355,7 +360,7 @@ public void test_deferred_variable_are_resolved() throws CoreException, IOExcept
355360
ILaunchConfiguration config = updatedConfigurations[0];
356361
String argLine = config.getAttribute(UnitTestSupport.LAUNCH_CONFIG_VM_ARGUMENTS, "");
357362
assertTrue(argLine.contains("-javaagent")); // resolved jacoco agent
358-
assertTrue(argLine.contains("@{titi.tata}")); // unresolved property is unchanged as in CLI
363+
assertFalse(argLine.contains("@{titi.tata}")); // unresolved property is removed
359364
}
360365

361366
private void updateProject(IProject project) throws CoreException, InterruptedException {

0 commit comments

Comments
 (0)