package es.craftsmanship.toledo.katangapp.services;

import es.craftsmanship.toledo.katangapp.models.BusStopResult;
import es.craftsmanship.toledo.katangapp.models.QueryResult;

import java.util.ArrayList;
import java.util.List;

import org.junit.Assert;
import org.junit.Test;

/**
 * @author Manuel de la Peña
 */
public class KatangaResponseWrapperTest {

    @Test
    public void testConstructorFromInteger() {
        KatangaResponseWrapper<Integer> katangaResponseWrapper = new KatangaResponseWrapper<>(
            new Integer(1000));

        Integer response = katangaResponseWrapper.getResponse();

        Assert.assertTrue(response instanceof Integer);
        Assert.assertEquals(1000, response.intValue());
    }

    @Test
    public void testConstructorFromObject() {
        List<BusStopResult> busStopResults = new ArrayList<>();

        busStopResults.add(new BusStopResult());

        QueryResult queryResult = new QueryResult(busStopResults);

        KatangaResponseWrapper<QueryResult> katangaResponseWrapper = new KatangaResponseWrapper<>(
            queryResult);

        QueryResult response = katangaResponseWrapper.getResponse();

        Assert.assertTrue(response instanceof QueryResult);
        Assert.assertEquals(1, response.getResults().size());
    }

    @Test
    public void testConstructorFromString() {
        KatangaResponseWrapper<String> katangaResponseWrapper = new KatangaResponseWrapper<>(
            "Hello World!");

        String response = katangaResponseWrapper.getResponse();

        Assert.assertTrue(response instanceof String);
        Assert.assertEquals("Hello World!", response);
    }

}
@@ -507,39 +507,13 @@
 r%3C%3E(
-%0A            new Integer(
 1000)
-)
 ;%0A%0A 
@@ -616,26 +616,15 @@
 nse 
-instanceof Integer
+!= null
 );%0A 
@@ -1159,30 +1159,15 @@
 nse 
-instanceof QueryResult
+!= null
 );%0A 
@@ -1518,25 +1518,15 @@
 nse 
-instanceof String
+!= null
 );%0A 

apply lint suggestions