-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d56c19c
commit 28780a7
Showing
1 changed file
with
133 additions
and
0 deletions.
There are no files selected for viewing
133 changes: 133 additions & 0 deletions
133
src/test/java/it/smartphonecombo/uecapabilityparser/model/BwClassTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
package it.smartphonecombo.uecapabilityparser.model | ||
|
||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
|
||
internal class BwClassTest { | ||
|
||
@Test | ||
fun validFromString() { | ||
val bwc = "A" | ||
val actual = BwClass.valueOf(bwc).toString() | ||
val expected = "A" | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun invalidFromString() { | ||
val bwc = "#@*" | ||
val actual = BwClass.valueOf(bwc) | ||
val expected = BwClass.INVALID | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun noneFromString() { | ||
val bwc = "" | ||
val actual = BwClass.valueOf(bwc) | ||
val expected = BwClass.NONE | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun noneFromString2() { | ||
val bwc = null | ||
val actual = BwClass.valueOf(bwc) | ||
val expected = BwClass.NONE | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun validFromIndex() { | ||
val bwc = 4 | ||
val actual = BwClass.valueOf(bwc).toString() | ||
val expected = "D" | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun validFromIndex2() { | ||
val bwc = 6 | ||
val actual = BwClass.valueOf(bwc).toString() | ||
val expected = "F" | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun invalidFromIndex() { | ||
val bwc = 100 | ||
val actual = BwClass.valueOf(bwc) | ||
val expected = BwClass.INVALID | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun invalidFromIndex2() { | ||
val bwc = -100 | ||
val actual = BwClass.valueOf(bwc) | ||
val expected = BwClass.INVALID | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun noneFromIndex() { | ||
val bwc = 0 | ||
val actual = BwClass.valueOf(bwc) | ||
val expected = BwClass.NONE | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun validFromMtkIndex() { | ||
val bwc = 0 | ||
val actual = BwClass.valueOfMtkIndex(bwc).toString() | ||
val expected = "A" | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun validFromMtkIndex2() { | ||
val bwc = 5 | ||
val actual = BwClass.valueOfMtkIndex(bwc).toString() | ||
val expected = "F" | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun invalidFromMtkIndex() { | ||
val bwc = 7 | ||
val actual = BwClass.valueOfMtkIndex(bwc) | ||
val expected = BwClass.INVALID | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun invalidFromMtkIndex2() { | ||
val bwc = -7 | ||
val actual = BwClass.valueOfMtkIndex(bwc) | ||
val expected = BwClass.INVALID | ||
|
||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun noneFromMtkIndex() { | ||
val bwc = 6 | ||
val actual = BwClass.valueOfMtkIndex(bwc) | ||
val expected = BwClass.NONE | ||
|
||
assertEquals(expected, actual) | ||
} | ||
} |