Skip to content

Commit 8cb11b7

Browse files
committed
Polish "Make MustacheViewResolver bean back off without Spring MVC"
See gh-30456
1 parent 7101b50 commit 8cb11b7

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2012-2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.autoconfigure.mustache;
18+
19+
import com.samskivert.mustache.Mustache;
20+
import org.junit.jupiter.api.Test;
21+
22+
import org.springframework.boot.autoconfigure.AutoConfigurations;
23+
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
24+
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
25+
26+
import static org.assertj.core.api.Assertions.assertThat;
27+
28+
/**
29+
* Tests for {@link MustacheAutoConfiguration} without Spring MVC on the class path.
30+
*
31+
* @author Andy Wilkinson
32+
*/
33+
@ClassPathExclusions("spring-webmvc-*.jar")
34+
class MustacheAutoConfigurationWithoutWebMvcTests {
35+
36+
@Test
37+
void registerBeansForServletAppWithoutMvc() {
38+
new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(MustacheAutoConfiguration.class))
39+
.run((context) -> {
40+
assertThat(context).hasSingleBean(Mustache.Compiler.class);
41+
assertThat(context).hasSingleBean(MustacheResourceTemplateLoader.class);
42+
});
43+
}
44+
45+
}

0 commit comments

Comments
 (0)