mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 20:32:15 +00:00
dependencies added to sbt to compile GildedRoseApprovalTest.java
This commit is contained in:
parent
c27ad4786c
commit
36acc45c3e
@ -6,6 +6,7 @@ lazy val root = project
|
|||||||
name := "GildedRose",
|
name := "GildedRose",
|
||||||
version := "1.0",
|
version := "1.0",
|
||||||
scalaVersion := scala3Version,
|
scalaVersion := scala3Version,
|
||||||
|
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.19" % "test",
|
||||||
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.19" % "test"
|
libraryDependencies += "com.approvaltests" % "approvaltests" % "25.4.3" % "test",
|
||||||
|
libraryDependencies += "org.junit.jupiter" % "junit-jupiter" % "5.11.4" % "test"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,7 +6,7 @@ import org.scalatest.matchers.should.Matchers
|
|||||||
import java.io.{File, FileOutputStream}
|
import java.io.{File, FileOutputStream}
|
||||||
import scala.io.Source
|
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 {
|
it should "return the result of the golden master" in {
|
||||||
val fileWithTestResult = new File("approvaltests/gildedrose.testresult.txt")
|
val fileWithTestResult = new File("approvaltests/gildedrose.testresult.txt")
|
||||||
val outputStream = new FileOutputStream(fileWithTestResult)
|
val outputStream = new FileOutputStream(fileWithTestResult)
|
||||||
Loading…
Reference in New Issue
Block a user