mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 16:01:42 +00:00
Export category test to csv and add base test result
This commit is contained in:
parent
da45945660
commit
9c8577e657
55
Java/base-output.csv
Normal file
55
Java/base-output.csv
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
name, sellIn, quality
|
||||||
|
-------- day 0 --------
|
||||||
|
+5 Dexterity Vest, 10, 20
|
||||||
|
Aged Brie, 2, 0
|
||||||
|
Elixir of the Mongoose, 5, 7
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 15, 20
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 10, 49
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 5, 49
|
||||||
|
-------- day 1 --------
|
||||||
|
+5 Dexterity Vest, 9, 19
|
||||||
|
Aged Brie, 1, 1
|
||||||
|
Elixir of the Mongoose, 4, 6
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 14, 21
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 9, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 4, 50
|
||||||
|
-------- day 2 --------
|
||||||
|
+5 Dexterity Vest, 8, 18
|
||||||
|
Aged Brie, 0, 2
|
||||||
|
Elixir of the Mongoose, 3, 5
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 13, 22
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 8, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 3, 50
|
||||||
|
-------- day 3 --------
|
||||||
|
+5 Dexterity Vest, 7, 17
|
||||||
|
Aged Brie, -1, 4
|
||||||
|
Elixir of the Mongoose, 2, 4
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 12, 23
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 7, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 2, 50
|
||||||
|
-------- day 4 --------
|
||||||
|
+5 Dexterity Vest, 6, 16
|
||||||
|
Aged Brie, -2, 6
|
||||||
|
Elixir of the Mongoose, 1, 3
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 11, 24
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 6, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 1, 50
|
||||||
|
-------- day 5 --------
|
||||||
|
+5 Dexterity Vest, 5, 15
|
||||||
|
Aged Brie, -3, 8
|
||||||
|
Elixir of the Mongoose, 0, 2
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 10, 25
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 5, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 0, 50
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
package com.gildedrose;
|
package com.gildedrose;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class TexttestFixture {
|
public class TexttestFixture {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("OMGHAI!");
|
System.out.println("OMGHAI!");
|
||||||
|
|
||||||
Item[] items = new Item[] {
|
Item[] items = new Item[]{
|
||||||
new Item("+5 Dexterity Vest", 10, 20), //
|
new Item("+5 Dexterity Vest", 10, 20), //
|
||||||
new Item("Aged Brie", 2, 0), //
|
new Item("Aged Brie", 2, 0), //
|
||||||
new Item("Elixir of the Mongoose", 5, 7), //
|
new Item("Elixir of the Mongoose", 5, 7), //
|
||||||
@ -14,24 +20,37 @@ public class TexttestFixture {
|
|||||||
new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
||||||
new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
||||||
// this conjured item does not work properly yet
|
// this conjured item does not work properly yet
|
||||||
new Item("Conjured Mana Cake", 3, 6) };
|
// new Item("Conjured Mana Cake", 3, 6)
|
||||||
|
};
|
||||||
|
|
||||||
GildedRose app = new GildedRose(items);
|
GildedRose app = new GildedRose(items);
|
||||||
|
|
||||||
int days = 2;
|
int days = 6;
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
days = Integer.parseInt(args[0]) + 1;
|
days = Integer.parseInt(args[0]) + 1;
|
||||||
}
|
}
|
||||||
|
List<String> output = new ArrayList<>();
|
||||||
|
output.add("name, sellIn, quality");
|
||||||
|
|
||||||
for (int i = 0; i < days; i++) {
|
for (int i = 0; i < days; i++) {
|
||||||
System.out.println("-------- day " + i + " --------");
|
output.add("-------- day " + i + " --------");
|
||||||
System.out.println("name, sellIn, quality");
|
|
||||||
for (Item item : items) {
|
for (Item item : items) {
|
||||||
System.out.println(item);
|
output.add(item.toString());
|
||||||
}
|
}
|
||||||
System.out.println();
|
|
||||||
app.updateQuality();
|
app.updateQuality();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
exportToCsv(output, "base-output.csv");
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void exportToCsv(List<String> data, String fileName) throws FileNotFoundException {
|
||||||
|
File csvOutputFile = new File(fileName);
|
||||||
|
try (PrintWriter pw = new PrintWriter(csvOutputFile)) {
|
||||||
|
data.forEach(pw::println);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user