mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-14 01:55:46 +00:00
dependencies added to sbt to compile GildedRoseApprovalTest.java
This commit is contained in:
1 parent
c27ad4786c
commit
36acc45c3e
3 files changed
+45
-6
No files matched your search
@@ -0,0 +1,38 @@
|
||||
package com.gildedrose;
|
||||
|
||||
import org.approvaltests.Approvals;
|
||||
import org.approvaltests.reporters.DiffReporter;
|
||||
import org.approvaltests.reporters.UseReporter;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
|
||||
@UseReporter(DiffReporter.class)
|
||||
public class GildedRoseApprovalTest {
|
||||
|
||||
@Test
|
||||
public void foo() {
|
||||
|
||||
Item[] items = new Item[]{new Item("foo", 0, 0)};
|
||||
GildedRose app = new GildedRose(items);
|
||||
app.updateQuality();
|
||||
|
||||
Approvals.verifyAll("Items", items);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void thirtyDays() {
|
||||
|
||||
ByteArrayOutputStream fakeoutput = new ByteArrayOutputStream();
|
||||
System.setOut(new PrintStream(fakeoutput));
|
||||
System.setIn(new ByteArrayInputStream("a\n".getBytes()));
|
||||
|
||||
// todo: fix Program
|
||||
// Program.main();
|
||||
String output = fakeoutput.toString();
|
||||
|
||||
Approvals.verify(output);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ import org.scalatest.matchers.should.Matchers
|
||||
import java.io.{File, FileOutputStream}
|
||||
import scala.io.Source
|
||||
|
||||
class GildedRoseApprovalTest extends AnyFlatSpec with Matchers {
|
||||
class GildedRoseApprovalTestInScala extends AnyFlatSpec with Matchers {
|
||||
it should "return the result of the golden master" in {
|
||||
val fileWithTestResult = new File("approvaltests/gildedrose.testresult.txt")
|
||||
val outputStream = new FileOutputStream(fileWithTestResult)
|
||||
Reference in new issue
Block a user