Package by.stub.yaml.stubs

Examples of by.stub.yaml.stubs.StubHttpLifecycle


         .withSequenceResponseHeaders(sequenceResponseHeaderKey, sequenceResponseHeaderValue)
         .withSequenceResponseFoldedBody(sequenceResponseBody)
         .build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);

      final StubResponse irrelevantSequenceResponse = actualHttpLifecycle.getResponse(true);
      final StubResponse actualSequenceResponse = actualHttpLifecycle.getResponse(true);

      final MapEntry sequenceHeaderEntry = MapEntry.entry(sequenceResponseHeaderKey, sequenceResponseHeaderValue);

      assertThat(actualSequenceResponse).isInstanceOf(StubResponse.class);
      assertThat(actualSequenceResponse.getHeaders()).contains(sequenceHeaderEntry);
View Full Code Here


         .withUrl(url)
         .newStubbedResponse()
         .withStatus("301").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      assertThat(actualRequest.getUrl()).isEqualTo(url);
   }
View Full Code Here

         .withMethodHead()
         .newStubbedResponse()
         .withStatus("301").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      assertThat(actualRequest.getMethod()).contains(HttpMethods.GET, HttpMethods.HEAD);
   }
View Full Code Here

         .withMethodGet()
         .newStubbedResponse()
         .withLiteralBody("hello").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubResponse actualResponse = actualHttpLifecycle.getResponse(true);

      assertThat(actualResponse.getStatus()).isEqualTo(String.valueOf(200));
   }
View Full Code Here

         .withFoldedPost(stubbedRequestPost)
         .newStubbedResponse()
         .withStatus("201").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      assertThat(actualRequest.getPost()).isEqualTo(stubbedRequestPost);
   }
View Full Code Here

         .withLiteralBody("OK")
         .withStatus("201").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);

      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      assertThat(actualRequest.getFile()).isEqualTo(new byte[]{});
      assertThat(actualRequest.getPostBody()).isEqualTo(expectedPost);
   }
View Full Code Here

         .withFile(stubbedResponseFile)
         .withStatus("201").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);

      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubResponse actualResponse = actualHttpLifecycle.getResponse(true);

      assertThat(actualResponse.getFile()).isEqualTo(new byte[]{});
      assertThat(StringUtils.newStringUtf8(actualResponse.getResponseBodyAsBytes())).isEqualTo(expectedBody);
   }
View Full Code Here

         .withLiteralPost(stubbedRequestPost)
         .newStubbedResponse()
         .withStatus("201").build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubRequest actualRequest = actualHttpLifecycle.getRequest();

      assertThat(actualRequest.getPost()).isEqualTo(stubbedRequestPost);
   }
View Full Code Here

         .withUrl("/some/uri")
         .newStubbedResponse()
         .withFoldedBody(stubbedResponseBody).build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubResponse actualResponse = actualHttpLifecycle.getResponse(true);

      assertThat(actualResponse.getBody()).isEqualTo(stubbedResponseBody);
   }
View Full Code Here

         .withUrl("/some/uri")
         .newStubbedResponse()
         .withLiteralBody(stubbedResponseBody).build();

      final List<StubHttpLifecycle> loadedHttpCycles = unmarshall(yaml);
      final StubHttpLifecycle actualHttpLifecycle = loadedHttpCycles.get(0);
      final StubResponse actualResponse = actualHttpLifecycle.getResponse(true);

      assertThat(actualResponse.getBody()).isEqualTo(stubbedResponseBody);
   }
View Full Code Here

TOP

Related Classes of by.stub.yaml.stubs.StubHttpLifecycle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.