package ch.zhaw.ads;

import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import java.util.*;
import java.io.*;

public class RankingServerTest {

    RankingServer rankingServer;
    String csv;

    @Before
    public void setUp() throws Exception {
        rankingServer = new RankingServer();
        csv = openFile("./build/resources/main/RangZuerich.csv");
    }

    @Test
    public void test1() {
        System.out.println(rankingServer.execute(csv));
    }

    // helper functions
    private String openFile(String name) throws Exception {
		BufferedReader br = new BufferedReader(
				new InputStreamReader(new FileInputStream(name), "ISO-8859-1"));
		StringBuffer b = new StringBuffer();
		String line;
		while ((line = br.readLine()) != null) {
			b.append(line);
			b.append('\n');
		}
		return b.toString();
    }
}

