package language import org.junit.Test as test import kotlin.test.* class Product(val name: String, val price: Double) { } class Customer(val name: String, val products: List) { } fun customerTemplate(customer: Customer) = """

Hello ${customer.name}

lets do some kool stuff

""" fun productSnippet(product: Product) = "
  • ${product.name}. Price : ${product.price}
  • " // TODO support number formatting methods? // fun productSnippet(product: Product) = "
  • ${product.name}. Price : ${product.price.format('## ###,00')}
  • " val EXPECTED = """

    Hello James

    lets do some kool stuff

    """ class StringExpressionExampleTest { val customer = Customer("James", arrayListOf(Product("Beer", 1.99), Product("Wine", 5.99))) @test fun testExpressions(): Unit { assertEquals(EXPECTED, customerTemplate(customer)) } }