package com.ibtp.kontor.library.dal;

import com.ibtp.kontor.dal.DatabaseManager;
import com.ibtp.kontor.util.LocalTestDatabase;
import com.ibtp.kontor.library.entity.ArticleEntity;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.util.List;

/**
 * Created by tpeetz on 23.01.2015.
 */
public class ArticleImplTest {

    @Before
    public void setUp() {
        DatabaseManager.setDatabase(new LocalTestDatabase());
    }

    @Test
    public void testAddArticle() {
        String articleTitle = "testAddArticle";
        ArticleImpl articleImpl = new ArticleImpl();
        ArticleEntity article = articleImpl.addArticle(articleTitle);
        Assert.assertNotNull(article);
        List<ArticleEntity> articleList = articleImpl.findByTitle(articleTitle);
        Assert.assertEquals(1, articleList.size());
    }

    @Test
    public void testArticleAddAndDelete() {

    }

    @Test
    public void testArticleFindAll() {

    }
}
