frees-io / freestyle-cassandra

Freestyle Cassandra
http://frees.io/
Apache License 2.0
17 stars 4 forks source link

Adds tests for the FieldLister and FieldListerExpanded objects #102

Closed fedefernandez closed 7 years ago

fedefernandez commented 7 years ago

We currently don't have any tests for FieldLister nor FieldListerExpanded entities. This code is covered because of a different feature that makes use of it is being tested, but we'd like to have proper tests for each specific feature.

FieldLister provides a way to list the column names for a case class. FieldListerExpanded works in a similar way but instead of returning the name of the fields that are case classes, it expands these case classes. For example:

case class Foo(fieldFoo1: String, fieldFoo2: Int, bar: Bar)
case class Bar(fieldBar1: Boolean, fieldBar2: Double)

val lister: FieldLister[Foo] = ???
lister.list // List("fieldFoo1", "fieldFoo2", "bar")

val expandedLister: FieldListerExpanded[Foo] = ???
expandedLister.list // List("fieldFoo1", "fieldFoo2", "fieldBar1", "fieldBar2")

The goal is to have at least an 80% of code coverage.

Code reference: https://github.com/frees-io/freestyle-cassandra/blob/1a8f2f00db18c142df00bba20ee0d68838e139a8/core/src/main/scala/query/query.scala