blob: 4697f565090b0c2288c261bc07d65b66bae20fd4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package sandcrawler
import cascading.tuple.Fields
import org.scalatest._
class HBaseBuilderTest extends FlatSpec with Matchers {
"parseColSpec()" should "work on legal nontrivial input" in {
val (fams, fields) = HBaseBuilder.parseColSpec(List("file:size", "file:cdx", "match0:status"))
fams should have length 2
fields should have length 2
val fileIndex = fams.indexOf("file")
fileIndex should not be -1
fields(fileIndex) should be (new Fields("size", "cdx"))
val match0Index = fams.indexOf("match0")
match0Index should not be -1
fields(match0Index) should be (new Fields("status"))
}
it should "work on empty input" in {
val (fams, fields) = HBaseBuilder.parseColSpec(List())
fams should have length 0
fields should have length 0
}
it should "throw IllegalArgumentException on malformed input" in {
a [IllegalArgumentException] should be thrownBy {
HBaseBuilder.parseColSpec(List("file_size"))
}
}
it should "throw IllegalArgumentException on nonexistent family" in {
a [IllegalArgumentException] should be thrownBy {
HBaseBuilder.parseColSpec(List("foo:bar"))
}
}
it should "throw IllegalArgumentException on nonexistent column" in {
a [IllegalArgumentException] should be thrownBy {
HBaseBuilder.parseColSpec(List("file:bar"))
}
}
}
|