From 151eb70ea175a33801ee36569180f6e7005ac704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santa=20Mar=C3=ADa=20Pur=C3=ADsima?= Date: Tue, 18 Oct 2016 20:51:57 +0300 Subject: [PATCH] Assignment 5 done --- bin/.gitignore | 1 + bin/fi/oulu/tol/sqat/GildedRose.class | Bin 2380 -> 2503 bytes bin/fi/oulu/tol/sqat/Item.class | Bin 1034 -> 1612 bytes .../oulu/tol/sqat/tests/GildedRoseTest.class | Bin 504 -> 6421 bytes src/fi/oulu/tol/sqat/GildedRose.java | 71 +++-- src/fi/oulu/tol/sqat/Item.java | 37 +++ .../oulu/tol/sqat/tests/GildedRoseTest.java | 268 +++++++++++++++++- 7 files changed, 346 insertions(+), 31 deletions(-) create mode 100644 bin/.gitignore diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..76b3e7b --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1 @@ +/fi/ diff --git a/bin/fi/oulu/tol/sqat/GildedRose.class b/bin/fi/oulu/tol/sqat/GildedRose.class index f244eba73874c91f18244a292b7f88cc3b4b5f80..1ac76ad1255558b2bf93ffa5d870398fe10ad424 100644 GIT binary patch literal 2503 zcmaJ>No*Tc82%>PILC4F7qGp$(CbiFnY{#v*j`h-e5SsG?Ot zOF7ZF(quaB(H)rT$b}no4G6WFk zv{HF%Htz`cpnh89GScRpAmJU`4Pc0r9~9~9t|zjFz9?MRaCOhtg+3J@JrhqJKQuBm zq^Ip%+Hkx8M#!WgJ2%g}lF`RRPUu78x)CJhPiZ)fAjh6x%m~jI$z>*Hhs82SCY&q@ z*z$;pNwOq0jA5Ky<>(#Z*^ZoUC09u-U*6Y*Nt{!0mMN5}wV~CJ!W4t$*iHql8wiyI zlf9kRZ~-rJa=aPiVu2U3+O*i_ATHsGip$kR@@b~wCCTFk<3?UsuEe~i;bjN~O}7lk zK1(Tw>2HKfQk&M0k$u_1j^)!vQ7<*K8nV(axFD7)#HNOM=@2q=Y4Xyobg?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=U0dq>2)~qT*v26Qr05DqFm!f=geot>31)nNClNh{`y``!Jucj$0^WmaLo@ z(B(ijuFcZ{DG;<1#U8qBs31AS^!C%2f&jeq1PNu>L`Vm{-zGY%X7r#1W7NnDw&63nlNQm2Z|DM&990^=k6!eZ8zyO28up}#aAHfj z>q$IRzKnEHKW$HOM!|20E@NmJ=?9pJB>7pDE9*Plt96|WZ(2fkEjA|8?{;JE_3QMt*ksuEhI#6e@_*Y; zN>VPb+x~m}QU7$ltw+NHY&ab()i30Zdn5OH?R2iYVfUI`)_qov^Nsla3apK?J;haq zAOHDOs@+qb_S@J+>vp;*cGJI;4)kL$E+a-N@5JYb;~oy-F3&89eH|M5&WC(q!lcz;O+_rkFMa(!6OPyk|3*sng0M*izc}M diff --git a/bin/fi/oulu/tol/sqat/Item.class b/bin/fi/oulu/tol/sqat/Item.class index 478a73984862181a0a6b22a57fca5a1788d6a3f6..eb613028b1b61a3ce1aacaaa680b9a3e8be992a4 100644 GIT binary patch delta 634 zcmZvZJu?GQ6o%is8^eBy+E=$k5F{y3P#`0P!bF3{+T3EtCNXPw2F>=)BXmJ#Jn6W%PbUgS&3MP2FNbA{w2*vw6)C zT&3>czOy1Tp1#<)6wZS|Cu=o|jG|V2M&TYqxvtzLDPw~EQHp?xVa!0mEG9|m{c=oU zn$!Y48BC$%B4Xw)q^QUc%(3!A1~n9|3iW6xrLe{zRwGOadHRLbH8F{zRy-tbuK9vO zkE9e?RVj)^tEi@U+Aoh`X%Iv6W6ntiXO%eXnVjW8PK+^y9rM4P4Z>_@VvbjmZKW?@ Y-ev3x*rE$;)4FytSg8w?qis}v02oYDN&o-= delta 36 scmX@Z)5XDc>ff$?3=9m$3_2URmN8D2XR=~s-yFpx#l*_Mz{H>p0Mk1N$p8QV diff --git a/bin/fi/oulu/tol/sqat/tests/GildedRoseTest.class b/bin/fi/oulu/tol/sqat/tests/GildedRoseTest.class index e44e81ce2b232358b6069c215dc740c0984c2b8c..d084dc4389b5c401eabefcb589f4e8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ssz!l+3)cSLGAq>dJ&Vi5YD>KkzYAVJ5+x!SIVo6Q67GZ_KFpY{9qPxXbS) zl2<5}e2d~ouh7b$Qrjh5YoJy5TDI;kWC=F3A5#9jFC4}AKemQ?DrVAl^M4O821So1u{0)lW{*s zJRn5u0>U;&z$5^BCv|KI6!U8tcbfOE`A_P1NfMWoB00>_LU=Dx}h6cP} z2>69d#Rcr32ZV?U5Q{)mfp{ErmAQ6N4B#Iry=w+v#niYJ7K)umEL zMHf-*#Pa}r5`fuaG|=R>nb{}0wnV0|5|m%#c4STBS13Rtg#_07<%r-iH+Jr7jopSilIXSl3i7h2#N zP=8Jdx(2)c5_bI+?D}ii^=;JCZvv>nu2fy}-w2DkqMoYXTpslup#Bc1?*R4pK>Y(y z-v#P>Kz%cc|R3stA&Tw^`dN5;CBmcDD%4*>c{fPMhbKLPa50R0f4AE5<&8~_cr z0AJI}Y5AxSw0gGWEuhX+RAaXM1Qz`ZEc#bi^lz}}-(k^z1Q=_V{$oPM>H`xNtu>;f zkDlfG{`eA$x+D5OA>*fz@iWNyFUa_B?Du~Hh(T*sxBBmdM0}z-5vhG(ewQPDPl)(A zt;YX%*0KglvPSA*O|*+OFN5gsbmdIHAVjP_jp`sm#iy1T+*k~NaR9CaU>g7vw3Dq0 T00yn-Ygn=3(>N;{=m-A;aq>UC delta 275 zcmZXNOAY}+7=){5hM|r3`v!<)5-dd`5+@J~8 diff --git a/src/fi/oulu/tol/sqat/GildedRose.java b/src/fi/oulu/tol/sqat/GildedRose.java index 8d48732..c1944de 100644 --- a/src/fi/oulu/tol/sqat/GildedRose.java +++ b/src/fi/oulu/tol/sqat/GildedRose.java @@ -7,10 +7,23 @@ public class GildedRose { private static List items = null; - + /** * @param args */ + + public GildedRose() { + items = new ArrayList(); + } + + public List getItems() { + return items; + } + + public void addItem(Item item) { + items.add(item); + } + public static void main(String[] args) { System.out.println("OMGHAI!"); @@ -23,85 +36,87 @@ public static void main(String[] args) { items.add(new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20)); items.add(new Item("Conjured Mana Cake", 3, 6)); - updateQuality(); + updateEndOfDay(); } - public static void updateQuality() + public static void updateEndOfDay() { - for (int i = 0; i < items.size(); i++) + for (Item item : items) { - if ((!"Aged Brie".equals(items.get(i).getName())) && !"Backstage passes to a TAFKAL80ETC concert".equals(items.get(i).getName())) + if ((!"Aged Brie".equals(item.getName())) && !"Backstage passes to a TAFKAL80ETC concert".equals(item.getName())) { - if (items.get(i).getQuality() > 0) + if (item.zeroQuality()) { - if (!"Sulfuras, Hand of Ragnaros".equals(items.get(i).getName())) + if (!"Sulfuras, Hand of Ragnaros".equals(item.getName())) { - items.get(i).setQuality(items.get(i).getQuality() - 1); + item.reduceQuality(); } } } else { - if (items.get(i).getQuality() < 50) + if (!item.maxQuality()) { - items.get(i).setQuality(items.get(i).getQuality() + 1); + item.increaseQuality(); - if ("Backstage passes to a TAFKAL80ETC concert".equals(items.get(i).getName())) + if ("Backstage passes to a TAFKAL80ETC concert".equals(item.getName())) { - if (items.get(i).getSellIn() < 11) + if (item.getSellIn() < 11) { - if (items.get(i).getQuality() < 50) + if (item.maxQuality()) { - items.get(i).setQuality(items.get(i).getQuality() + 1); + item.increaseQuality(); } } - if (items.get(i).getSellIn() < 6) + if (item.getSellIn() < 6) { - if (items.get(i).getQuality() < 50) + if (item.maxQuality()) { - items.get(i).setQuality(items.get(i).getQuality() + 1); + item.increaseQuality(); } } } } } - if (!"Sulfuras, Hand of Ragnaros".equals(items.get(i).getName())) + if (!"Sulfuras, Hand of Ragnaros".equals(item.getName())) { - items.get(i).setSellIn(items.get(i).getSellIn() - 1); + item.reduceSellIn(); } - if (items.get(i).getSellIn() < 0) + if (item.zeroSellIn()) { - if (!"Aged Brie".equals(items.get(i).getName())) + if (!"Aged Brie".equals(item.getName())) { - if (!"Backstage passes to a TAFKAL80ETC concert".equals(items.get(i).getName())) + if (!"Backstage passes to a TAFKAL80ETC concert".equals(item.getName())) { - if (items.get(i).getQuality() > 0) + if (!item.zeroQuality()) { - if (!"Sulfuras, Hand of Ragnaros".equals(items.get(i).getName())) + if (!"Sulfuras, Hand of Ragnaros".equals(item.getName())) { - items.get(i).setQuality(items.get(i).getQuality() - 1); + item.reduceQuality(); } } } else { - items.get(i).setQuality(items.get(i).getQuality() - items.get(i).getQuality()); + item.setQuality(item.getQuality() - item.getQuality()); } } else { - if (items.get(i).getQuality() < 50) + if (item.maxQuality()) { - items.get(i).setQuality(items.get(i).getQuality() + 1); + item.increaseQuality(); } } } } } + + } diff --git a/src/fi/oulu/tol/sqat/Item.java b/src/fi/oulu/tol/sqat/Item.java index 900d2a1..e79ad27 100644 --- a/src/fi/oulu/tol/sqat/Item.java +++ b/src/fi/oulu/tol/sqat/Item.java @@ -31,5 +31,42 @@ public int getQuality() { public void setQuality(int quality) { this.quality = quality; } + + public boolean zeroQuality() { + // TODO Auto-generated method stub + if (quality <= 0) + return true; + return false; + } + + public boolean maxQuality() { + // TODO Auto-generated method stub + if (quality >= 50) + return true; + return false; + } + + public void reduceQuality() { + // TODO Auto-generated method stub + quality--; + } + + public void increaseQuality() { + // TODO Auto-generated method stub + quality++; + + } + + public void reduceSellIn() { + // TODO Auto-generated method stub + sellIn--; + } + + public boolean zeroSellIn() { + // TODO Auto-generated method stub + if (sellIn < 0) + return true; + return false; + } } diff --git a/src/fi/oulu/tol/sqat/tests/GildedRoseTest.java b/src/fi/oulu/tol/sqat/tests/GildedRoseTest.java index 04a5d2d..2b7e547 100644 --- a/src/fi/oulu/tol/sqat/tests/GildedRoseTest.java +++ b/src/fi/oulu/tol/sqat/tests/GildedRoseTest.java @@ -1,12 +1,274 @@ package fi.oulu.tol.sqat.tests; import static org.junit.Assert.*; +import java.util.ArrayList; +import java.util.List; import org.junit.Test; +import fi.oulu.tol.sqat.GildedRose; +import fi.oulu.tol.sqat.Item; public class GildedRoseTest { + GildedRose store = new GildedRose(); + // Test Aged Brie @Test - public void testTheTruth() { - assertTrue(true); + public void testUpdateEndOfDay_AgedBrie_Quality_2_10() { + // Arrange + store.addItem(new Item("Aged Brie", 2, 10)); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "Quality of Aged Brie increases"; + assertEquals(failMessage, 11, quality); } -} + + @Test + public void testUpdateEndOfDay_AgedBrie_Quality_10_50() { + // Arrange + store.addItem(new Item("Aged Brie", 10, 50)); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "The Quality of an item is never more than 50"; + assertEquals(failMessage, 50, quality); + } + + @Test + public void testUpdateEndOfDay_AgedBrie_Quality_0_10() { + // Arrange + store.addItem(new Item("Aged Brie", 0, 10) ); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "The Quality of Aged Brie increases twice after SellIn date has passed"; + assertEquals(failMessage, 12, quality); + } + + @Test + public void testUpdateEndOfDay_AgedBrie_Quality_0_50() { + // Arrange + store.addItem(new Item("Aged Brie", 0, 50) ); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "The Quality of Aged Brie is never more than 50 increases twice after SellIn date has passed"; + assertEquals(failMessage, 50, quality); + } + + @Test + public void testUpdateEndOfDay_AgedBrie_Quality_Minus1_20() { + // Arrange + store.addItem(new Item("Aged Brie", -1, 20) ); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "The Quality of Aged Brie increases twice after SellIn date has passed"; + assertEquals(failMessage, 22, quality); + } + + @Test + public void testUpdateEndOfDay_AgedBrie_SellIn_2_10() { + // Arrange + store.addItem(new Item("Aged Brie", 2, 10)); + // Act + store.updateEndOfDay(); + // Assert + int sellIn = store.getItems().get(0).getSellIn(); + String failMessage = "SellIn date decreases"; + assertEquals(failMessage, 1, sellIn); + } + + @Test + public void testUpdateEndOfDay_AgedBrie_SellIn_1_10() { + // Arrange + store.addItem(new Item("Aged Brie", 1, 10)); + // Act + store.updateEndOfDay(); + // Assert + int sellIn = store.getItems().get(0).getSellIn(); + String failMessage = "SellIn date decreases"; + assertEquals(failMessage, 0, sellIn); + } + + @Test + public void testUpdateEndOfDay_AgedBrie_SellIn_0_10() { + // Arrange + store.addItem(new Item("Aged Brie", 0, 10)); + // Act + store.updateEndOfDay(); + // Assert + int sellIn = store.getItems().get(0).getSellIn(); + String failMessage = "SellIn date decreases"; + assertEquals(failMessage, -1, sellIn); + } + + // Test Sulfuras + @Test + public void testUpdateEndOfDay_Sulfuras_Quality_0_80() { + // Arrange + store.addItem(new Item("Sulfuras, Hand of Ragnaros", 0, 80)); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "Quality of Sulfuras is 80 and never alters"; + assertEquals(failMessage, 80, quality); + } + + @Test + public void testUpdateEndOfDay_Sulfuras_SellIn_5_80() { + // Arrange + store.addItem(new Item("Sulfuras, Hand of Ragnaros", 5, 80) ); + // Act + store.updateEndOfDay(); + // Assert + int sellIn = store.getItems().get(0).getSellIn(); + String failMessage = "Sulfuras, being a legendary item, never has to be sold"; + assertEquals(failMessage, 5, sellIn); + } + + @Test + public void testUpdateEndOfDay_Sulfuras_SellIn_0_80() { + // Arrange + store.addItem(new Item("Sulfuras, Hand of Ragnaros", 0, 80) ); + // Act + store.updateEndOfDay(); + // Assert + int sellIn = store.getItems().get(0).getSellIn(); + String failMessage = "Sulfuras, being a legendary item, never has to be sold"; + assertEquals(failMessage, 0, sellIn); + } + + // Test Backstage pass + @Test + public void testUpdateEndOfDay_Backstage_Quality_15_20() { + // Arrange + store.addItem(new Item("Backstage passes to a TAFKAL80ETC concert", + 15, 20) ); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "Quality of Backstage pass increases by 1 when there are more than 10 days"; + assertEquals(failMessage, 21, quality); + } + + @Test + public void testUpdateEndOfDay_Backstage_Quality_10_20() { + // Arrange + store.addItem(new Item("Backstage passes to a TAFKAL80ETC concert", + 10, 20) ); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "Quality of Backstage pass increases by 2 when there are 10 or less days"; + assertEquals(failMessage, 22, quality); + } + + @Test + public void testUpdateEndOfDay_Backstage_Quality_8_20() { + // Arrange + store.addItem(new Item("Backstage passes to a TAFKAL80ETC concert", + 8, 20) ); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "Quality of Backstage pass increases by 2 when there are 10 or less days"; + assertEquals(failMessage, 22, quality); + } + + @Test + public void testUpdateEndOfDay_Backstage_Quality_5_20() { + // Arrange + store.addItem(new Item("Backstage passes to a TAFKAL80ETC concert", + 5, 20) ); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "Quality of Backstage pass increases by 3 whenthere are 5 or less days"; + assertEquals(failMessage, 23, quality); + } + + @Test + public void testUpdateEndOfDay_Backstage_Quality_3_20() { + // Arrange + store.addItem(new Item("Backstage passes to a TAFKAL80ETC concert", + 3, 20) ); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "Quality of Backstage pass increases by 3 when there are 5 or less days"; + assertEquals(failMessage, 23, quality); + } + + @Test + public void testUpdateEndOfDay_Backstage_Quality_0_20() { + // Arrange + store.addItem(new Item("Backstage passes to a TAFKAL80ETC concert", + 0, 20) ); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "Quality of Backstage drops to 0 after the concert"; + assertEquals(failMessage, 0, quality); + } + + @Test + public void testUpdateEndOfDay_Backstage_Quality_15_50() { + // Arrange + store.addItem(new Item("Backstage passes to a TAFKAL80ETC concert", 15, 50)); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "The Quality of an item is never more than 50"; + assertEquals(failMessage, 50, quality); + } + + @Test + public void testUpdateEndOfDay_Backstage_SellIn_5_10() { + // Arrange + store.addItem(new Item("Backstage passes to a TAFKAL80ETC concert", 5, 10)); + // Act + store.updateEndOfDay(); + // Assert + int sellIn = store.getItems().get(0).getSellIn(); + String failMessage = "The SellIn value should decrease by 1"; + assertEquals(failMessage, 4, sellIn); + } + + // Test Elixir + @Test + public void testUpdateEndOfDay_Elixir_Quality_2_7() { + // Arrange + store.addItem(new Item("Elixir of the Mongoose", 2, 7)); + // Act + store.updateEndOfDay(); + // Assert + int quality = store.getItems().get(0).getQuality(); + String failMessage = "Quality decreases by 1"; + assertEquals(failMessage, 6, quality); + } + + @Test + public void testUpdateEndOfDay_SellIn_Quality_2_7() { + // Arrange + store.addItem(new Item("Elixir of the Mongoose", 2, 7)); + // Act + store.updateEndOfDay(); + // Assert + int sellIn = store.getItems().get(0).getSellIn(); + String failMessage = "SelIn decreases by 1"; + assertEquals(failMessage, 1, sellIn); + } +} \ No newline at end of file