use of com.googlecode.zohhak.api.TestWith in project knotx by Cognifide.
the class UnprocessedFragmentStrategyTest method unwrap_whenConfiguredSnippetTag_expectDefinedContentWithComments.
@TestWith({ "simple_snippet.txt;simple_snippet-expected_unwrapped_content.txt;script", "customTag_snippet.txt|knotx:snippet;simple_snippet-expected_unwrapped_content.txt;knotx:snippet", "big_snippet.txt;big_snippet-expected_unwrapped_content.txt;script" })
public void unwrap_whenConfiguredSnippetTag_expectDefinedContentWithComments(Fragment fragment, String expectedContentFileName, String snippetTagName) throws Exception {
final String unwrappedContent = UnprocessedFragmentStrategy.UNWRAP.get(fragment, new SnippetPatterns(snippetTagName));
final String expectedContent = FileReader.readText(expectedContentFileName);
assertThat(unwrappedContent, equalToIgnoringWhiteSpace(expectedContent));
}
use of com.googlecode.zohhak.api.TestWith in project knotx by Cognifide.
the class UnprocessedFragmentStrategyTest method asIs_whenConfiguredSnippetTag_expectIgnoredContent.
@TestWith({ "simple_snippet.txt;simple_snippet.txt;script", "customTag_snippet.txt;customTag_snippet.txt;knotx:snippet", "raw_fragment.txt;raw_fragment.txt;script" })
public void asIs_whenConfiguredSnippetTag_expectIgnoredContent(Fragment fragment, String expectedContentFileName, String snippetTagName) throws Exception {
final String unwrappedContent = UnprocessedFragmentStrategy.AS_IS.get(fragment, new SnippetPatterns(snippetTagName));
final String expectedContent = FileReader.readText(expectedContentFileName);
assertThat(unwrappedContent, equalToIgnoringWhiteSpace(expectedContent));
}
use of com.googlecode.zohhak.api.TestWith in project knotx by Cognifide.
the class FragmentContextTest method from_whenFragmentContainsOneService_expectFragmentContextWithExtractedParamsParams.
@TestWith({ "snippet_one_service_no_params.txt;{}", "snippet_one_service_invalid_params_bound.txt;{}", "snippet_one_service_one_param.txt;{\"path\":\"/overridden/path\"}", "snippet_one_service_many_params.txt;{\"path\":\"/overridden/path\",\"anotherParam\":\"someValue\"}" })
public void from_whenFragmentContainsOneService_expectFragmentContextWithExtractedParamsParams(Fragment fragment, String expectedParameters) throws Exception {
final FragmentContext fragmentContext = FragmentContext.from(fragment);
final ServiceEntry serviceEntry = fragmentContext.services.get(0);
assertThat(serviceEntry.getParams().toString(), sameJSONAs(expectedParameters));
}
use of com.googlecode.zohhak.api.TestWith in project knotx by Cognifide.
the class FragmentContentExtractorTest method unwrapFragmentContent_withFragment_expectDefinedContent.
@TestWith(value = { "simple_default_snippet.txt;simple_snippet-expected_content.txt", "complex_default_snippet.txt;complex_snippet-expected_content.txt", "simple_custom_snippet.txt;simple_snippet-expected_content.txt", "complex_custom_snippet.txt;complex_snippet-expected_content.txt" })
public void unwrapFragmentContent_withFragment_expectDefinedContent(Fragment fragment, String expectedContentFileName) throws Exception {
final String expectedContent = readText(expectedContentFileName);
final Element element = FragmentContentExtractor.unwrapFragmentContent(fragment);
assertThat(element.toString(), equalsToWithHtmlFormatting(expectedContent));
}
Aggregations