Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 64 for assertFailsWith (0.29 sec)

  1. okhttp/src/test/java/okhttp3/HeadersTest.kt

      }
    
      @Test fun ofRejectsNullChar() {
        assertFailsWith<IllegalArgumentException> {
          headersOf("User-Agent", "Square\u0000OkHttp")
        }
      }
    
      @Test fun ofMapThrowsOnEmptyName() {
        assertFailsWith<IllegalArgumentException> {
          mapOf("" to "OkHttp").toHeaders()
        }
      }
    
      @Test fun ofMapThrowsOnBlankName() {
        assertFailsWith<IllegalArgumentException> {
          mapOf(" " to "OkHttp").toHeaders()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 8.6K bytes
    - Viewed (0)
  2. okhttp-tls/src/test/java/okhttp3/tls/internal/der/DerTest.kt

        val bytes = "170d3139313231362333303231305a".decodeHex()
        assertFailsWith<ProtocolException> {
          Adapters.UTC_TIME.fromDer(bytes)
        }.also { expected ->
          assertThat(expected).hasMessage("Failed to parse UTCTime 191216#30210Z")
        }
      }
    
      @Test fun `cannot decode generalized time with offset`() {
        assertFailsWith<ProtocolException> {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 31.7K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/OkHttpClientTest.kt

        builder.networkInterceptors().addAll(listOf(null) as List<Interceptor>)
        assertFailsWith<IllegalStateException> {
          builder.build()
        }.also { expected ->
          assertThat(expected.message).isEqualTo("Null network interceptor: [null]")
        }
      }
    
      @Test fun testH2PriorKnowledgeOkHttpClientConstructionFallback() {
        assertFailsWith<IllegalArgumentException> {
          OkHttpClient.Builder()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Mar 31 17:16:15 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  4. okhttp/src/test/java/okhttp3/internal/ws/WebSocketWriterTest.kt

      }
    
      @Test fun closeCodeOutOfRangeThrows() {
        assertFailsWith<IllegalArgumentException> {
          clientWriter.writeClose(98724976, "Hello".encodeUtf8())
        }.also { expected ->
          assertThat(expected.message).isEqualTo("Code must be in range [1000,5000): 98724976")
        }
      }
    
      @Test fun closeReservedThrows() {
        assertFailsWith<IllegalArgumentException> {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  5. okhttp/src/test/java/okhttp3/URLConnectionTest.kt

      }
    
      @Test
      fun requestHeaderValidationIsStrict() {
        assertFailsWith<IllegalArgumentException> {
          Request.Builder()
            .addHeader("a\tb", "Value")
        }
        assertFailsWith<IllegalArgumentException> {
          Request.Builder()
            .addHeader("Name", "c\u007fd")
        }
        assertFailsWith<IllegalArgumentException> {
          Request.Builder()
            .addHeader("", "Value")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 131.7K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/MultipartReaderTest.kt

            boundary = "simple boundary",
            source = Buffer().writeUtf8(multipart),
          )
    
        val part = parts.nextPart()!!
        assertFailsWith<EOFException> {
          assertThat(part.body.readUtf8()).isEqualTo("abcd\r\nefgh\r\n")
        }
    
        assertFailsWith<EOFException> {
          assertThat(parts.nextPart()).isNull()
        }
      }
    
      @Test fun `malformed headers`() {
        val multipart =
          """
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 13.8K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/CertificatePinnerTest.kt

            .build()
    
        // Should be pinned:
        assertFailsWith<SSLPeerUnverifiedException> {
          certificatePinner.check("example.co.uk", listOf(certB1.certificate))
        }
        assertFailsWith<SSLPeerUnverifiedException> {
          certificatePinner.check("foo.example.co.uk", listOf(certB1.certificate))
        }
        assertFailsWith<SSLPeerUnverifiedException> {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/ResponseBodyJvmTest.kt

    import assertk.assertions.isTrue
    import java.io.IOException
    import java.io.InputStreamReader
    import java.io.Reader
    import java.nio.charset.StandardCharsets
    import java.util.concurrent.atomic.AtomicBoolean
    import kotlin.test.assertFailsWith
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.ResponseBody.Companion.toResponseBody
    import okhttp3.internal.and
    import okio.Buffer
    import okio.BufferedSource
    import okio.ByteString
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 13K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/internal/ws/WebSocketReaderTest.kt

        data.write("0a00".decodeHex()) // Empty pong.
        assertFailsWith<ProtocolException> {
          clientReader.processNextFrame()
        }.also { expected ->
          assertThat(expected.message)
            .isEqualTo("Control frames must be final.")
        }
      }
    
      @Test fun reservedFlag1IsUnsupportedWithNoCompression() {
        data.write("ca00".decodeHex()) // Empty pong, flag 1 set.
        assertFailsWith<ProtocolException> {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 14.4K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/ServerTruncatesRequestTest.kt

          )
    
        call.execute().use { response ->
          assertThat(response.body.string()).isEqualTo("abc")
          val requestBodyOut = requestBody.takeSink()
          assertFailsWith<IOException> {
            SlowRequestBody.writeTo(requestBodyOut)
          }
          assertFailsWith<IOException> {
            requestBodyOut.close()
          }
        }
    
        // Confirm that the connection pool was not corrupted by making another call.
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 9.5K bytes
    - Viewed (0)
Back to top