Commit 95b0f3ba authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added test on render method

parent 4a7c0788
...@@ -216,7 +216,7 @@ object ReportBuilder { ...@@ -216,7 +216,7 @@ object ReportBuilder {
protected val engine = new TemplateEngine() protected val engine = new TemplateEngine()
/** Cache of temp file for templates from the classpath / jar */ /** Cache of temp file for templates from the classpath / jar */
private var templateCache: Map[String, File] = Map() private[report] var templateCache: Map[String, File] = Map()
/** This will give the total number of pages including all nested pages */ /** This will give the total number of pages including all nested pages */
def countPages(page: ReportPage): Int = { def countPages(page: ReportPage): Int = {
......
<%@ var arg: String%>
${arg}
\ No newline at end of file
package nl.lumc.sasc.biopet.core.report
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test
/**
* Created by pjvanthof on 24/02/16.
*/
class ReportBuilderTest extends TestNGSuite with Matchers {
@Test
def testRenderTemplate: Unit = {
ReportBuilder.templateCache = Map()
ReportBuilder.templateCache shouldBe empty
ReportBuilder.renderTemplate("/template.ssp", Map("arg" -> "test")) shouldBe "test"
ReportBuilder.templateCache.size shouldBe 1
ReportBuilder.renderTemplate("/template.ssp", Map("arg" -> "bla")) shouldBe "bla"
ReportBuilder.templateCache.size shouldBe 1
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment