Skip to content
Snippets Groups Projects
Commit 58bdbfd0 authored by Karsch Lukas's avatar Karsch Lukas
Browse files

added test

parent 3749d978
Branches
No related tags found
No related merge requests found
......@@ -14,6 +14,8 @@ public class Categories {
return allCategories.remove(c);
}
public void removeCategory(String name) {}
public Set<Category> getAllCategories(){
return allCategories;
}
......
package mi.hdm.recipes;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
public class CategoryTest {
Categories underTest = new Categories();
@Test
public void testEquals() {
Category c1 = new Category("Abend", 0x00FF00);
Category c2 = new Category("LEcker", 0x13);
Category c3 = new Category("ew", 0x13);
Category c4 = new Category("ew", 0x100);
assertNotEquals(c1, c2);
assertEquals(c3, c4);
assertEquals(c2, c3);
}
@Test
public void shouldNotBeAbleToAddIdenticalName() {
underTest.addCategory("Mittag", 0x100000);
underTest.addCategory("Mittag", 0x100000);
Assert.assertEquals(1, underTest.getAllCategories().size());
}
@Test
public void shouldBeAbleToAddCategory() {
underTest.addCategory("Morgen", 0x100000);
Assert.assertEquals(2, underTest.getAllCategories().size());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment