background preloader

Java

Facebook Twitter

Mocks Aren't Stubs. The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing. Most language environments now have frameworks that make it easy to create mock objects. What's often not realized, however, is that mock objects are but one form of special case test object, one that enables a different style of testing.

In this article I'll explain how mock objects work, how they encourage testing based on behavior verification, and how the community around them uses them to develop a different style of testing. I first came across the term "mock object" a few years ago in the Extreme Programming (XP) community. But as often as not I see mock objects described poorly.

This difference is actually two separate differences. Regular Tests I'll begin by illustrating the two styles with a simple example. These two behaviors imply a couple of tests, these look like pretty conventional JUnit tests. Tests with Mock Objects Using EasyMock class OrderStateTester... JAX-RS: Developing RESTful Web Services in Java. He simplicity of REpresentational State Transfer (REST), an architectural style for accessing information on the web, has made it a popular way for developers to access services. In the REST architectural style, information on the server side is considered a resource, which developers can access in a uniform way using web URIs (Uniform Resource Identifiers) and HTTP. Because REST uses HTTP as the communication protocol, the REST style is constrained to a stateless client/server architecture. RESTful web services (i.e., web services that are created and accessed using REST principles) use HTTP protocol methods for the operations they perform (see Table 1 below).

For example, a developer can map the HTTP methods POST, GET, PUT, and DELETE to create, read, update and delete (CRUD) operations. For Java developers, JAX-RS (JSR 311) provides an API for creating RESTful web services in Java. JAX-RS and the Jersey Project Sun offers a reference implementation for JAX-RS code-named Jersey. Monads are Elephants Part 1. Introductions to monads are bit of cottage industry on the Internet.

So I figured, "why buck tradition? " But this article will present Scala's way of dealing with monads. An ancient parable goes that several blind men were experiencing their first elephant. "It's a tree," one said while wrapping his arms around its legs. "A large snake," another said while holding its trunk. From this parable we can conclude this: the ancients believed that the visually impaired like to fondle large mammals. We're also supposed to learn something about how our limitations can prevent us from grasping the whole picture and that we're all blind in some way. I think there's a third lesson to be learned - the opposite of the main intent: that it's possible to learn much about the big picture by getting a series of limited explanations.

Monads are Container Types One of the most commonly used container types is List and we'll spend some time with it. Monads are parameterized. One such method is map. Metrics - Google Web Toolkit - Google Code. The individual metrics may be expanded (drill down) to show the value of that metric at each subscope (project, package and type). Any metrics that have exceeded their user defined thresholds and trigger points are shown highlighted in red (or any other color settable via the preference page). Right-clicking on any metric with show the following menu: Double clicking on a compilation unit will open it up in an editor. If a subscope is selected within a metric, the "Go Into" command will refocus the entire metrics view on that scope as the top level. The "Go Back" and "Go Forward" buttons may then be used to go forward and backward through the selected scopes.

The context menu contains a "Copy to Clipboard" item that will allow you to capture the currently visible results on the clipboard so that they can be pasted into e-mail messages, text documents, HTML documents, XML documents or even a spreadsheet application. A sample XML report is shown below. The Detail Chooser The Detail View Go Back. Automating Releases With maven-release-plugin. We Recommend These Resources The maven-release-plugin is used to automate a lot of the manual steps involved in releasing new versions of your software. The automation prevents mistakes which ultimately occur using a manual process. The amount of work the plug-in does is impressive – it will perform these basic operations. If you work on one project, performing all these steps manually may not be a big deal. The homepage for the plugin ( will tell you everything you need to know about the plugin except how to run it! Abstract The purpose of this article is to document the steps needed to configure all the technologies which the maven-release-plugin will need to work with a regular Maven repository and with a CVS repository requiring an SSL connection.

If someone has a different way of doing this, please contact me! Outline There are many steps required to get all the technologies configured correctly for the maven-release-plugin. <! <! Installing GWT Designer - Google Web Toolkit - Google Code. Writing Testable Code. Jsr-133-faq. Table of Contents What is a memory model, anyway? In multiprocessor systems, processors generally have one or more layers of memory cache, which improves performance both by speeding access to data (because the data is closer to the processor) and reducing traffic on the shared memory bus (because many memory operations can be satisfied by local caches.) Memory caches can improve performance tremendously, but they present a host of new challenges. What, for example, happens when two processors examine the same memory location at the same time?

Under what conditions will they see the same value? At the processor level, a memory model defines necessary and sufficient conditions for knowing that writes to memory by other processors are visible to the current processor, and writes by the current processor are visible to other processors. Some processors exhibit a strong memory model, where all processors see exactly the same value for any given memory location at all times.