package org.jtalks.poulpe.model.entity;

import static org.testng.Assert.*;

import junit.framework.TestCase;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

/**
 * Created by IntelliJ IDEA.
 * User: Necros
 * Date: 29.11.11
 * Time: 13:51
 * To change this template use File | Settings | File Templates.
 */

public class ComponentTest extends TestCase{
    Component component;

    public void setUp(){
        component = new Component();
    }
    public void testGetDescription(){
        String description =  "blahblahblah";
        component.setDescription(description);
        assertEquals(component.getDescription(),description);
    }
    public void testSetDescription(){
        String description =  "blahblahblah";
        component.setDescription(description);
        assertEquals(component.getDescription(),description);
        try{
        component.setDescription(null);
            fail("No exception");
        }catch (IllegalArgumentException ex){}
        }
    public void testGetName(){
         String name = "blahblahblah";
        component.setDescription(name);
        assertEquals(component.getDescription(),name);
    }
    public void testSetName(){
        try{
            component.setName(null);
            fail("No exception");
        } catch (IllegalArgumentException ex){}
    }
    public void testGetComponentType(){
        assertNull(component.getComponentType());
        component.setComponentType(ComponentType.ARTICLE);
        assertEquals(ComponentType.ARTICLE,component.getComponentType());
        assertNotSame(ComponentType.FORUM,component.getComponentType());
        component.setComponentType(ComponentType.FORUM);
        assertEquals(ComponentType.FORUM,component.getComponentType());
        assertNotSame(ComponentType.ARTICLE,component.getComponentType());
    }

}

@@ -188,160 +188,8 @@
 t;%0A%0A
-/**%0A * Created by IntelliJ IDEA.%0A * User: Necros%0A * Date: 29.11.11%0A * Time: 13:51%0A * To change this template use File %7C Settings %7C File Templates.%0A */%0A%0A
 publ
@@ -215,24 +215,8 @@
 est 
-extends TestCase
 %7B%0A  
@@ -238,16 +238,33 @@
 ponent;%0A
+    @BeforeMethod
 %0A    pub
@@ -316,32 +316,42 @@
 ponent();%0A    %7D%0A
+    @Test%0A
     public void 
@@ -505,32 +505,33 @@
 etDescription(),
+ 
 description);%0A  
@@ -526,32 +526,95 @@
 ription);%0A    %7D%0A
+    @Test(expectedExceptions = IllegalArgumentException.class)%0A
     public void 
@@ -776,16 +776,17 @@
 ption(),
+ 
 descript
@@ -791,29 +791,16 @@
 ption);%0A
-        try%7B%0A
         
@@ -843,90 +843,19 @@
     
-    fail(%22No exception%22);%0A        %7Dcatch (IllegalArgumentException ex)%7B%7D%0A        %7D
+%7D%0A    @Test
 %0A   
@@ -1009,16 +1009,17 @@
 ption(),
+ 
 name);%0A 
@@ -1019,24 +1019,87 @@
 ame);%0A    %7D%0A
+    @Test(expectedExceptions = IllegalArgumentException.class)%0A
     public v
@@ -1121,25 +1121,8 @@
 ()%7B%0A
-        try%7B%0A    
     
@@ -1158,91 +1158,19 @@
     
-        fail(%22No exception%22);%0A        %7D catch (IllegalArgumentException ex)%7B%7D%0A    %7D
+%7D%0A    @Test
 %0A   
@@ -1202,16 +1202,23 @@
 nentType
+Article
 ()%7B%0A    
@@ -1357,32 +1357,33 @@
 entType.ARTICLE,
+ 
 component.getCom
@@ -1431,32 +1431,145 @@
 onentType.FORUM,
+ component.getComponentType());%0A    %7D%0A%0A    @Test%0A    public void testGetComponentTypeForum()%7B%0A        assertNull(
 component.getCom
@@ -1681,16 +1681,17 @@
 e.FORUM,
+ 
 componen
@@ -1757,16 +1757,17 @@
 ARTICLE,
+ 
 componen

POULPE-53. Rewriten a few tests