Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise 2.2 EL #80

Open
wants to merge 1 commit into
base: testing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bin/fi/oulu/tol/sqat/GildedRose.class
Binary file not shown.
Binary file modified bin/fi/oulu/tol/sqat/Item.class
Binary file not shown.
Binary file modified bin/fi/oulu/tol/sqat/tests/GildedRoseTest.class
Binary file not shown.
204 changes: 204 additions & 0 deletions src/GuidedRoseMyTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
import static org.junit.Assert.*;

import java.util.List;

import org.junit.Test;

import fi.oulu.tol.sqat.GildedRose;
import fi.oulu.tol.sqat.Item;

public class GuidedRoseMyTest {

@Test
public void testUpdateEndOfDay_SellInValueDenotes() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("generic", 5, 10) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemWork = items.get(0);
assertEquals(9, itemWork.getQuality());
}

@Test
public void testUpdateEndOfDay_SellDatePassedQualityDegrades2() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("generic", -2, 10) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemWork = items.get(0);
assertEquals(8, itemWork.getQuality());
}

@Test
public void testUpdateEndOfDay_QualityNotNegative() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("generic", 5, 0) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemWork = items.get(0);
assertEquals(0, itemWork.getQuality());
}

@Test
public void testUpdateEndOfDay_QualityNotNegative2() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("generic", -2, 1) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemWork = items.get(0);
assertEquals(0, itemWork.getQuality());
}

@Test
//this test failed
public void testUpdateEndOfDay_QualityNotMore50() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("generic", 5, 60) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemWork = items.get(0);
assertEquals(50, itemWork.getQuality());
}

@Test
public void testUpdateEndOfDay_AgedBrieIncreasesQualityOlder() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("Aged Brie", 2, 10) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemBrie = items.get(0);
assertEquals(11, itemBrie.getQuality());
}

@Test
public void testUpdateEndOfDay_AgedBrieNotMore50() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("Aged Brie", 5, 50) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemBrie = items.get(0);
assertEquals(50, itemBrie.getQuality());
}

@Test
//this test failed
public void testUpdateEndOfDay_Sulfuras() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("Sulfuras", 5, 80) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemSulfuras = items.get(0);
assertEquals(80, itemSulfuras.getQuality());
}

@Test
//this test failed
//the name of the item is not just "Backstage passes"
public void testUpdateEndOfDay_Backstagepasses1() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("Backstage passes", 20, 10) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemBackstagepasses = items.get(0);
assertEquals(11, itemBackstagepasses.getQuality());
}

@Test
//this test failed
//the name of the item is not just "Backstage passes"
public void testUpdateEndOfDay_Backstagepasses2() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("Backstage passes", 10, 10) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemBackstagepasses = items.get(0);
assertEquals(12, itemBackstagepasses.getQuality());
}

@Test
//this test failed
//the name of the item is not just "Backstage passes"
public void testUpdateEndOfDay_Backstagepasses3() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("Backstage passes", 5, 10) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemBackstagepasses = items.get(0);
assertEquals(13, itemBackstagepasses.getQuality());
}

@Test
//this test failed
//the name of the item is not just "Backstage passes"
public void testUpdateEndOfDay_Backstagepasses4() {
// Arrange
GildedRose store = new GildedRose();
store.addItem(new Item("Backstage passes", 0, 10) );

// Act
store.updateEndOfDay();

// Assert
List<Item> items = store.getItems();
Item itemBackstagepasses = items.get(0);
assertEquals(0, itemBackstagepasses.getQuality());
}



}