import eu.toldi.rss.Article;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.time.LocalDateTime;

public class ArticleTest {

    private Article a;

    @Before
    public void setup(){ 
        a=new Article();
    }

    @Test
    public void setTitleTest(){
        a.setTitle("Menő cikk");
        Assert.assertEquals("Menő cikk",a.getTitle());
    }

    @Test
    public void setURLTest(){
        a.setURL("http://example.com/");
        Assert.assertEquals("http://example.com/",a.getURL());
    }
    @Test
    public void setAuthorTest(){
        a.setAuthor("Alice & Bob");
        Assert.assertEquals("Alice & Bob",a.getAuthor());
    }
    @Test
    public void setDescTest(){
        a.setDescription("Something very cool happened");
        Assert.assertEquals("Something very cool happened",a.getDescription());
    }

    @Test
    public void setDateTest(){
        a.setPubDate(LocalDateTime.parse("2020-11-30T09:55:23"));
        Assert.assertEquals("2020-11-30T09:55:23",a.getPubDate().toString());
    }

    @Test
    public void setImageTest(){
        a.setImageURL("https://upload.wikimedia.org/wikipedia/commons/4/4d/Cat_November_2010-1a.jpg");
        Assert.assertEquals("https://upload.wikimedia.org/wikipedia/commons/4/4d/Cat_November_2010-1a.jpg",a.getImageURL());
    }
}
