I was reading the guide to use Junit with scala on this site And there is line of code I don't understand in the code lines I copy pasted at the end of this message.
The code line is :
var pizza: Pizza = _
I know that the place holder is used in the pattern matching to say "if it's anything else do this". But I don't understand what it means hear.
Can someone explain ?
package com.acme.pizza
import org.junit.Test
import junit.framework.TestCase
import org.junit.Assert._
class PizzaTests extends TestCase {
var pizza: Pizza = _
override def setUp {
pizza = new Pizza
}
def testOneTopping {
pizza.addTopping(Topping("green olives"))
assertEquals(pizza.getToppings.size, 1)
}
def testAddingAndRemovingToppings {
pizza.addTopping(Topping("green olives"))
pizza.removeTopping(Topping("green olives"))
assertEquals(pizza.getToppings.size, 0)
}
}