/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.addthis.hydra.data.filter.bundle;

import com.addthis.bundle.core.Bundle;
import com.addthis.bundle.core.list.ListBundle;
import com.addthis.codec.config.Configs;

import org.junit.Test;

public class BundleFilterConditionTest {

    @Test public void simpleRun() {
        Bundle bundle = new ListBundle();
        BundleFilterCondition filter = (BundleFilterCondition) Configs.decodeObject(
                BundleFilter.class, "if {true {}}, then {log = PASSED}");
        filter.filter(bundle);
    }
}
@@ -714,22 +714,113 @@
 dec.
-config.Configs
+annotations.FieldConfig;%0Aimport com.addthis.codec.config.Configs;%0Aimport com.addthis.codec.json.CodecJSON
 ;%0A%0Ai
@@ -1121,16 +1121,16 @@
 SED%7D%22);%0A
-
         
@@ -1157,10 +1157,790 @@
 );%0A    %7D
+%0A%0A    public static class FilterHolder %7B%0A        @FieldConfig public BundleFilter filter;%0A    %7D%0A%0A    @Test public void simpleRunJson() throws Exception %7B%0A        String filterDef = %22%7Bfilter: %7Bop:%5C%22condition%5C%22,%5Cn%22 +%0A                           %22%5Ct%5Ct%5Ct%5CtifCondition:%7Bop:%5C%22field%5C%22, from:%5C%22UID%5C%22,filter:%7Bop:%5C%22require%5C%22,contains:%5B%5C%220000000000000000%5C%22%5D%7D%7D,%5Cn%22 +%0A                           %22%5Ct%5Ct%5Ct%5CtifDo:%7Bop:%5C%22field%5C%22, from:%5C%22TIME%5C%22, to:%5C%22SHARD%5C%22%7D,%5Cn%22 +%0A                           %22                elseDo:%7Bop:%5C%22field%5C%22, from:%5C%22UID%5C%22, to:%5C%22SHARD%5C%22%7D,%5Cn%22 +%0A                           %22%5Ct%5Ct%5Ct%7D%7D%22;%0A        Bundle bundle = new ListBundle();%0A        FilterHolder filterHolder = CodecJSON.INSTANCE.decode(FilterHolder.class, filterDef.getBytes());%0A        filterHolder.filter.filter(bundle);%0A    %7D
 %0A%7D

add extra test for codec json + b.f.condition