RESOLVED - BATCH-938: Clean up DelimitedLineAggregator implementation

applied patch
This commit is contained in:
robokaso
2008-11-24 09:20:22 +00:00
parent fb9b662160
commit 0bcf2e092c
7 changed files with 68 additions and 145 deletions

View File

@@ -1,55 +0,0 @@
/*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.item.file.transform;
import static junit.framework.Assert.assertEquals;
import org.junit.Test;
/**
* @author Dan Garrette
* @since 2.0
*/
public class BeanDelimitingLineAggregatorTests {
private BeanDelimitingLineAggregator<Object> aggregator = new BeanDelimitingLineAggregator<Object>();
@Test
public void testAggregate() throws Exception {
aggregator.setNames(new String[] { "first", "last", "born" });
aggregator.afterPropertiesSet();
String first = "Alan";
String last = "Turing";
int born = 1912;
Name n = new Name(first, last, born);
String value = aggregator.aggregate(n);
assertEquals("Alan,Turing,1912", value);
}
@Test(expected = IllegalArgumentException.class)
public void testNamesMustBeSet() throws Exception {
aggregator.afterPropertiesSet();
}
@Test(expected = IllegalArgumentException.class)
public void testNamesMustNotBeNull() throws Exception {
aggregator.setNames(null);
}
}

View File

@@ -25,7 +25,7 @@ import org.junit.Test;
*/
public class DelimitedLineAggregatorTests {
private DelimitedLineAggregator<String> aggregator = new DelimitedLineAggregator<String>();
private DelimitedLineAggregator<String[]> aggregator = new DelimitedLineAggregator<String[]>();
@Test
public void testSetDelimiter() {