Search in sources :

Example 1 with BinaryRequestBody

use of com.palantir.dialogue.BinaryRequestBody in project dialogue by palantir.

the class ConjureBodySerDeTest method testRepeatableBinaryRequestBodyProducesRepeatableRequest.

@Test
public void testRepeatableBinaryRequestBodyProducesRepeatableRequest() {
    BodySerDe serde = DefaultConjureRuntime.builder().build().bodySerDe();
    RequestBody requestBody = serde.serialize(new BinaryRequestBody() {

        @Override
        public void write(OutputStream _requestBody) {
        }

        @Override
        public boolean repeatable() {
            return true;
        }
    });
    assertThat(requestBody.repeatable()).isTrue();
}
Also used : OutputStream(java.io.OutputStream) BodySerDe(com.palantir.dialogue.BodySerDe) BinaryRequestBody(com.palantir.dialogue.BinaryRequestBody) BinaryRequestBody(com.palantir.dialogue.BinaryRequestBody) RequestBody(com.palantir.dialogue.RequestBody) Test(org.junit.jupiter.api.Test)

Example 2 with BinaryRequestBody

use of com.palantir.dialogue.BinaryRequestBody in project dialogue by palantir.

the class ConjureBodySerDeTest method testNonRepeatableBinaryRequestBodyProducesNonRepeatableRequest.

@Test
public void testNonRepeatableBinaryRequestBodyProducesNonRepeatableRequest() {
    BodySerDe serde = DefaultConjureRuntime.builder().build().bodySerDe();
    RequestBody requestBody = serde.serialize(new BinaryRequestBody() {

        @Override
        public void write(OutputStream _requestBody) {
        }

        @Override
        public boolean repeatable() {
            return false;
        }
    });
    assertThat(requestBody.repeatable()).isFalse();
}
Also used : OutputStream(java.io.OutputStream) BodySerDe(com.palantir.dialogue.BodySerDe) BinaryRequestBody(com.palantir.dialogue.BinaryRequestBody) BinaryRequestBody(com.palantir.dialogue.BinaryRequestBody) RequestBody(com.palantir.dialogue.RequestBody) Test(org.junit.jupiter.api.Test)

Aggregations

BinaryRequestBody (com.palantir.dialogue.BinaryRequestBody)2 BodySerDe (com.palantir.dialogue.BodySerDe)2 RequestBody (com.palantir.dialogue.RequestBody)2 OutputStream (java.io.OutputStream)2 Test (org.junit.jupiter.api.Test)2