Home / Class/ PatternParseFailureAnalyzerTests Class — spring-boot Architecture

PatternParseFailureAnalyzerTests Class — spring-boot Architecture

Architecture documentation for the PatternParseFailureAnalyzerTests class in PatternParseFailureAnalyzerTests.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

core/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/PatternParseFailureAnalyzerTests.java lines 32–63

class PatternParseFailureAnalyzerTests {

	private final PathPatternParser parser = new PathPatternParser();

	@Test
	void patternParseFailureQuotesPattern() {
		FailureAnalysis failureAnalysis = performAnalysis("/spring/**/framework");
		assertThat(failureAnalysis.getDescription())
			.contains("Invalid mapping pattern detected:\n" + "/spring/**/framework\n" + "        ^");
		assertThat(failureAnalysis.getAction())
			.contains("Fix this pattern in your application or switch to the legacy parser"
					+ " implementation with 'spring.mvc.pathmatch.matching-strategy=ant_path_matcher'.");
	}

	private FailureAnalysis performAnalysis(String pattern) {
		PatternParseException failure = createFailure(pattern);
		FailureAnalysis analyze = new PatternParseFailureAnalyzer().analyze(failure);
		assertThat(analyze).isNotNull();
		return analyze;
	}

	PatternParseException createFailure(String pattern) {
		try {
			this.parser.parse(pattern);
			throw new AssertionError("Should not be reached");
		}
		catch (PatternParseException ex) {
			return ex;
		}
	}

}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free