EasyMock Fundamentals Series — Part 3

Welcome to the third installment in my EasyMock Fundamentals series where I take you through the ins and outs of the open source Java library.

By |May 28th, 2013|General|0 Comments|

EasyMock Fundamentals Series — Part 2

Each way gives you a mock object with slightly different behaviors/restrictions. Consult the EasyMock API for specifics, but unless you have valid reason to not, the preferred method is createNiceMock().

By |May 21st, 2013|General|0 Comments|

EasyMock Fundamentals — Part 1

In my three-part EasyMock Fundamentals series, I will take you through the ins and outs of the open source Java library. EasyMock can be used in conjunction with a unit testing framework, such as JUnit or TestNG, to facilitate better unit testing without all the 2nd degree dependency issues. EasyMock provides the means (through the use of mock objects) to specify the response that will be returned when the code being tested makes calls to external methods. This will allow the result of the unit test to be isolated from variables outside of the scope of the unit test code.
An Introduction to EasyMock Fundamentals

Refer to the official EasyMock documentation for more detailed explanation of the tool (latest as of this writing EasyMock3.1 Docs) including download, setup, and a brief usage example.

Please note that, for the sake of simplicity, not all the details of the code examples have been included.
Stubs vs. Mocks
An alternative to using a mock object is to create a stub object; a lightweight implementation of the interface for the external methods, that just return the expected response. These two approaches are best illustrated with an example.

Let us say you want to write a unit test for an object Foo that does something cool, doSomethingCool(), and uses another object, Emailer, to send emails while doing something cool as follows:
package com.partnet.foo;
public class Foo {
  private Emailer emailer;
  public Foo(Emailer emailer) {
    this.emailer = emailer;
  }
  public void doSomethingCool() {
    // something worthy of being unit tested
    emailer.sendEmail(…);
  }
}
package com.partnet.foo;
public interface Emailer {
  boolean sendEmail(…) throw EmailerException;
}
If you’re trying to test the doSomethingCool() method, you don’t want to, shouldn’t have to, and thankfully don’t need to worry about what emailer.sendEmail() does (assuming the implementation of the call has no impact on the code you’re testing of […]

By |May 14th, 2013|General|0 Comments|

Utah Getting Act Together on Healthcare IT Security

Healthcare IT security has been a sensitive subject for the past 12 months in Utah’s health care community with two major healthcare security breaches.

4 eCommerce Content Do’s

Consider four things about your eCommerce catalog content: richness, quantity, its value as an asset and using a data standard.

B2B VS B2G: How eCommerce Can Save the Government Money

Business to Business (B2B) markets have impacted the business community for a number of years now. Their positive impact on the economy is evident in several ways.

6 Things You Didn’t Know About DOD EMALL

DOD EMALL is the one-stop shopping, enterprise-wide eCommerce site for the Department of Defense. The eCommerce site supports over 30 Million SKUs and has 40,000 active users, but that’s just scratching the surface. While DOD EMALL can be used to purchase everything from office supplies to weapon system parts, there are a number of other useful features that you might not be aware of within DOD EMALL.

DOD EMALL supports contracts from all the military services, the Department of Homeland Security, Defense Commissary Agency (DECA), GSA and as well as the Defense Logistics Agency (DLA). Any Federal agency with an IDIQ or BPA contract can place it on DOD EMALL. At this time, there is no charge for this service. This is an excellent opportunity for smaller agencies to have their own eCommerce site without the investment.
DOD EMALL makes it easy to support a large group of people with their acquisition needs. If your office has a single purchase cardholder and many personnel with purchasing needs but not purchasing power, DOD EMALL can help you support your staff. Agency personnel can register with DOD EMALL as a Shopper. Shoppers have the ability to complete all their shopping, but not the ability to purchase. Staff members without purchasing power can still build a virtual cart filled with the items that they want, but instead of completing the order, these Shoppers simply send their virtual cart to the office purchase cardholder. The purchase cardholder has the ability to merge multiple shopping carts together to consolidate buys while still retaining the individual details of the orders. This way, when the order comes in, they can easily sort out who ordered what. This is an incredibly convenient way to […]

Government Contracting: Why Size Matters

Think about small businesses in government contracting when you’re looking for support on big projects.

SB2G – Using Simplified Acquisition to Raise Small Business Goals

Federal Acquisition Regulation (FAR), Part 13, lays out a variety of purchasing methods collectively known as simplified acquisition to facilitate Government buyers in acquiring supplies and services.

Why Open Source Software is Good for the Government: Part 4 – What Next?

Even with the many benefits of open source software (OSS), misconceptions of open source software persists. One of the hurdles seems to be that the government acquisition community is not as familiar with the variety of products and services as they could be.

Google+