OPEN - issue BATCH-773: Refactor and extend ExportedJobLauncher to JobOperator

Add additional methods and tests to SimpleJobOperator
This commit is contained in:
dsyer
2008-08-13 12:01:43 +00:00
parent 1f731769f8
commit 1077405691
7 changed files with 247 additions and 63 deletions

View File

@@ -18,6 +18,8 @@ package org.springframework.batch.support;
import java.util.Properties;
import org.springframework.util.StringUtils;
import junit.framework.TestCase;
/**
@@ -73,6 +75,22 @@ public class PropertiesConverterTests extends TestCase {
assertEquals(storedProps, props);
}
/**
* Check that Properties can be comma delimited with extra whitespace.
*/
public void testShortConversionWithCommas() {
Properties storedProps = new Properties();
storedProps.setProperty("key1", "value1");
storedProps.setProperty("key2", "value2");
String value = PropertiesConverter.propertiesToString(storedProps);
assertTrue("Wrong value: "+value, value.contains("key1=value1"));
assertTrue("Wrong value: "+value, value.contains("key2=value2"));
assertEquals(1, StringUtils.countOccurrencesOf(value, ","));
}
/**
* Check that Properties can be newline delimited.
*/
@@ -87,16 +105,6 @@ public class PropertiesConverterTests extends TestCase {
assertEquals(storedProps, props);
}
/**
* Converting a String to Properties and back does not return equal String!
* See {@link PropertiesConverter} javadoc for more details.
*/
public void testInvalidConversion() {
String value = "key=value";
string = PropertiesConverter.propertiesToString(PropertiesConverter.stringToProperties(value));
assertFalse(value.equals(string));
}
/**
* Null String should be converted to empty Properties
*/