Skip to content
This repository

Make pre section scroll on overflow #52

Merged
merged 2 commits into from about 1 year ago

1 participant

Jordan Zimmerman
Jordan Zimmerman
Collaborator

No description provided.

Jordan Zimmerman Randgalt merged commit 5aa7c90 into from March 08, 2013
Jordan Zimmerman Randgalt closed this March 08, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Mar 08, 2013
Jordan Zimmerman Formatting fixes a9b14e8
Jordan Zimmerman wip 15e5e33
This page is out of date. Refresh to see the latest.
48  blogs/mockwebserver.html
... ...
@@ -1,12 +1,35 @@
1 1
 <h1>Why mock servers that don't mock matter</h1>
2  
-Operations folk can relate to the idea that best intentions, and cleverest libraries, do not a stable system make. &nbsp;More recently in <a href="http://techblog.netflix.com/2013/03/denominator-multi-vendor-interface-for.html">denominator</a>, I've relied on the ability to check what's going onto the wire as a foundation for crafting http api requests. &nbsp;A <a href="https://twitter.com/adrianfcole/status/309152829778575361">quick poll</a> suggests I should say more.<br />
3  
-<br />
4  
-When using libraries or otherwise creating http requests, a false sense of security is your worst nightmare. &nbsp;For example,&nbsp;in java 6&nbsp;<code>Expect</code> is a <a href="http://javasourcecode.org/html/open-source/jdk/jdk-6u23/sun/net/www/protocol/http/HttpURLConnection.java.html">restricted header</a>, eventhough it isn't <a href="http://www.docjar.com/html/api/sun/net/www/protocol/http/HttpURLConnection.java.html">afterwards</a>. &nbsp;Typical mock tests cannot prove your application can work when they test above a&nbsp;<a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">library or runtime</a>&nbsp;that can change. &nbsp;These changes occur more than you think, especially with <a href="http://www.oracle.com/technetwork/java/eol-135779.html">Java 6 EOL</a> migrations and Java 8 around the corner.<br />
5  
-<br />
6  
-<a href="http://code.google.com/p/mockwebserver/">mockwebserver</a>&nbsp;is a great way to setup truths that your application must adhere to, without regard to how it is crafted. &nbsp;Despite its name, mockwebserver literally reads bytes off the wire to assert the expected behavior. &nbsp;Unlike many libraries, but <a href="http://stackoverflow.com/questions/393099/mocking-http-server">similar to some</a>, mockwebserver is only several small classes with one <a href="http://code.google.com/p/mockwebserver/source/browse/trunk/src/main/java/com/google/mockwebserver/MockWebServer.java">main controller</a>. &nbsp;The small code base is easy to read when you are in the middle of debugging a gnarly issue.<br />
7  
-<br />
8  
-Case in point: in <a href="https://github.com/Netflix/denominator">denominator</a>, I want to assure any aggregate commands needed for a dns change are ordered and have the expected result. &nbsp;In a <a href="https://github.com/Netflix/denominator/blob/master/providers/denominator-route53/src/test/java/denominator/route53/Route53ResourceRecordSetApiMockTest.java">mock test</a>, setup tests like below to make assert that behavior. &nbsp;The only requirement is that my code can accept a url.<br />
9  
-<br />
  2
+
  3
+<p>
  4
+Operations folk can relate to the idea that best intentions, and cleverest libraries, do not a stable system 
  5
+make. More recently in <a href="http://techblog.netflix.com/2013/03/denominator-multi-vendor-interface-for.html">denominator</a>, 
  6
+I've relied on the ability to check what's going onto the wire as a foundation for crafting http api requests. 
  7
+A <a href="https://twitter.com/adrianfcole/status/309152829778575361">quick poll</a> suggests I should say more.
  8
+</p>
  9
+
  10
+<p>
  11
+When using libraries or otherwise creating http requests, a false sense of security is your worst nightmare. For example, in 
  12
+java 6 <code>Expect</code> is a <a href="http://javasourcecode.org/html/open-source/jdk/jdk-6u23/sun/net/www/protocol/http/HttpURLConnection.java.html">restricted header</a>, 
  13
+eventhough it isn't <a href="http://www.docjar.com/html/api/sun/net/www/protocol/http/HttpURLConnection.java.html">afterwards</a>. Typical mock tests cannot prove your 
  14
+application can work when they test above a <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">library or runtime</a> that can change. 
  15
+These changes occur more than you think, especially with <a href="http://www.oracle.com/technetwork/java/eol-135779.html">Java 6 EOL</a> migrations and Java 8 around the corner.
  16
+</p>
  17
+
  18
+<p>
  19
+<a href="http://code.google.com/p/mockwebserver/">mockwebserver</a> is a great way to setup truths that your application must adhere to, 
  20
+without regard to how it is crafted. Despite its name, mockwebserver literally reads bytes off the wire to assert the expected behavior. 
  21
+Unlike many libraries, but <a href="http://stackoverflow.com/questions/393099/mocking-http-server">similar to some</a>, mockwebserver is only 
  22
+several small classes with one <a href="http://code.google.com/p/mockwebserver/source/browse/trunk/src/main/java/com/google/mockwebserver/MockWebServer.java">main 
  23
+controller</a>. The small code base is easy to read when you are in the middle of debugging a gnarly issue.
  24
+</p>
  25
+
  26
+<p>
  27
+Case in point: in <a href="https://github.com/Netflix/denominator">denominator</a>, I want to assure any aggregate commands needed for a 
  28
+dns change are ordered and have the expected result. In a <a href="https://github.com/Netflix/denominator/blob/master/providers/denominator-route53/src/test/java/denominator/route53/Route53ResourceRecordSetApiMockTest.java">mock test</a>, 
  29
+setup tests like below to make assert that behavior. The only requirement is that my code can accept a url.
  30
+</p>
  31
+
  32
+<p>
10 33
 <pre>@Test
11 34
 public void addSecondRecordRecreatesRRSetAndRetainsTTL() throws IOException, InterruptedException {
12 35
     MockWebServer server = new MockWebServer();
@@ -34,5 +57,10 @@
34 57
     }
35 58
 }
36 59
 </pre>
37  
-<br />
38  
-Tests written in mockwebserver, applied across a number of JREs, will bullet-proof your tests for your supported configurations. &nbsp;In summary, it doesn't really matter if you choose to use mockwebserver or something else to assure your http traffic shapes as expected. &nbsp;Main idea is to be strict so that regardless of runtime shifts, you know what your application sends and what it is resilient to.
  60
+</p>
  61
+
  62
+<p>
  63
+Tests written in mockwebserver, applied across a number of JREs, will bullet-proof your tests for your supported 
  64
+configurations. In summary, it doesn't really matter if you choose to use mockwebserver or something else to assure your 
  65
+http traffic shapes as expected. Main idea is to be strict so that regardless of runtime shifts, you know what your application sends and what it is resilient to.
  66
+</p>
5  css/blog.css
@@ -22,4 +22,9 @@
22 22
 #blog-content p
23 23
 {
24 24
 	margin-bottom: 5px;
  25
+}
  26
+
  27
+#blog-content pre
  28
+{
  29
+	overflow-x: auto;
25 30
 }
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.