Eric Fowler
Posts: 2
Nickname: wildsalmon
Registered: May, 2014
|
|
Visibility and ScalaTest
|
Posted: May 29, 2014 12:25 AM
|
|
Advertisement
|
This should be easy.
I have a class and companion object:
class TestMe {} object TestMe { private def foo()= {} }
Note that foo() is private.
I wish to test foo() with ScalaTest, but it is marked private.
How do I make it visible?
I thought I could wrap *both* files in a package declaration, then modify my declaration of foo():
package TestBait{ class TestMe {} object TestMe { private[TestBait] def foo()= {} } }
Then in my ScalaTest suite, I would wrap my code in the same package declaration.
Dudn't work.
There has to be a simple way to do this. If it were C++ I would make the test class a friend of the C++ class being tested.
What is the "school solution", if there is one?
Thanks
WS
|
|