package cn.axzo.msg.center.util;

import cn.axzo.msg.center.MsgCenterApplication;
import cn.axzo.msg.center.dal.mapper.MessageRecordMapper;
import cn.axzo.msg.center.domain.entity.MessageRecord;
import cn.axzo.msg.center.inside.notices.utils.Queries;
import lombok.RequiredArgsConstructor;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import static cn.axzo.msg.center.inside.notices.utils.Queries.query;
import static org.junit.jupiter.api.Assertions.*;

/**
 * @author yanglin
 */
@SpringBootTest(classes = MsgCenterApplication.class)
@RequiredArgsConstructor(onConstructor_ = @Autowired)
class RecordIterableTest {

    private final MessageRecordMapper messageRecordMapper;

    @Test
    void foo() {
        Iterable<MessageRecord> records = messageRecordMapper
                .iterateElement(1, query(MessageRecord.class)
                        .eq(MessageRecord::getId, 3));
        for (MessageRecord record : records) {
            System.out.println("record=" + record);
        }
    }

}