From 0f9e4100229f6f30d90ba54b68838a56fb97f561 Mon Sep 17 00:00:00 2001
From: pohmelo <mikkovp@hotmail.com>
Date: Fri, 21 Sep 2018 17:48:37 +0300
Subject: [PATCH] Assignment Finished

---
 bin/fi/oulu/tol/sqat/GildedRose.class         | Bin 2380 -> 2131 bytes
 bin/fi/oulu/tol/sqat/Item.class               | Bin 1034 -> 1034 bytes
 .../oulu/tol/sqat/tests/GildedRoseTest.class  | Bin 504 -> 3365 bytes
 .../oulu/tol/sqat/tests/GildedRoseTest.java   | 125 +++++++++++++++++-
 4 files changed, 123 insertions(+), 2 deletions(-)

diff --git a/bin/fi/oulu/tol/sqat/GildedRose.class b/bin/fi/oulu/tol/sqat/GildedRose.class
index f244eba73874c91f18244a292b7f88cc3b4b5f80..b904cd2a2f60ff47b023e9e0b84ddbe56eddc526 100644
GIT binary patch
literal 2131
zcmbVMOK%%h6#nkmi60qa*C}amn|9Jbu$vHv7D7{p7RPxuu0!g`sD(vu?6Es#Vkh$e
zr9wgic3q&h3q*w~5f<G7l~Schh;?@SfiB=5uq1#uckJTvgDz@mJa^9HJKz1zxp)7c
z$3Fu&gH<0ShNC4dQMGkDVO8~nxy7x-f~FVM;^nHT`ru^<-{2qdgw8AF#LD^&wO}!H
zX_mTSk}Ko*Y)jJ<8O^kk41t_hu5imXREBtqdpgrrYl(o8=PA!WUC_0PW}Rp7#Nv4d
zZ@OAk17LVTMi;snLK&^1X6=o2)mY=}I^jn$)dJV^+|a~#-RLi?mOv$XkytAODm2<=
zd=@RQbzLK*!FJ{il?c?wi$zhCAsTBBbv7B#_h0}~A6{bUZI(^OQ5>Uv69~hLv6^Zw
z!ISZ;q=)9<ANe16hVE%czaTsql5qk-ABGwF8l_T(!M8=5f;fpGVqtF<xuwokiYujA
zzU{}W)V@?%Eh;mHrV6%k8K*Ex%t%wgY^koNo0|`>k*i~4gBU|X#spp`g$N?cH>hie
zpEkfj$ytV0DJO$8k8k?$M$@>}d@?45I^F7)&2`g{vou&Uyzr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S
zUao_~hnMiejk(t{>>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-F<D-q3op@)KXIHzaFXr8
zX?6lhHiaQ}6KB~XhS^UTWzR6ien*DA!bSEMCX_ZzDLZjRIftvt2&R>3<drYbt}H@d
qogPK`8q>&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..86c608e1a130d3506ba1bc783f500e2d34d0181d 100644
GIT binary patch
delta 30
gcmeC;=;GLLiBXV&ft7)c0R-3?I6&0q$BgPs08#Y>lK=n!

