Delete unused imports
This commit is contained in:
parent
57c4eca039
commit
ac22b786be
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -23,7 +23,6 @@ import java.util.List;
|
|||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.test.MockHttpServletResponse;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.mvc.annotation;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
@ -7,14 +23,12 @@ import java.util.Locale;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.test.MockHttpServletResponse;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/** @author Arjen Poutsma */
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.util.UriComponents;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -22,12 +22,11 @@ import java.util.Arrays;
|
|||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.test.MockHttpServletResponse;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -41,7 +41,6 @@ import org.dom4j.io.SAXReader;
|
|||
import org.springframework.beans.propertyeditors.CustomCollectionEditor;
|
||||
import org.springframework.format.Formatter;
|
||||
import org.springframework.format.support.FormattingConversionService;
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.validation.BeanPropertyBindingResult;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -27,6 +27,7 @@ import java.util.Set;
|
|||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.test.MockHttpServletResponse;
|
||||
|
@ -46,7 +47,6 @@ import org.springframework.web.servlet.ViewResolver;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,20 +16,11 @@
|
|||
|
||||
package org.springframework.web.servlet.view.freemarker;
|
||||
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
|
||||
import freemarker.cache.ClassTemplateLoader;
|
||||
import freemarker.cache.MultiTemplateLoader;
|
||||
import freemarker.cache.TemplateLoader;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
|
@ -39,28 +30,30 @@ import org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean;
|
|||
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
|
||||
import org.springframework.ui.freemarker.SpringTemplateLoader;
|
||||
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
* @since 14.03.2004
|
||||
*/
|
||||
public class FreeMarkerConfigurerTests extends TestCase {
|
||||
public class FreeMarkerConfigurerTests {
|
||||
|
||||
public void testFreemarkerConfigurationFactoryBeanWithConfigLocation() throws TemplateException {
|
||||
@Test(expected = IOException.class)
|
||||
public void freemarkerConfigurationFactoryBeanWithConfigLocation() throws Exception {
|
||||
FreeMarkerConfigurationFactoryBean fcfb = new FreeMarkerConfigurationFactoryBean();
|
||||
fcfb.setConfigLocation(new FileSystemResource("myprops.properties"));
|
||||
Properties props = new Properties();
|
||||
props.setProperty("myprop", "/mydir");
|
||||
fcfb.setFreemarkerSettings(props);
|
||||
try {
|
||||
fcfb.afterPropertiesSet();
|
||||
fail("Should have thrown IOException");
|
||||
}
|
||||
catch (IOException ex) {
|
||||
// expected
|
||||
}
|
||||
fcfb.afterPropertiesSet();
|
||||
}
|
||||
|
||||
public void testFreeMarkerConfigurationFactoryBeanWithResourceLoaderPath() throws Exception {
|
||||
@Test
|
||||
public void freeMarkerConfigurationFactoryBeanWithResourceLoaderPath() throws Exception {
|
||||
FreeMarkerConfigurationFactoryBean fcfb = new FreeMarkerConfigurationFactoryBean();
|
||||
fcfb.setTemplateLoaderPath("file:/mydir");
|
||||
fcfb.afterPropertiesSet();
|
||||
|
@ -68,14 +61,16 @@ public class FreeMarkerConfigurerTests extends TestCase {
|
|||
assertTrue(cfg.getTemplateLoader() instanceof SpringTemplateLoader);
|
||||
}
|
||||
|
||||
public void testFreemarkerConfigurationFactoryBeanWithNonFileResourceLoaderPath()
|
||||
throws IOException, TemplateException {
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void freemarkerConfigurationFactoryBeanWithNonFileResourceLoaderPath() throws Exception {
|
||||
FreeMarkerConfigurationFactoryBean fcfb = new FreeMarkerConfigurationFactoryBean();
|
||||
fcfb.setTemplateLoaderPath("file:/mydir");
|
||||
Properties settings = new Properties();
|
||||
settings.setProperty("localized_lookup", "false");
|
||||
fcfb.setFreemarkerSettings(settings);
|
||||
fcfb.setResourceLoader(new ResourceLoader() {
|
||||
|
||||
@Override
|
||||
public Resource getResource(String location) {
|
||||
if (!("file:/mydir".equals(location) || "file:/mydir/test".equals(location))) {
|
||||
|
@ -83,6 +78,7 @@ public class FreeMarkerConfigurerTests extends TestCase {
|
|||
}
|
||||
return new ByteArrayResource("test".getBytes(), "test");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getClassLoader() {
|
||||
return getClass().getClassLoader();
|
||||
|
|
Loading…
Reference in New Issue