Search in sources :

Example 6 with TestWith

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));
}
Also used : SnippetPatterns(io.knotx.fragments.SnippetPatterns) TestWith(com.googlecode.zohhak.api.TestWith)

Example 7 with TestWith

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));
}
Also used : SnippetPatterns(io.knotx.fragments.SnippetPatterns) TestWith(com.googlecode.zohhak.api.TestWith)

Example 8 with TestWith

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));
}
Also used : ServiceEntry(io.knotx.knot.service.service.ServiceEntry) TestWith(com.googlecode.zohhak.api.TestWith)

Example 9 with TestWith

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));
}
Also used : Element(org.jsoup.nodes.Element) TestWith(com.googlecode.zohhak.api.TestWith)

Aggregations

TestWith (com.googlecode.zohhak.api.TestWith)9 SnippetPatterns (io.knotx.fragments.SnippetPatterns)3 Element (org.jsoup.nodes.Element)2 Division (com.faforever.server.entity.Division)1 PlayerDivisionInfo (com.faforever.server.entity.PlayerDivisionInfo)1 ServiceEntry (io.knotx.knot.service.service.ServiceEntry)1 JsonObject (io.vertx.core.json.JsonObject)1 MultiMap (io.vertx.reactivex.core.MultiMap)1