package com.pl.tagc.tagcwebapp;

import org.apache.commons.io.IOUtils;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Tests the tagcwebapp. Tests that the resource is reachable and returns data
 * in the right format.
 *
 * @author Kasper Grabarz
 */
public class RestApiTest extends JerseyTest {

	/* (non-Javadoc)
	 * @see org.glassfish.jersey.test.JerseyTest#configure()
	 */
	@Override
	protected ResourceConfig configure() {
		enable(TestProperties.LOG_TRAFFIC);
		return new ResourceConfig(RestApi.class);
	}

	
	/**
	 * Tests that the getphylogenetictree REST endpoint returns the test tree loaded
	 * from the nwk file in the expected format.
	 *
	 * @throws Exception 
	 */
	@Test
	public void testGetPhylogeneticTree() throws Exception {
		
		final String expectedResponse = IOUtils.toString(
				Thread.currentThread().getContextClassLoader()
				.getResourceAsStream("testGenomeNwkResponse"),
			      "UTF-8"
			    );
		
		final String response = target().path("api/getphylogenetictree").queryParam("treeId", 0)
				.request().get(String.class);
		assertEquals(expectedResponse, response);
	}

}

@@ -233,16 +233,65 @@
 .Test;%0A%0A
+import static junit.framework.Assert.assertTrue;%0A
 import s
@@ -967,17 +967,36 @@
 ion %7B%0A%09%09
-%0A
+assertTrue(true);%0A//
 %09%09final 
@@ -1039,16 +1039,18 @@
 String(%0A
+//
 %09%09%09%09Thre
@@ -1092,16 +1092,18 @@
 oader()%0A
+//
 %09%09%09%09.get
@@ -1145,16 +1145,18 @@
 onse%22),%0A
+//
 %09%09%09     
@@ -1164,16 +1164,18 @@
 %22UTF-8%22%0A
+//
 %09%09%09    )
@@ -1180,11 +1180,13 @@
  );%0A
-%09%09%0A
+//%0A//
 %09%09fi
@@ -1272,16 +1272,18 @@
 Id%22, 0)%0A
+//
 %09%09%09%09.req
@@ -1308,16 +1308,18 @@
 class);%0A
+//
 %09%09assert

Build fix