O'Reilly logo

MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL by James Turner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Stubbing Out Taxes and Shipping

As mentioned at the beginning of the chapter, shipping and taxes are two more tricky business logic subsystems.

In a real application, you would have to calculate taxes and shipping costs on your orders. This usually involves interfacing to third-party APIs that do the (sometimes complex) calculations, and return a value to be placed into the order. This is the same thing you will have to do with credit card authorization.

You usually won't be ready to actually integrate with the vendor's code (you might not even have chosen a vendor) when you write the code that requires that functionality. So, you'll need to stub something out for testing.

A good technique for any piece of code that's going to initially function ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required