}
catch(DataSourceException e) {
caught = true;
}
assertFalse(caught);
assertEquals(new ULocale("fr"), dataSourceRequest.getUserLocale());
assertTrue(dataSourceRequest.isSameOrigin());
assertEquals(OutputType.CSV, dataSourceRequest.getDataSourceParameters().getOutputType());
// Test with hl == it, not same-domain.
dataSourceRequest = null;
caught = false;
try {
HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
EasyMock.expect(req.getParameter("hl")).andReturn("it");
EasyMock.expect(req.getHeader("X-DataSource-Auth")).andReturn(null);
EasyMock.expect(req.getParameter("tqx")).andReturn(null);
EasyMock.expect(req.getParameter("tq")).andReturn(null);
EasyMock.replay(req);
dataSourceRequest = new DataSourceRequest(req);
EasyMock.verify(req);
}
catch(DataSourceException e) {
caught = true;
}
assertFalse(caught);
assertEquals(new ULocale("it"), dataSourceRequest.getUserLocale());
assertFalse(dataSourceRequest.isSameOrigin());
assertEquals(OutputType.JSONP, dataSourceRequest.getDataSourceParameters().getOutputType());
}