delta 30
jcmeC;=;GLLiBXV|ft7)cfq{XMft`T^L~nk~sLlicQXd4C

diff --git a/bin/fi/oulu/tol/sqat/tests/GildedRoseTest.class b/bin/fi/oulu/tol/sqat/tests/GildedRoseTest.class
index e44e81ce2b232358b6069c215dc740c0984c2b8c..e3fde2827969d486397173d5e7e8556de13aacfa 100644
GIT binary patch
literal 3365
zcmcJP>r)d~7{;Fs#Do|XF<t<r>z#`l@KRKe77;KQ<PyX()#8#YaWU-T?nY&_wp#6N
zI%7M%Y47$+r_)dUqPEU-`nmr>|B`;{<vGdjl8`{#nU>4$Is2aT?)&`S=j<<k{P+`q
z1DFlKCt>Hb7B#Y&Y}7U~QR}i|M{U)zt!TfNNvWw(!&1jM51>*)^^9^wiDnc%9UYpQ
zQIocW6`h){*<BJU8k@!?RQ4DtHG~ROh2h5v32Wk-uAa`$PO0XYGL=y!)WnUXk{MS_
zP0XE#mG(u=lCV4ekBaG#&?JgHGnZ0qwO3CKO`lNaC%e;X>bR+?lOtIrquKM5ZLO1S
zZ4zonv%0O#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a{oeEBPt8udL+n9LYzDCHF7awVGH2
zryQAsi~DwzGCL@<i+$^+%;W4t4@I0P=$j~9SSg4$uWz+p-&SLIQQt%?-?x#nB9^co
zMGP-vJy$}B^<pe+fD#5NVVDv|C}EV=OB6_G_av0J-eL)&XL$*u<s?W6rw<Q``;e#(
zS1c(Z<XVl6jNnYs>}<h|Vec=3iGoN3FBZ)5iy}B*@T|%mFZ6jDwd~ysgfu}&=LqRM
zA-zOMlQi-Lv_oOnr)a?>@ui4O#W<$9I?dG=xk|$fe`j$C*O0+=j&4H7Ef{zQbGV1g
zxDT@c_5%<0d!AqBJ-_J8SbWY!ED!raS=e<B>>I_fmE}wyLDEH$!>tz0(nYgH@I8jy
z=#3Y64xolSuaf6A^1M!-H^}p4^1MmYy~5AKt2{lo(2v`+;cGa9JEVM<bYCacH%RSG
z(t3+K-!5Qw!((Q9%+7htM%aU5W+IknHuG<o{mtk7|7CWM%-$ul_sQ%7GW(FsJ|eS^
r$?QIvJs`7B$m~-x`;5#!C$lfe>`OBHip(C8+1LLGvrFut51GFJ&Z@At

delta 167
zcmZ1~^@Ew~)W2Q(7#J9g86+oi?dIhvNi8l3$w&<;DlN&F_+H<Hi$RD%gq=Z{kwGB8
zC|y6RG%vG6-?6wjwWx%LL6kv^k%21_%meC3Wn^H{h|&z3Jcm_}k!kX2RxL)h$=_JD
y?Ti^1fslcLm1PHm;6@;WiGd49asg=&$-=-5gbWNk5Jf<m7sz8|5C@V>3=#m3;UMz>

diff --git a/src/fi/oulu/tol/sqat/tests/GildedRoseTest.java b/src/fi/oulu/tol/sqat/tests/GildedRoseTest.java
index 7aceb2e..9a3981c 100644
--- a/src/fi/oulu/tol/sqat/tests/GildedRoseTest.java
+++ b/src/fi/oulu/tol/sqat/tests/GildedRoseTest.java
@@ -36,7 +36,128 @@ public void testUpdateEndOfDay_AgedBrie_Quality_10_11() {
 	}
     
 	@Test
-	public void testUpdateEndOfDay() {
-		fail("Test not implemented");
+	public void testUpdateEndOfDay_AgedBrieReallyOld() {
+		// Arrange
+		GildedRose store = new GildedRose();
+		store.addItem(new Item("Aged Brie", 2, 10) );
+		
+		// Act
+		for(int i = 0; i < 60; i++){
+		    store.updateEndOfDay();
+		}
+		
+		// Assert
+		List<Item> items = store.getItems();
+		Item itemBrie = items.get(0);
+		assertEquals(50, itemBrie.getQuality());
+	}
+	
+	@Test
+	public void testUpdateEndOfDay_CreateSulfurasWithFalseQuality() {
+		// Arrange
+		GildedRose store = new GildedRose();
+		store.addItem(new Item("Sulfuras, Hand of Ragnaros", 2, 10) );
+		
+		// Act
+		store.updateEndOfDay();
+		
+		// Assert. This assert would pass if there would be prevention of falsely created items.
+		List<Item> items = store.getItems();
+		Item itemSulfuras = items.get(0);
+		assertEquals("Created Sulfuras with false quality and run updateEndOfDay", 80, itemSulfuras.getQuality());
+	}
+	
+	@Test
+	public void testUpdateEndOfDay_SulfurasGettingOlder() {
+		// Arrange
+		GildedRose store = new GildedRose();
+		store.addItem(new Item("Sulfuras, Hand of Ragnaros", 2, 80) );
+		
+		// Act
+		store.updateEndOfDay();
+		
+		// Assert
+		List<Item> items = store.getItems();
+		Item itemSulfuras = items.get(0);
+		assertEquals(80, itemSulfuras.getQuality());
+	}
+	
+	@Test
+	public void testUpdateEndOfDay_PassQuality() {
+		// Arrange
+		GildedRose store = new GildedRose();
+		store.addItem(new Item("Backstage passes to a TAFKAL80ETC concert", 12, 0) );
+		
+		// Acts and Asserts
+		store.updateEndOfDay();
+		List<Item> items = store.getItems();
+		Item itemPass = items.get(0);
+		assertEquals(1, itemPass.getQuality());
+		store.updateEndOfDay();
+		assertEquals(2, itemPass.getQuality());
+		store.updateEndOfDay();
+		assertEquals(4, itemPass.getQuality());
+		store.updateEndOfDay();
+		store.updateEndOfDay();
+		store.updateEndOfDay();
+		store.updateEndOfDay();
+		store.updateEndOfDay();
+		assertEquals(15, itemPass.getQuality());
+		store.updateEndOfDay();
+		assertEquals(18, itemPass.getQuality());
+		store.updateEndOfDay();
+		store.updateEndOfDay();
+		store.updateEndOfDay();
+		assertEquals(27, itemPass.getQuality());
+		store.updateEndOfDay();
+		assertEquals(0, itemPass.getQuality());
+	}
+	
+	@Test
+	public void testUpdateEndOfDay_RandomItemQuality() {
+		// Arrange
+		GildedRose store = new GildedRose();
+		store.addItem(new Item("Just some item", 2, 10) );
+		
+		// Acts and Asserts
+		store.updateEndOfDay();
+		List<Item> items = store.getItems();
+		Item itemSome = items.get(0);
+		assertEquals(9, itemSome.getQuality());
+		store.updateEndOfDay();
+		assertEquals(8, itemSome.getQuality());
+		store.updateEndOfDay();
+		assertEquals(6, itemSome.getQuality());
+		store.updateEndOfDay();
+		assertEquals(4, itemSome.getQuality());
+		store.updateEndOfDay();
+		store.updateEndOfDay();
+		assertEquals(0, itemSome.getQuality());
+		store.updateEndOfDay();
+		assertEquals(0, itemSome.getQuality());
+	}
+	
+	@Test
+	public void testUpdateEndOfDay_QualityOver50() {
+		// Arrange
+		GildedRose store = new GildedRose();
+		store.addItem(new Item("Aged Brie", 2, 10) );
+		
+		// Acts and Asserts
+		store.updateEndOfDay();
+		List<Item> items = store.getItems();
+		Item itemSome = items.get(0);
+		assertEquals(9, itemSome.getQuality());
+		store.updateEndOfDay();
+		assertEquals(8, itemSome.getQuality());
+		store.updateEndOfDay();
+		assertEquals(6, itemSome.getQuality());
+		store.updateEndOfDay();
+		assertEquals(4, itemSome.getQuality());
+		store.updateEndOfDay();
+		store.updateEndOfDay();
+		assertEquals(0, itemSome.getQuality());
+		store.updateEndOfDay();
+		assertEquals(0, itemSome.getQuality());
 	}
 }