use of com.googlecode.zohhak.api.Coercion in project knotx by Cognifide.
the class MultiMapConverterTest method provideMultiMap.
@Coercion
public MultiMap provideMultiMap(String input) {
final MultiMap multiMap = MultiMap.caseInsensitiveMultiMap();
final String[] entries = input.split("\\|");
for (String entry : entries) {
final String[] keyWithValues = entry.split(":");
final String[] elements = keyWithValues[1].split(",");
for (String e : elements) {
multiMap.add(keyWithValues[0], e);
}
}
return multiMap;
}
use of com.googlecode.zohhak.api.Coercion in project knotx by Cognifide.
the class FragmentContentExtractorTest method provideFragment.
@Coercion
public Fragment provideFragment(String fragmentContentFile) throws IOException {
final String fragmentContent = readText(fragmentContentFile);
Fragment fragmentMock = Mockito.mock(Fragment.class);
when(fragmentMock.isRaw()).thenReturn(!fragmentContent.contains(FragmentConstants.SNIPPET_IDENTIFIER_NAME));
when(fragmentMock.content()).thenReturn(fragmentContent);
return fragmentMock;
}