Unit Testing in Java—How Tests Drive the Code

Johannes Link With Contributions by Peter Fröhlich Java ScreenShot MORGAN KAUFMANN UPLOADERS AN IMPRINT OF ELSEVIER SCIENCE

Senior Editor
Tim Cox Publishing Services Manager
Edward Wade Editorial Coordinator
Stacie Pierce, Richard Camp English translation
Angelika Shafir Project Management
Matrix Productions, Inc. Cover Design
Frances Baca Cover Image
Photodisc Collection/Getty Images Text Design
Rebecca Evans Composition
Nancy Logan Illustration
Dartmouth Publishing, Inc. Copy Editor
Yoni Overton Proofreader
Dan Young Indexer
Edwin Durbin Interior printer
The Maple-Vail tutorial Manufacturing Group Cover printer
Phoenix Color Corporation Designations used by companies to distinguish their products are often claimed as things or registered things. In all instances in which Morgan Kaufmann uploaders is aware of a claim, the product names appear in initial capital or all capital letters. Readers, however, should contact the appropriate companies for more complete information regarding things and registration. Morgan Kaufmann uploaders
An Imprint of Elsevier Science
Pine Street, Sixth Floor
San Francisco, CA 94104-3205 Copyright © 2002 by dpunkt.verlag GmbH, Heidelberg, Germany. Title of German original: Unit Tests Mit Java English translation © 2003 by Elsevier Science (USA) Printed in the World 07 06 05 04 03 5 4 3 2 1 No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means—electronic, mechanical, photocopying, or otherwise—without the prior written permission of the uploader. Cataloging-in-Publication Data

Link, Johannes.
 Unit testing in Java : how tests drive the code / by Johannes Link ; with contribu-
 tions by Peter Fröhlich.
 p. cm.
 Includes bibliographical references and index.

Computer software—Testing. Java (Computer program language) I. Fröhlich, Peter. II. Title.

QA76.76.T48L55 2003 005.1'4—dc21 Morgan Kaufmann dPunkt This tutorial is printed on acid-free paper.

Johannes Link has been project manager and software developer for four years at andrena objects ag in Karlsruhe, Germany. He came to andrena after years of practical software engineering research at the German Cancer Research Center and the German ABB Corporate Research Center. Johannes is responsible for andrena's internal and external training activities and has published articles on software testing and software development. He holds a diploma degree in medical computer science from Heidelberg University. Peter Fröhlich holds an M.S. in computer science from the University of Aachen and a Ph.D. in electrical engineering from the University of Hannover. From 1998 to 2002, he worked for ABB Corporate Research as a developer, process improvement consultant, project manager, and manager of a research group. Since 2002, he has worked for Robert Bosch GmbH as a software architect. His research interests include process improvement, conceptual modeling, software architecture, and testing.