Search in sources :

Example 1 with Coercion

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;
}
Also used : MultiMap(io.vertx.reactivex.core.MultiMap) Coercion(com.googlecode.zohhak.api.Coercion)

Example 2 with Coercion

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;
}
Also used : Fragment(io.knotx.dataobjects.Fragment) Coercion(com.googlecode.zohhak.api.Coercion)

Aggregations

Coercion (com.googlecode.zohhak.api.Coercion)2 Fragment (io.knotx.dataobjects.Fragment)1 MultiMap (io.vertx.reactivex.core.MultiMap)1