Books: 8

JUnit

CoverTitleYear
Learn how to implement a DSL with Xtext and Xtend using easy-to-understand examples and best practices
ABOUT THIS BOOK * Leverage the latest features of Xtext and Xtend to develop a domain-specific language. * Integrate Xtext with popular third party IDEs and get the best out of both worlds. * Discover how to test a DSL implementation and how to customize runtime and IDE aspects of the DSL WHO more » THIS BOOK IS FOR This book is targeted at programmers and developers who want to create a domain-specific language with Xtext. They should have a basic familiarity with Eclipse and its functionality. Previous experience with compiler implementation can be helpful but is not necessary since this book will explain all the development stages of a DSL. WHAT YOU WILL LEARN * Write Xtext grammar for a DSL; * Use Xtend as an alternative to Java to write cleaner, easier-to-read, and more maintainable code; * Build your Xtext DSLs easily with Maven/Tycho and Gradle; * Write a code generator and an interpreter for a DSL; * Explore the Xtext scoping mechanism for symbol resolution; * Test most aspects of the DSL implementation with JUnit; * Understand best practices in DSL implementations with Xtext and Xtend; * Develop your Xtext DSLs using Continuous Integration mechanisms; * Use an Xtext editor in a web application IN DETAIL Xtext is an open source Eclipse framework for implementing domain-specific languages together with IDE functionalities. It lets you implement languages really quickly; most of all, it covers all aspects of a complete language infrastructure, including the parser, code generator, interpreter, and more. This book will enable you to implement Domain Specific Languages (DSL) efficiently, together with their IDE tooling, with Xtext and Xtend. Opening with brief coverage of Xtext features involved in DSL implementation, including integration in an IDE, the book will then introduce you to Xtend as this language will be used in all the examples throughout the book. You will then explore the typical programming development workflow with Xtext when we modify the grammar of the DSL. Further, the Xtend programming language (a fully-featured Java-like language tightly integrated with Java) will be introduced. We then explain the main concepts of Xtext, such as validation, code generation, and customizations of runtime and UI aspects. You will have learned how to test a DSL implemented in Xtext with JUnit and will progress to advanced concepts such as type checking and scoping. You will then integrate the typical Continuous Integration systems built in to Xtext DSLs and familiarize yourself with Xbase. By the end of the book, you will manually maintain the EMF model for an Xtext DSL and will see how an Xtext DSL can also be used in IntelliJ. STYLE AND APPROACH A step-by step-tutorial with illustrative examples that will let you master using Xtext and implementing DSLs with its custom language, Xtend. « less
2016
The Pragmatic Programmers classic is back! Freshly updated for modern software development, Pragmatic Unit Testing in Java 8 With JUnit teaches you how to write and run easily maintained unit tests in JUnit with confidence. You'll learn mnemonics to help you know what tests to write, how to remember more » all the boundary conditions, and what the qualities of a good test are. You'll see how unit tests can pay off by allowing you to keep your system code clean, and you'll learn how to handle the stuff that seems too tough to test. Pragmatic Unit Testing in Java 8 With JUnit steps you through all the important unit testing topics. If you've never written a unit test, you'll see screen shots from Eclipse, IntelliJ IDEA, and NetBeans that will help you get past the hard part--getting set up and started. Once past the basics, you'll learn why you want to write unit tests and how to effectively use JUnit. But the meaty part of the book is its collected unit testing wisdom from people who've been there, done that on production systems for at least 15 years: veteran author and developer Jeff Langr, building on the wisdom of Pragmatic Programmers Andy Hunt and Dave Thomas. « less
2015
Over 65 recipes to get you up and running with unit testing using Mockito
ABOUT THIS BOOK * Implement best practices to perform tests with Mockito * Extend Mockito with other popular Java-based unit testing frameworks such as JUnit and Powermock * A focused guide with many recipes on testing your software using Mockito WHO THIS BOOK IS FOR If you are a software developer more » with no testing experience (especially with Mockito) and you want to start using Mockito in the most efficient way then this book is for you. This book assumes that you have a good knowledge level and understanding of Java-based unit testing frameworks. WHAT YOU WILL LEARN * Create beautiful tests using Mockito * Create mocks and spies in a number of ways * Implement best practices to perform tests with Mockito * Extend Mockito with other popular Java-based unit testing frameworks such as JUnit and PowerMock * Stub behavior of mocks and spies * Verify test doubles with Mockito * Write good tests using Mockito * Integrate Mockito with DI systems * Compare Mockito to other mocking frameworks * Verify the behavior of your system under test IN DETAIL Mockito is a testing framework that allows you to easily create test doubles (mocks) of the system under test's collaborators. You can use mocks to better simulate the behavioral patterns of your software in isolation to receive feedback from tests as soon as possible. This book consists of recipes that depict the usage of a vast majority of Mockito functionalities in real-life examples. It goes beyond the documentation and covers how Mockito works and shows the steps to write effective tests using Mockito. This is a focused guide with lots of practical recipes of business issues and presentation of the entire test of the system. This book shows the use of Mockito's popular unit testing frameworks such as JUnit, PowerMock, TestNG, and so on. « less
2014
A practical guide to get you up and running with unit testing using Mockito
ABOUT THIS BOOK * Explore Mockito features and learn stubbing, mocking and spying dependencies using the Mockito framework * Mock external dependencies for legacy and greenfield projects and create an automated JUnit safety net for building reliable, maintainable and testable software * A focused more » guide filled with examples and supporting illustrations on testing your software using Mockito WHO THIS BOOK IS FOR This book is ideal for developers who have some experience in Java application development as well as some basic knowledge of test doubles and JUnit testing. This book also introduces you to the fundamentals of JUnit testing, test doubles, refactoring legacy code, and writing JUnit tests for GWT and web services. WHAT YOU WILL LEARN * Explore test doubles and work with dummy, spy, fake, stub, and mock objects * Uncover the Mockito architecture and build a custom mocking framework * Mock, stub, and spy external code dependencies using Mockito * Practice Behavior-driven Development (BDD) with Mockito * Make legacy code testable by mocking and spying dependencies * Mock GWT and web service dependencies using Mockito * Discover argument captors, inline stubbing, and resetting mock objects IN DETAIL Whether you are new to JUnit testing and mocking or a seasoned Mockito expert, this book will provide you with the skills you need to successfully build and maintain meaningful JUnit test cases and effectively mock external dependencies. At the beginning, this book deals with dummy and fake objects and then moves on to exploring stubs followed by an example on spying. Then, it will show you how to make legacy code testable, mock external dependencies using Mockito, and write testable code for greenfield projects. You will also gain an insight on the concepts of Service-oriented Architecture (SOA) as well as understand how to unit test RESTful web services with Mockito. By sequentially working through the steps in each chapter, you will quickly learn the features of Mockito. Mockito Essentials will ensure your success with these concepts, tools, and frameworks. « less
2014
Build simple scrapers or vast armies of Java-based bots to untangle and capture the Web
Java is often thought of as a stuffy enterprise language, while web scraping is the often-murky domain of scripting languages. By combining the robustness and extensibility of Java with the flexibility and power of web scraping, we can create immensely useful tools that can solve very difficult problems. Instant more » Web Scraping with Java will guide you, step by step, through setting up your Java environment. You will also learn how to write simple web scrapers and distributed networks of crawlers. Throughout the book, we will provide useful tips, out-of-the-box working code, and additional resources to build expert knowledge. Instant Web Scraping with Java will teach how to build your own web scrapers using real-world scraping examples that collect and store data from Wikipedia, public records data sites, IP address geolocation services, and more. You will learn how to run scrapers across multiple servers, run them in parallel, and subvert common methods of anti-scraper security used on modern websites. This book will also provide you with detailed step-by-step instructions, out-of-the-box working code, and expert pointers to further resources on key topics. Instant Web Scraping with Java will show you how to view and collect any Internet data at the speed of your processor! What you will learn from this book * Set up your Java environment and work with the Eclipse IDE * Execute complicated web crawlers that run without intervention * Handle errors, documentation, and writing robust code * Log scraped data for later retrieval and analysis * Write code to test website content and functionality with the JUnit framework * Learn techniques for getting around website security, designed to prevent automated scraping * Fill and submit forms automatically * Use threading to run scrapers in parallel * Use Java’s Remote Machine Invocation to create multi-server distributed scrapers Approach Filled with practical, step-by-step instructions and clear explanations for the most important and useful tasks. This book is full of short, concise recipes to learn a variety of useful web scraping techniques using Java. You will start with a simple basic recipe of setting up your Java environment and gradually learn some more advanced recipes such as using complex Scrapers. Who this book is written for Instant Web Scraping with Java is aimed at developers who, while not necessarily familiar with Java, are at least ready to dive into the complexities of this language with simple, step-by-step instructions leading the way. It is assumed that you have at least an intermediate knowledge of HTML, some knowledge of MySQL, and access to an Internet-connected computer while doing most of the exercises (after all, scraping the Web is difficult if your code can’t get online!) « less
2013
Learn how to apply Test-Driven Development and the Mockito framework in real life projects, using realistic, hands-on examples
Overview * Start writing clean, high quality code to apply Design Patterns and principles * Add new features to your project by applying Test-first development- JUnit 4.0 and Mockito framework * Make legacy code testable and clean up technical debts In Detail The usual life cycle of code involves more » adding code, breaking an existing functionality, fixing that and breaking a new area! This fragility can be fixed using automated tests and Test Driven Development. TDD’s test first approach expedites the development process and unit tests act as safety nets for code refactoring and help in maintaining and extending the code. This makes TDD highly beneficial for new projects. This practical, hands-on guide provides you with a number of clear, step-by-step exercises that will help you to take advantage of the real power that is behind Test Driven Development and the Mockito framework. By using this book, you will gain the knowledge that you need to use the Mockito framework in your project. This book explains the concept of Test Driven Development (TDD), including mocking and refactoring, as well as breaking down the mystery and confusion that surrounds the test first approach of TDD. It will take you through a number of clear, practical examples that will help you to take advantage of TDD with the Mockito framework, quickly and painlessly. You will learn how to write unit tests, refactor code and remove code smells. We will also take a look at mock objects and learn to use Mockito framework to stub, mock, verify and spy objects for testability. You will also learn to write clean, maintainable, and extensible code using design principles and patterns. If you want to take advantage of using Test Driven Development and learn about mocking frameworks, then this is the book for you. You will learn everything you need to know to apply Test Driven Development in a real life project, as well as how to refactor legacy code and write quality code using design patterns. What you will learn from this book * Create your first unit test and discover the power of unit testing * Familiarize yourself with Test-first Development and the refactoring process * Add new features to your project applying Test Driven Development * Create readable, maintainable, and extensible software using design principles and patterns * Start stubbing, mocking, spying, and verifying objects using Mockito APIs * Apply inside-out and outside-in TDD styles * Expedite the development process using Eclipse and keyboard shortcuts * Apply JUnit 4.0 and advanced Mockito features – argument captor, callbacks, and answers Approach This book is a hands-on guide, full of practical examples to illustrate the concepts of Test Driven Development. Who this book is written for If you are a developer who wants to develop software following Test Driven Development using Mockito and leveraging various Mockito features, this book is ideal for you. You don’t need prior knowledge of TDD, Mockito, or JUnit. It is ideal for developers, who have some experience in Java application development as well as a basic knowledge of unit testing, but it covers the basic fundamentals of TDD and JUnit testing to get you acquainted with these concepts before delving into them. « less
2013
Key Elements and Practical Programming
This book presents a guide to the core features of Java – and some more recent innovations – enabling the reader to build skills and confidence though tried-and-trusted stages, supported by exercises that reinforce key learning points. All of the most useful and commonly applied Java syntax and libraries more » are introduced, along with many example programs that can provide the basis for more substantial applications. Use of the Eclipse IDE and the JUnit testing framework is integral to the book, ensuring maximum productivity and code quality, although to ensure that skills are not confined to one environment the fundamentals of the Java compiler and run time are also explained. Additionally, coverage of the Ant tool will equip the reader with the skills to automatically build, test and deploy applications independent of an IDE. Features: presents information on Java 7; contains numerous code examples and exercises; provides source code, self-test questions and PowerPoint slides at an associated website. « less
2012
Developing Java Web Applications
Discover WTP, the New End-to-End Toolset for Java-Based Web Development The Eclipse Web Tools Platform (WTP) seamlessly integrates all the tools today’s Java Web developer needs. WTP is both an unprecedented Open Source resource for working developers and a powerful foundation for state-of-the-art commercial more » products. Eclipse Web Tools Platform offers in-depth descriptions of every tool included in WTP, introducing powerful capabilities never before available in Eclipse. The authors cover the entire Web development process–from defining Web application architectures and development processes through testing and beyond. And if you’re seeking to extend WTP, this book provides an introduction to the platform’s rich APIs. The book also * Presents step-by-step coverage of developing persistence, business logic, and presentation tiers with WTP and Java * Introduces best practices for multiple styles of Web and Java EE development * Demonstrates JDBC database access and configuration * Shows how to configure application servers for use with WTP * Walks through creating Web service application interfaces * Covers automated testing with JUnit and Cactus, and automated builds utilizing Ant, Maven, and CruiseControl * Introduces testing and profiling Web applications with the Eclipse Test and Performance Tools Platform (TPTP) project * Describes how to extend WTP with new servers, file types, and WSDL extensions Foreword Preface Acknowledgments About the Authors Part I: Getting Started Chapter 1: Introduction Chapter 2: About the Eclipse Web Tools Platform Project Chapter 3: Quick Tour Chapter 4: Setting Up Your Workspace Part II: Java Web Application Development Chapter 5: Web Application Architecture and Design Chapter 6: Organizing Your Development Project Chapter 7: The Presentation Tier Chapter 8: The Business Logic Tier Chapter 9: The Persistence Tier Chapter 10: Web Services Chapter 11: Testing Part III: Extending WTP Chapter 12: Adding New Servers Chapter 13: Supporting New File Types Chapter 14: Creating WSDL Extensions Chapter 15: Customizing Resource Resolution Part IV: Products and Plans Chapter 16: Other Web Tools Based on Eclipse Chapter 17: The Road Ahead Glossary References Index This book is an invaluable resource for every Eclipse and enterprise Java Web developer: both those who use Eclipse to build other Web applications, and those who build Eclipse technologies into their own products. Complete source code examples are available at www.eclipsewtp.org. « less
2007