Updated for various code warnings

This commit addresses a number of deprications and other code warnings.
There are still many more to address, but this is a start.
This commit is contained in:
Michael Minella
2017-04-21 16:20:46 -05:00
parent a2a856e64b
commit 263e978a1f
128 changed files with 658 additions and 680 deletions

View File

@@ -35,9 +35,9 @@ import org.springframework.mail.SimpleMailMessage;
*/
public class TestMailSender implements MailSender {
private List<String> subjectsToFail = new ArrayList<String>();
private List<String> subjectsToFail = new ArrayList<>();
private List<SimpleMailMessage> received = new ArrayList<SimpleMailMessage>();
private List<SimpleMailMessage> received = new ArrayList<>();
public void clear() {
received.clear();
@@ -53,8 +53,8 @@ public class TestMailSender implements MailSender {
}
@Override
public void send(SimpleMailMessage[] simpleMessages) throws MailException {
Map<Object, Exception> failedMessages = new LinkedHashMap<Object, Exception>();
public void send(SimpleMailMessage... simpleMessages) throws MailException {
Map<Object, Exception> failedMessages = new LinkedHashMap<>();
for (SimpleMailMessage simpleMessage : simpleMessages) {
if (subjectsToFail.contains(simpleMessage.getSubject())) {
failedMessages.put(simpleMessage, new MessagingException());

View File

@@ -56,7 +56,7 @@ public class TradeWriter extends ItemStreamSupport implements ItemWriter<Trade>
dao.writeTrade(trade);
Assert.notNull(trade.getPrice()); // There must be a price to total
Assert.notNull(trade.getPrice(), "price must not be null"); // There must be a price to total
if (this.failingCustomers.contains(trade.getCustomer())) {
throw new WriteFailedException("Something unexpected happened!");

View File

@@ -15,12 +15,12 @@
*/
package org.springframework.batch.sample.jsr352;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.batch.api.chunk.AbstractItemReader;
import java.util.ArrayList;
import java.util.List;
import javax.batch.api.chunk.AbstractItemReader;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* <p>
@@ -30,6 +30,7 @@ import java.util.List;
* @since 3.0
* @author Chris Schaefer
*/
@SuppressWarnings("serial")
public class JsrSampleItemReader extends AbstractItemReader {
private static final Log LOG = LogFactory.getLog(JsrSampleItemReader.class);

View File

@@ -33,7 +33,7 @@ public class HeaderCopyCallback implements LineCallbackHandler, FlatFileHeaderCa
@Override
public void handleLine(String line) {
Assert.notNull(line);
Assert.notNull(line, "line must not be null");
this.header = line;
}

View File

@@ -15,12 +15,13 @@
*/
package org.springframework.batch.sample.support;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.springframework.batch.item.file.mapping.FieldSetMapper;
import org.springframework.batch.item.file.transform.FieldSet;
import static org.junit.Assert.assertEquals;
/**
* Encapsulates basic logic for testing custom {@link FieldSetMapper} implementations.
*
@@ -49,7 +50,6 @@ public abstract class AbstractFieldSetMapperTests {
/**
* Regular usage scenario.
* Assumes the domain object implements sensible <code>equals(Object other)</code>
* @throws Exception
*/
@Test
public void testRegularUse() throws Exception {