package org.wkh.bateman.trade;

import org.wkh.bateman.trade.Quote;
import org.wkh.bateman.trade.GoogleQuoteFetcher;
import java.io.File;
import java.util.List;
import java.util.Scanner;
import static junit.framework.Assert.assertEquals;
import junit.framework.TestCase;

public class GoogleQuoteFetcherTest extends TestCase {
    
    public GoogleQuoteFetcherTest(String testName) {
        super(testName);
    }
    
    public void testParseQuotes() throws Exception {
        String samplePath = "src/main/resources/sample_response.txt";
        
        Scanner scan = new Scanner(new File(samplePath));  
        scan.useDelimiter("\\Z");  
        String sampleResponse = scan.next(); 
        
        GoogleQuoteFetcher fetcher = new GoogleQuoteFetcher();
        
        List<Quote> quotes = fetcher.parseQuotes(sampleResponse, 60);
        
        Quote firstQuote = quotes.get(0);
        assertEquals(firstQuote.getOpen(), 444.05);
        assertEquals(firstQuote.getHigh(), 444.19);
        assertEquals(firstQuote.getLow(), 443.8);
        assertEquals(firstQuote.getClose(), 443.8);
        assertEquals(firstQuote.getVolume(), 78179);
        assertEquals(firstQuote.getOpenDate().getMillis(), 1362061800000L);
        
        assertEquals(quotes.size(), 5873);
        
    }
}

@@ -685,16 +685,41 @@
 n.next()
+.replaceAll(%22%5Cr%5Cn%22, %22%5Cn%22)
 ; %0A     

Fix test to work correctly on windows.