add scala companion class and companion object test