You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ConnectionErrorTest.kt 781B

12345678910111213141516171819
  1. package com.dmdirc.ktirc.model
  2. import org.junit.jupiter.api.Assertions.assertEquals
  3. import org.junit.jupiter.api.Test
  4. import java.net.ConnectException
  5. import java.nio.channels.UnresolvedAddressException
  6. import java.security.cert.CertificateException
  7. internal class ConnectionErrorTest {
  8. @Test
  9. fun `maps exceptions to ConnectionError types`() {
  10. assertEquals(ConnectionError.ConnectionRefused, ConnectException().toConnectionError())
  11. assertEquals(ConnectionError.BadTlsCertificate, CertificateException().toConnectionError())
  12. assertEquals(ConnectionError.UnresolvableAddress, UnresolvedAddressException().toConnectionError())
  13. assertEquals(ConnectionError.Unknown, IllegalArgumentException().toConnectionError())
  14. }
  15. }