public void testCreationWithFilter2() {
        List<Message> msgs=new ArrayList<>(20);
        for(int i=1; i <= 20; i++) {
            Message msg=new Message(null, i);
            if(i <= 10) {
                msg.setFlag(Message.Flag.OOB);
                if(i % 2 == 0)
                    msg.setTransientFlag(Message.TransientFlag.OOB_DELIVERED);
            }
            msgs.add(msg);
        }

        Predicate<Message> filter=msg -> msg != null && (!msg.isFlagSet(Message.Flag.OOB) || msg.setTransientFlagIfAbsent(Message.TransientFlag.OOB_DELIVERED));
        MessageBatch batch=new MessageBatch(null, null, null, true, msgs, filter);
        System.out.println("batch = " + batch.map(print_numbers));
        assert batch.size() == 15;
        for(Message msg: batch) {
            int num=msg.getObject();
            if(num <= 10)
                assert msg.isTransientFlagSet(Message.TransientFlag.OOB_DELIVERED);
        }
    }