Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.Talar;
- import org.junit.Before;
- import org.junit.Test;
- import static org.junit.Assert.*;
- public class ItemTest {
- Item it;
- @Before
- public void setUp(){
- it = new Item("Japko", 5);
- }
- @Test
- public void getNazwa() throws Exception {
- assertEquals(it.getNazwa(), "Japko");
- }
- @Test(expected = IllegalArgumentException.class)
- public void setZlaNazwa() throws Exception {
- it.setNazwa("Japko55");
- }
- @Test(expected = IllegalArgumentException.class)
- public void setZaKrotkaNazwa() throws Exception {
- it.setNazwa("a");
- }
- @Test(expected = IllegalArgumentException.class)
- public void setNullNazwa() throws Exception {
- it.setNazwa(null);
- }
- @Test
- public void setPoprawnaNazwa() throws Exception{
- it.setNazwa("Jabko");
- }
- @Test
- public void getCena() throws Exception {
- assertEquals(it.getCena(), 5);
- }
- @Test(expected = IllegalArgumentException.class)
- public void setUjemnaCena() throws Exception {
- it.setCena(-5);
- }
- @Test
- public void setCena() throws Exception {
- it.setCena(5);
- }
- }
Add Comment
Please, Sign In to add comment