package lc.mecha.mq;

import lc.mecha.log.MechaLogger;
import lc.mecha.log.MechaLoggerFactory;
import org.junit.jupiter.api.Test;

import java.util.concurrent.LinkedBlockingDeque;

public class BlockingQueueTest {
    private static final MechaLogger logger = MechaLoggerFactory.getLogger(BlockingQueueTest.class);

    @Test
    public void testSanity() throws InterruptedException {
        LinkedBlockingDeque<String> queue = new LinkedBlockingDeque<>();

        new Thread(() -> {
            try {
                String s = queue.take();
                logger.info("Read string from queue: {}", s);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();
        queue.put("Hello World");
        Thread.sleep(1000);
    }
}
