Using List instead of ArrayList (PMD)
This commit is contained in:
parent
c3d4eb1ab8
commit
bb23d7e79d
5 changed files with 15 additions and 10 deletions
|
@ -36,7 +36,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|||
import net.thauvin.erik.mobibot.msg.Message;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -54,12 +54,13 @@ public class GoogleSearchTest extends LocalProperties {
|
|||
}
|
||||
|
||||
@SuppressFBWarnings("LEST_LOST_EXCEPTION_STACK_TRACE")
|
||||
@SuppressWarnings("PMD.PreserveStackTrace")
|
||||
@Test
|
||||
public void testSearchGoogle() throws ModuleException {
|
||||
final String apiKey = LocalProperties.getProperty(GoogleSearch.GOOGLE_API_KEY_PROP);
|
||||
final String cseKey = LocalProperties.getProperty(GoogleSearch.GOOGLE_CSE_KEY_PROP);
|
||||
try {
|
||||
ArrayList<Message> messages = GoogleSearch.searchGoogle("mobibot site:github.com", apiKey, cseKey);
|
||||
List<Message> messages = GoogleSearch.searchGoogle("mobibot site:github.com", apiKey, cseKey);
|
||||
assertThat(messages).as("mobibot results not empty").isNotEmpty();
|
||||
assertThat(messages.get(0).getMessage()).as("found mobitopia").contains("mobibot");
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|||
import net.thauvin.erik.mobibot.msg.Message;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -50,11 +50,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
|
||||
public class StockQuoteTest extends LocalProperties {
|
||||
@SuppressFBWarnings("LEST_LOST_EXCEPTION_STACK_TRACE")
|
||||
@SuppressWarnings("PMD.PreserveStackTrace")
|
||||
@Test
|
||||
public void testGetQuote() throws ModuleException {
|
||||
final String apiKey = LocalProperties.getProperty(StockQuote.ALPHAVANTAGE_API_KEY_PROP);
|
||||
try {
|
||||
ArrayList<Message> messages = StockQuote.getQuote("AAPL", apiKey);
|
||||
List<Message> messages = StockQuote.getQuote("AAPL", apiKey);
|
||||
assertThat(messages).as("response not empty").isNotEmpty();
|
||||
assertThat(messages.get(0).getMessage()).as("same stock symbol").contains("AAPL");
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|||
import net.thauvin.erik.mobibot.msg.Message;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class Weather2Test extends LocalProperties {
|
|||
@SuppressFBWarnings("PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS")
|
||||
@Test
|
||||
public void testWeather() throws ModuleException {
|
||||
ArrayList<Message> messages = Weather2.getWeather("98204",
|
||||
List<Message> messages = Weather2.getWeather("98204",
|
||||
LocalProperties.getProperty(Weather2.OWM_API_KEY_PROP));
|
||||
assertThat(messages.get(0).getMessage()).as("is Everett").contains("Everett");
|
||||
messages = Weather2.getWeather("London, UK", LocalProperties.getProperty(Weather2.OWM_API_KEY_PROP));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue