Created
December 16, 2014 16:58
-
-
Save Ironholds/30c09e6b4402bfc0e967 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Example: this is an existing test | |
public void testIsPageviewApp() { | |
Text uriHost = new Text("en.wikipedia.org"); | |
Text uriPath = new Text("/w/api.php?action=mobileview§ions=0"); | |
Text httpStatus = new Text("200"); | |
Text contentType = new Text("application/json"); | |
Text userAgent = new Text("WikipediaApp/1.2.3"); | |
IsPageviewUDF udf = new IsPageviewUDF(); | |
assertTrue(udf.evaluate(uriHost, uriPath, httpStatus, contentType, userAgent).get()); | |
} | |
//The difficult-to-export bit here is Text foo = new Text("bar"); - that's the thing where lots of languages use very different | |
//structures. | |
//Can we just do... | |
assertTrue(udf.evaluate("en.wikipedia.org","/w/api.php?action=mobileview§ions=0","200","application/json","WikipediaApp/1.2.3"); | |
//? | |
//If so, we could use this formatting to make the tests more exportable | |
//C++? replace "assertTrue" with "assert" | |
//R? replace "assertTrue" with "expect_true" | |
//Python? leave as is! | |
//The test is far more reusable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment