package controllers;

import static org.junit.Assert.assertTrue;

import java.util.Map;

import ninja.NinjaApiTest;
import ninja.NinjaApiTestHelper;

import org.junit.Test;

import com.google.common.collect.Maps;

public class I18nControllerTest extends NinjaApiTest {

	@Test
	public void testThatI18nWorksEn() {
		
		Map<String, String> headers = Maps.newHashMap();
		headers.put("Accept-Language", "en-US");
		
		
		String result = NinjaApiTestHelper
				.makeRequest(getServerAddress() + "/i18n", headers);

		assertTrue(result.contains(
				"Hello - this is an i18n message in the templating engine"));

	}
	
	@Test
	public void testThatI18nWorksDe() {
		
		Map<String, String> headers = Maps.newHashMap();
		headers.put("Accept-Language", "de-DE");
		
		
		String result = NinjaApiTestHelper
				.makeRequest(getServerAddress() + "/i18n", headers);

		assertTrue(result.contains(
				"Hallo - das ist eine internationalisierte Nachricht in der Templating Eninge"));

	}
}

@@ -966,13 +966,504 @@
 ge%22));%0A%0A
+%09%7D%0A%09%0A%09@Test%0A%09public void testThatRedirectWorks() %7B%0A%09%09%0A%09%09// Some empty headers for now...%0A%09%09Map%3CString, String%3E headers = Maps.newHashMap();%0A%09%09%0A%09%09// /redirect will send a location: redirect in the headers%0A%09%09String result = NinjaApiTestHelper%0A%09%09%09%09.makeRequest(getServerAddress() + %22/redirect%22, headers);%0A%0A%09%09// If the redirect has worked we must see the following text%0A%09%09// from the index screen:%0A%09%09assertTrue(result.contains(%0A%09%09%09%09%22And developing large web applications becomes fun again.%22));%0A%0A
 %09%7D%0A%7D%0A

test for redirect