mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
Utilize non-default arg.
This commit is contained in:
committed by
Greyson Parrelli
parent
d0c858221e
commit
9ea392fb4e
@@ -22,7 +22,12 @@ class StaticIpResolverTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Given a hostname with records, when I resolveToBuildConfig, then I expect a matching IP`() {
|
fun `Given a hostname with records, when I resolveToBuildConfig, then I expect a matching IP`() {
|
||||||
val staticIpResolver = StaticIpResolver(FakeRecordFetcher())
|
val staticIpResolver = StaticIpResolver(FakeRecordFetcher(mapOf(
|
||||||
|
SIGNAL_DOT_ORG to arrayOf(ARecord(Name.fromString("www."), DClass.ANY, 0L, mockk<Inet4Address> {
|
||||||
|
every { address } returns SIGNAL_IP
|
||||||
|
every { hostAddress } returns STRINGIFIED_IP
|
||||||
|
}))
|
||||||
|
)))
|
||||||
val actual = staticIpResolver.resolveToBuildConfig(SIGNAL_DOT_ORG)
|
val actual = staticIpResolver.resolveToBuildConfig(SIGNAL_DOT_ORG)
|
||||||
val expected = """
|
val expected = """
|
||||||
new String[]{"$STRINGIFIED_IP"}
|
new String[]{"$STRINGIFIED_IP"}
|
||||||
@@ -37,12 +42,7 @@ class StaticIpResolverTest {
|
|||||||
staticIpResolver.resolveToBuildConfig(SIGNAL_DOT_ORG)
|
staticIpResolver.resolveToBuildConfig(SIGNAL_DOT_ORG)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FakeRecordFetcher(private val recordMap: Map<String, Array<Record>?> = mapOf(
|
private class FakeRecordFetcher(private val recordMap: Map<String, Array<Record>?>) : StaticIpResolver.RecordFetcher {
|
||||||
SIGNAL_DOT_ORG to arrayOf(ARecord(Name.fromString("www."), DClass.ANY, 0L, mockk<Inet4Address> {
|
|
||||||
every { address } returns SIGNAL_IP
|
|
||||||
every { hostAddress } returns STRINGIFIED_IP
|
|
||||||
}))
|
|
||||||
)) : StaticIpResolver.RecordFetcher {
|
|
||||||
override fun fetchRecords(hostName: String): Array<Record>? {
|
override fun fetchRecords(hostName: String): Array<Record>? {
|
||||||
return recordMap[hostName]
|
return recordMap[hostName]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user