PropertyExists extends SingleCondition<PropertyExists> { public PropertyExists() { } PropertyExists();  PropertyExists(String propertyName); PropertyExists setPropertyName(String propertyName); PropertyExists setPropertyNameRegex(String propertyNameRegex); String getPropertyName(); String getPropertyNameRegex(); @Override String getDescription();  }
@Test public void propertyExistsTest() { PropertyExists propertyExists; TUExecutionResult executionResult; propertyExists = new PropertyExists("foo").relative("/src/main/resources/application.properties"); executionResult = propertyExists.execution(transformedAppFolder, transformationContext); Assert.assertEquals(executionResult.getType(), TUExecutionResult.Type.VALUE); Assert.assertTrue((Boolean) executionResult.getValue()); Assert.assertEquals(propertyExists.getPropertyName(), "foo"); Assert.assertNull(propertyExists.getPropertyNameRegex()); Assert.assertEquals(propertyExists.getDescription(), "Check if property 'foo' exists in a property file"); propertyExists = new PropertyExists().setPropertyNameRegex(".oo").relative("/src/main/resources/application.properties"); executionResult = propertyExists.execution(transformedAppFolder, transformationContext); Assert.assertEquals(executionResult.getType(), TUExecutionResult.Type.VALUE); Assert.assertTrue((Boolean) executionResult.getValue()); Assert.assertNull(propertyExists.getPropertyName()); Assert.assertEquals(propertyExists.getPropertyNameRegex(), ".oo"); Assert.assertEquals(propertyExists.getDescription(), "Check if property '.oo' exists in a property file"); }