├── .gitattributes ├── .gitignore ├── ch01-jumpstart ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch01 │ │ └── Calculator.java │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── ch01 │ └── CalculatorTest.java ├── ch02-core ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch02 │ │ ├── assertions │ │ ├── Job.java │ │ ├── NoJobException.java │ │ └── SUT.java │ │ ├── assumptions │ │ ├── Job.java │ │ ├── SUT.java │ │ └── environment │ │ │ ├── JavaSpecification.java │ │ │ ├── OperationSystem.java │ │ │ └── TestsEnvironment.java │ │ ├── displayname │ │ └── SUT.java │ │ ├── hamcrest │ │ └── Customer.java │ │ ├── lifecycle │ │ ├── ResourceForAllTests.java │ │ └── SUT.java │ │ ├── nested │ │ ├── Customer.java │ │ └── Gender.java │ │ ├── parametrized │ │ └── WordCounter.java │ │ ├── predicate │ │ └── PositiveNumberPredicate.java │ │ ├── repeated │ │ └── Calculator.java │ │ └── tags │ │ ├── Customer.java │ │ └── CustomersRepository.java │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch02 │ │ ├── assertions │ │ ├── AssertAllTest.java │ │ ├── AssertThrowsTest.java │ │ └── AssertTimeoutTest.java │ │ ├── assumptions │ │ └── AssumptionsTest.java │ │ ├── dependencyinjection │ │ ├── TestInfoTest.java │ │ └── TestReporterTest.java │ │ ├── disabled │ │ ├── DisabledClassTest.java │ │ └── DisabledMethodsTest.java │ │ ├── displayname │ │ └── DisplayNameTest.java │ │ ├── dynamic │ │ └── DynamicTestsTest.java │ │ ├── hamcrest │ │ ├── HamcrestListTest.java │ │ └── HamcrestMatchersTest.java │ │ ├── lifecycle │ │ └── SUTTest.java │ │ ├── nested │ │ └── NestedTestsTest.java │ │ ├── parametrized │ │ ├── ParameterizedWithCsvFileSourceTest.java │ │ ├── ParameterizedWithCsvSourceTest.java │ │ ├── ParameterizedWithEnumSourceTest.java │ │ └── ParameterizedWithValueSourceTest.java │ │ ├── repeated │ │ └── RepeatedTestsTest.java │ │ └── tags │ │ ├── CustomerTest.java │ │ └── CustomersRepositoryTest.java │ └── resources │ └── word_counter.csv ├── ch03-architecture ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch03 │ │ ├── Calculator.java │ │ ├── rules │ │ ├── CustomRule.java │ │ └── CustomStatement.java │ │ └── runners │ │ └── CustomTestRunner.java │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── ch03 │ ├── rules │ ├── CustomRuleTester.java │ ├── CustomRuleTester2.java │ ├── RuleExceptionTester.java │ └── RuleTester.java │ └── runners │ └── CalculatorTest.java ├── ch04-migrating ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch04 │ │ ├── Calculator.java │ │ ├── assumptions │ │ ├── Job.java │ │ ├── SUT.java │ │ └── environment │ │ │ ├── JavaSpecification.java │ │ │ ├── OperationSystem.java │ │ │ └── TestsEnvironment.java │ │ ├── lifecycle │ │ ├── ResourceForAllTests.java │ │ └── SUT.java │ │ └── tags │ │ ├── Customer.java │ │ └── CustomersRepository.java │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── ch04 │ ├── assumptions │ ├── JUnit4AssumptionsTest.java │ └── JUnit5AssumptionsTest.java │ ├── categories │ ├── IndividualTests.java │ ├── JUnit4CustomerTest.java │ ├── JUnit4CustomersRepositoryTest.java │ └── RepositoryTests.java │ ├── extensions │ ├── CustomExtension.java │ └── JUnit5CustomExtensionTester.java │ ├── hamcrest │ ├── JUnit4HamcrestListTest.java │ └── JUnit5HamcrestListTest.java │ ├── lifecycle │ ├── JUnit4SUTTest.java │ └── JUnit5SUTTest.java │ ├── rules │ ├── CustomRule.java │ ├── CustomStatement.java │ ├── JUnit4CustomRuleTester.java │ ├── JUnit4RuleExceptionTester.java │ ├── JUnit4RuleTester.java │ ├── JUnit5ExceptionTester.java │ └── JUnit5TempDirTester.java │ ├── suites │ ├── JUnit4ExcludeRepositoryTestsSuite.java │ ├── JUnit4IndividualTestsSuite.java │ └── JUnit4RepositoryTestsSuite.java │ └── tags │ ├── JUnit5CustomerTest.java │ └── JUnit5CustomersRepositoryTest.java ├── ch06-quality ├── pom.xml ├── reports │ ├── .css │ │ └── coverage.css │ ├── .img │ │ ├── arrowDown.gif │ │ └── arrowUp.gif │ ├── com.manning.junitbook.ch06 │ │ ├── .classes │ │ │ └── Calculator.html │ │ ├── index.html │ │ ├── index_SORT_BY_BLOCK.html │ │ ├── index_SORT_BY_BLOCK_DESC.html │ │ ├── index_SORT_BY_CLASS.html │ │ ├── index_SORT_BY_CLASS_DESC.html │ │ ├── index_SORT_BY_LINE.html │ │ ├── index_SORT_BY_LINE_DESC.html │ │ ├── index_SORT_BY_METHOD.html │ │ ├── index_SORT_BY_METHOD_DESC.html │ │ └── index_SORT_BY_NAME_DESC.html │ ├── com.manning.junitbook │ │ ├── .classes │ │ │ └── Calculator.html │ │ ├── index.html │ │ ├── index_SORT_BY_BLOCK.html │ │ ├── index_SORT_BY_BLOCK_DESC.html │ │ ├── index_SORT_BY_CLASS.html │ │ ├── index_SORT_BY_CLASS_DESC.html │ │ ├── index_SORT_BY_LINE.html │ │ ├── index_SORT_BY_LINE_DESC.html │ │ ├── index_SORT_BY_METHOD.html │ │ ├── index_SORT_BY_METHOD_DESC.html │ │ └── index_SORT_BY_NAME_DESC.html │ ├── index.html │ ├── index_SORT_BY_BLOCK.html │ ├── index_SORT_BY_BLOCK_DESC.html │ ├── index_SORT_BY_CLASS.html │ ├── index_SORT_BY_CLASS_DESC.html │ ├── index_SORT_BY_LINE.html │ ├── index_SORT_BY_LINE_DESC.html │ ├── index_SORT_BY_METHOD.html │ ├── index_SORT_BY_METHOD_DESC.html │ └── index_SORT_BY_NAME_DESC.html └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch06 │ │ └── Calculator.java │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── ch06 │ └── CalculatorTest.java ├── ch07-stubs ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch07 │ │ ├── JettySample.java │ │ ├── StubHttpURLConnection.java │ │ └── WebClient.java │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── ch07 │ ├── TestWebClient.java │ ├── TestWebClient1.java │ └── TestWebClientSkeleton.java ├── ch08-mocks ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch08 │ │ ├── account │ │ ├── Account.java │ │ ├── AccountManager.java │ │ ├── AccountService.java │ │ ├── DefaultAccountManager1.java │ │ └── DefaultAccountManager2.java │ │ ├── configurations │ │ ├── Configuration.java │ │ └── DefaultConfiguration.java │ │ └── web │ │ ├── ConnectionFactory.java │ │ ├── HttpURLConnectionFactory.java │ │ ├── WebClient1.java │ │ └── WebClient2.java │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── ch08 │ ├── account │ ├── MockAccountManager.java │ ├── MockLog.java │ ├── TestAccountService.java │ ├── TestAccountServiceEasyMock.java │ ├── TestAccountServiceJMock.java │ ├── TestAccountServiceMockito.java │ ├── TestDefaultAccountManager.java │ ├── TestDefaultAccountManagerEasyMock.java │ ├── TestDefaultAccountManagerJMock.java │ └── TestDefaultAccountManagerMockito.java │ ├── configurations │ └── MockConfiguration.java │ └── web │ ├── MockConnectionFactory.java │ ├── MockHttpURLConnection.java │ ├── MockInputStream.java │ ├── TestWebClient.java │ ├── TestWebClient1.java │ ├── TestWebClientEasyMock.java │ ├── TestWebClientFail.java │ ├── TestWebClientJMock.java │ ├── TestWebClientMock.java │ └── TestWebClientMockito.java ├── ch09-incontainer ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch09 │ │ ├── airport │ │ ├── Flight.java │ │ └── Passenger.java │ │ └── servlet │ │ └── SampleServlet.java │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch09 │ │ ├── airport │ │ ├── FlightBuilderUtil.java │ │ ├── FlightWithPassengersTest.java │ │ └── producers │ │ │ └── FlightProducer.java │ │ └── servlet │ │ ├── TestSampleServletWithEasyMock.java │ │ ├── TestSampleServletWithJMock.java │ │ └── TestSampleServletWithMockito.java │ └── resources │ └── flights_information.csv ├── ch10-maven-flightsmanagement └── flightsmanagement │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── testeddatasystems │ │ └── flights │ │ └── Passenger.java │ └── test │ └── java │ └── com │ └── testeddatasystems │ └── flights │ └── PassengerTest.java ├── ch10-maven ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch10 │ │ └── App.java │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── ch10 │ └── AppTest.java ├── ch11-gradle-flightsmanagement └── flightsmanagement │ ├── .gitattributes │ ├── .gitignore │ ├── build.gradle │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ ├── main │ └── java │ │ └── com │ │ └── testeddatasystems │ │ └── flights │ │ └── Passenger.java │ └── test │ └── java │ └── com │ └── testeddatasystems │ └── flights │ └── PassengerTest.java ├── ch11-gradle ├── .gitattributes ├── .gitignore ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch11 │ │ ├── App.java │ │ └── tags │ │ ├── Customer.java │ │ └── CustomersRepository.java │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── ch11 │ ├── AppTest.java │ └── tags │ ├── CustomerTest.java │ └── CustomersRepositoryTest.java ├── ch12-ide ├── .css │ └── coverage.css ├── .img │ ├── arrowDown.gif │ └── arrowUp.gif ├── ch12-ide │ ├── index.html │ ├── src_main_java │ │ ├── com.manning.junitbook.ch12.displayname │ │ │ ├── SUT.html │ │ │ ├── SUT.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.lifecycle │ │ │ ├── SUT.html │ │ │ ├── SUT.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.nested │ │ │ ├── Customer$Builder.html │ │ │ ├── Customer.html │ │ │ ├── Customer.java.html │ │ │ ├── Gender.html │ │ │ ├── Gender.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.parametrized │ │ │ ├── WordCounter.html │ │ │ ├── WordCounter.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.predicate │ │ │ ├── PositiveNumberPredicate.html │ │ │ ├── PositiveNumberPredicate.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.repeated │ │ │ ├── Calculator.html │ │ │ ├── Calculator.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.tags │ │ │ ├── Customer.html │ │ │ ├── Customer.java.html │ │ │ ├── CustomersRepository.html │ │ │ ├── CustomersRepository.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ └── index.html │ ├── src_test_java │ │ ├── com.manning.junitbook.ch12.disabled │ │ │ ├── DisabledClassTest.html │ │ │ ├── DisabledClassTest.java.html │ │ │ ├── DisabledMethodsTest.html │ │ │ ├── DisabledMethodsTest.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.displayname │ │ │ ├── DisplayNameTest.html │ │ │ ├── DisplayNameTest.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.dynamic │ │ │ ├── DynamicTestsTest.html │ │ │ ├── DynamicTestsTest.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.nested │ │ │ ├── NestedTestsTest$BuilderTest.html │ │ │ ├── NestedTestsTest$CustomerEqualsTest.html │ │ │ ├── NestedTestsTest$CustomerHashCodeTest.html │ │ │ ├── NestedTestsTest.html │ │ │ ├── NestedTestsTest.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.parametrized │ │ │ ├── ParameterizedWithCsvFileSourceTest.html │ │ │ ├── ParameterizedWithCsvFileSourceTest.java.html │ │ │ ├── ParameterizedWithCsvSourceTest.html │ │ │ ├── ParameterizedWithCsvSourceTest.java.html │ │ │ ├── ParameterizedWithEnumSourceTest$Sentences.html │ │ │ ├── ParameterizedWithEnumSourceTest.html │ │ │ ├── ParameterizedWithEnumSourceTest.java.html │ │ │ ├── ParameterizedWithValueSourceTest.html │ │ │ ├── ParameterizedWithValueSourceTest.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.repeated │ │ │ ├── RepeatedTestsTest.html │ │ │ ├── RepeatedTestsTest.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ ├── com.manning.junitbook.ch12.tags │ │ │ ├── CustomerTest.html │ │ │ ├── CustomerTest.java.html │ │ │ ├── CustomersRepositoryTest.html │ │ │ ├── CustomersRepositoryTest.java.html │ │ │ ├── index.html │ │ │ └── index.source.html │ │ └── index.html │ └── src_test_resources │ │ └── index.html ├── com.manning.junitbook.ch12.displayname │ ├── .classes │ │ └── SUT.html │ ├── index.html │ ├── index_SORT_BY_BLOCK.html │ ├── index_SORT_BY_BLOCK_DESC.html │ ├── index_SORT_BY_CLASS.html │ ├── index_SORT_BY_CLASS_DESC.html │ ├── index_SORT_BY_LINE.html │ ├── index_SORT_BY_LINE_DESC.html │ ├── index_SORT_BY_METHOD.html │ ├── index_SORT_BY_METHOD_DESC.html │ └── index_SORT_BY_NAME_DESC.html ├── com.manning.junitbook.ch12.lifecycle │ ├── .classes │ │ └── SUT.html │ ├── index.html │ ├── index_SORT_BY_BLOCK.html │ ├── index_SORT_BY_BLOCK_DESC.html │ ├── index_SORT_BY_CLASS.html │ ├── index_SORT_BY_CLASS_DESC.html │ ├── index_SORT_BY_LINE.html │ ├── index_SORT_BY_LINE_DESC.html │ ├── index_SORT_BY_METHOD.html │ ├── index_SORT_BY_METHOD_DESC.html │ └── index_SORT_BY_NAME_DESC.html ├── com.manning.junitbook.ch12.nested │ ├── .classes │ │ ├── Customer.html │ │ └── Gender.html │ ├── index.html │ ├── index_SORT_BY_BLOCK.html │ ├── index_SORT_BY_BLOCK_DESC.html │ ├── index_SORT_BY_CLASS.html │ ├── index_SORT_BY_CLASS_DESC.html │ ├── index_SORT_BY_LINE.html │ ├── index_SORT_BY_LINE_DESC.html │ ├── index_SORT_BY_METHOD.html │ ├── index_SORT_BY_METHOD_DESC.html │ └── index_SORT_BY_NAME_DESC.html ├── com.manning.junitbook.ch12.parametrized │ ├── .classes │ │ └── WordCounter.html │ ├── index.html │ ├── index_SORT_BY_BLOCK.html │ ├── index_SORT_BY_BLOCK_DESC.html │ ├── index_SORT_BY_CLASS.html │ ├── index_SORT_BY_CLASS_DESC.html │ ├── index_SORT_BY_LINE.html │ ├── index_SORT_BY_LINE_DESC.html │ ├── index_SORT_BY_METHOD.html │ ├── index_SORT_BY_METHOD_DESC.html │ └── index_SORT_BY_NAME_DESC.html ├── com.manning.junitbook.ch12.predicate │ ├── .classes │ │ └── PositiveNumberPredicate.html │ ├── index.html │ ├── index_SORT_BY_BLOCK.html │ ├── index_SORT_BY_BLOCK_DESC.html │ ├── index_SORT_BY_CLASS.html │ ├── index_SORT_BY_CLASS_DESC.html │ ├── index_SORT_BY_LINE.html │ ├── index_SORT_BY_LINE_DESC.html │ ├── index_SORT_BY_METHOD.html │ ├── index_SORT_BY_METHOD_DESC.html │ └── index_SORT_BY_NAME_DESC.html ├── com.manning.junitbook.ch12.repeated │ ├── .classes │ │ └── Calculator.html │ ├── index.html │ ├── index_SORT_BY_BLOCK.html │ ├── index_SORT_BY_BLOCK_DESC.html │ ├── index_SORT_BY_CLASS.html │ ├── index_SORT_BY_CLASS_DESC.html │ ├── index_SORT_BY_LINE.html │ ├── index_SORT_BY_LINE_DESC.html │ ├── index_SORT_BY_METHOD.html │ ├── index_SORT_BY_METHOD_DESC.html │ └── index_SORT_BY_NAME_DESC.html ├── com.manning.junitbook.ch12.tags │ ├── .classes │ │ ├── Customer.html │ │ └── CustomersRepository.html │ ├── index.html │ ├── index_SORT_BY_BLOCK.html │ ├── index_SORT_BY_BLOCK_DESC.html │ ├── index_SORT_BY_CLASS.html │ ├── index_SORT_BY_CLASS_DESC.html │ ├── index_SORT_BY_LINE.html │ ├── index_SORT_BY_LINE_DESC.html │ ├── index_SORT_BY_METHOD.html │ ├── index_SORT_BY_METHOD_DESC.html │ └── index_SORT_BY_NAME_DESC.html ├── index.html ├── index_SORT_BY_BLOCK.html ├── index_SORT_BY_BLOCK_DESC.html ├── index_SORT_BY_CLASS.html ├── index_SORT_BY_CLASS_DESC.html ├── index_SORT_BY_LINE.html ├── index_SORT_BY_LINE_DESC.html ├── index_SORT_BY_METHOD.html ├── index_SORT_BY_METHOD_DESC.html ├── index_SORT_BY_NAME_DESC.html ├── jacoco-resources │ ├── branchfc.gif │ ├── branchnc.gif │ ├── branchpc.gif │ ├── bundle.gif │ ├── class.gif │ ├── down.gif │ ├── greenbar.gif │ ├── group.gif │ ├── method.gif │ ├── package.gif │ ├── prettify.css │ ├── prettify.js │ ├── redbar.gif │ ├── report.css │ ├── report.gif │ ├── session.gif │ ├── sort.gif │ ├── sort.js │ ├── source.gif │ └── up.gif ├── jacoco-sessions.html ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch12 │ │ ├── displayname │ │ └── SUT.java │ │ ├── lifecycle │ │ └── SUT.java │ │ ├── nested │ │ ├── Customer.java │ │ └── Gender.java │ │ ├── parametrized │ │ └── WordCounter.java │ │ ├── predicate │ │ └── PositiveNumberPredicate.java │ │ ├── repeated │ │ └── Calculator.java │ │ └── tags │ │ ├── Customer.java │ │ └── CustomersRepository.java │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch12 │ │ ├── disabled │ │ ├── DisabledClassTest.java │ │ └── DisabledMethodsTest.java │ │ ├── displayname │ │ └── DisplayNameTest.java │ │ ├── dynamic │ │ └── DynamicTestsTest.java │ │ ├── nested │ │ └── NestedTestsTest.java │ │ ├── parametrized │ │ ├── ParameterizedWithCsvFileSourceTest.java │ │ ├── ParameterizedWithCsvSourceTest.java │ │ ├── ParameterizedWithEnumSourceTest.java │ │ └── ParameterizedWithValueSourceTest.java │ │ ├── repeated │ │ └── RepeatedTestsTest.java │ │ └── tags │ │ ├── CustomerTest.java │ │ └── CustomersRepositoryTest.java │ └── resources │ └── word_counter.csv ├── ch13-continuous ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch13 │ │ ├── flights │ │ └── Flight.java │ │ └── passengers │ │ └── Passenger.java │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch13 │ │ ├── flights │ │ └── FlightTest.java │ │ ├── flightspassengers │ │ └── FlightWithPassengersTest.java │ │ └── passengers │ │ └── PassengerTest.java │ └── resources │ └── word_counter.csv ├── ch14-extensions ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch14 │ │ ├── Passenger.java │ │ └── jdbc │ │ ├── ConnectionManager.java │ │ ├── PassengerDao.java │ │ ├── PassengerDaoImpl.java │ │ ├── PassengerExistsException.java │ │ └── TablesManager.java │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch14 │ │ ├── PassengerTest.java │ │ └── extensions │ │ ├── DataAccessObjectParameterResolver.java │ │ ├── DatabaseOperationsExtension.java │ │ ├── ExecutionContextExtension.java │ │ └── LogPassengerExistsExceptionExtension.java │ └── resources │ ├── context.properties │ └── logger.properties ├── ch15-gui ├── ch15-htmlunit │ ├── pom.xml │ └── src │ │ ├── main │ │ └── webapp │ │ │ ├── formtest.html │ │ │ └── submit.html │ │ └── test │ │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── ch15 │ │ └── htmlunit │ │ ├── FormTest.java │ │ ├── HtmlUnitPageTest.java │ │ ├── InLineHtmlFixtureTest.java │ │ ├── JavadocPageAllBrowserTest.java │ │ ├── ManagedWebClient.java │ │ └── WindowConfirmTest.java └── ch15-selenium │ ├── pom.xml │ └── src │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── ch15 │ ├── browse │ ├── ChromeSeleniumTest.java │ ├── FirefoxSeleniumTest.java │ ├── GoogleSearchTest.java │ ├── MultiBrowserSeleniumTest.java │ └── WikipediaAccessTest.java │ ├── pages │ ├── Homepage.java │ └── LoginPage.java │ └── suite │ └── LoginTest.java ├── ch16-spring ├── ch16-spring-junit4 │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── spring │ │ │ ├── Country.java │ │ │ └── Passenger.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── spring │ │ │ ├── PassengerUtil.java │ │ │ ├── SimpleAppTest.java │ │ │ └── SpringAppTest.java │ │ └── resources │ │ └── application-context.xml ├── ch16-spring-junit5-new-feature │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── spring │ │ │ ├── Country.java │ │ │ ├── Passenger.java │ │ │ ├── PassengerRegistrationEvent.java │ │ │ ├── PassengerRegistrationListener.java │ │ │ └── RegistrationManager.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── spring │ │ │ ├── PassengerUtil.java │ │ │ └── RegistrationTest.java │ │ └── resources │ │ └── application-context.xml ├── ch16-spring-junit5 │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── spring │ │ │ ├── Country.java │ │ │ └── Passenger.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── spring │ │ │ ├── PassengerUtil.java │ │ │ └── SpringAppTest.java │ │ └── resources │ │ └── application-context.xml └── ch16-traditional │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── spring │ │ ├── Country.java │ │ └── Passenger.java │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── spring │ ├── PassengerUtil.java │ └── SimpleAppTest.java ├── ch17-spring-boot ├── ch17-spring-boot-beans │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── manning │ │ │ │ └── junitbook │ │ │ │ └── spring │ │ │ │ ├── Application.java │ │ │ │ ├── model │ │ │ │ ├── Country.java │ │ │ │ └── Passenger.java │ │ │ │ └── registration │ │ │ │ ├── PassengerRegistrationEvent.java │ │ │ │ ├── PassengerRegistrationListener.java │ │ │ │ └── RegistrationManager.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── spring │ │ ├── RegistrationTest.java │ │ └── beans │ │ └── TestBeans.java ├── ch17-spring-boot-initializr-old-feature │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── manning │ │ │ │ └── junitbook │ │ │ │ └── springboot │ │ │ │ ├── Application.java │ │ │ │ ├── model │ │ │ │ ├── Country.java │ │ │ │ └── Passenger.java │ │ │ │ └── registration │ │ │ │ ├── PassengerRegistrationEvent.java │ │ │ │ ├── PassengerRegistrationListener.java │ │ │ │ └── RegistrationManager.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── springboot │ │ │ └── RegistrationTest.java │ │ └── resources │ │ └── application-context.xml ├── ch17-spring-boot-initializr │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── manning │ │ │ │ └── junitbook │ │ │ │ └── springboot │ │ │ │ └── Application.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── springboot │ │ └── ApplicationTests.java └── ch17-spring-boot-new-feature │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── spring │ │ │ ├── Application.java │ │ │ ├── model │ │ │ ├── Country.java │ │ │ ├── Flight.java │ │ │ └── Passenger.java │ │ │ └── registration │ │ │ ├── PassengerRegistrationEvent.java │ │ │ ├── PassengerRegistrationListener.java │ │ │ └── RegistrationManager.java │ └── resources │ │ └── application.properties │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── spring │ │ ├── FlightTest.java │ │ ├── RegistrationTest.java │ │ └── beans │ │ ├── FlightBuilder.java │ │ └── TestBeans.java │ └── resources │ └── flights_information.csv ├── ch18-rest └── ch18-spring-boot-rest │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── Content-Length │ ├── DELETE │ ├── Host │ ├── PATCH │ ├── POST │ ├── PUT │ ├── User-Agent │ ├── curl │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── spring │ │ │ ├── Application.java │ │ │ ├── beans │ │ │ └── FlightBuilder.java │ │ │ ├── exceptions │ │ │ └── PassengerNotFoundException.java │ │ │ ├── model │ │ │ ├── Country.java │ │ │ ├── CountryController.java │ │ │ ├── CountryRepository.java │ │ │ ├── Flight.java │ │ │ ├── Passenger.java │ │ │ ├── PassengerController.java │ │ │ └── PassengerRepository.java │ │ │ └── registration │ │ │ ├── PassengerRegistrationEvent.java │ │ │ ├── PassengerRegistrationListener.java │ │ │ └── RegistrationManager.java │ └── resources │ │ ├── application.properties │ │ ├── countries_information.csv │ │ └── flights_information.csv │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── spring │ ├── FlightTest.java │ └── RestApplicationTest.java ├── ch19-databases ├── hibernate │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── databases │ │ │ └── model │ │ │ └── Country.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── databases │ │ │ └── CountriesHibernateTest.java │ │ └── resources │ │ └── META-INF │ │ └── persistence.xml ├── jdbc │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── databases │ │ │ ├── ConnectionManager.java │ │ │ ├── TablesManager.java │ │ │ ├── dao │ │ │ └── CountryDao.java │ │ │ └── model │ │ │ └── Country.java │ │ └── test │ │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── databases │ │ ├── CountriesDatabaseTest.java │ │ └── CountriesLoader.java ├── spring-hibernate │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── databases │ │ │ └── model │ │ │ └── Country.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── databases │ │ │ ├── CountriesHibernateTest.java │ │ │ └── CountryService.java │ │ └── resources │ │ ├── META-INF │ │ └── persistence.xml │ │ └── application-context.xml └── spring-jdbc │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── databases │ │ ├── dao │ │ ├── CountryDao.java │ │ └── CountryRowMapper.java │ │ └── model │ │ └── Country.java │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── databases │ │ ├── CountriesDatabaseTest.java │ │ └── CountriesLoader.java │ └── resources │ ├── application-context.xml │ └── db-schema.sql ├── ch20-tdd ├── Before │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── airport │ │ ├── Airport.java │ │ ├── Flight.java │ │ └── Passenger.java ├── Phase1 │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── airport │ │ │ ├── Airport.java │ │ │ ├── Flight.java │ │ │ └── Passenger.java │ │ └── test │ │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── airport │ │ └── AirportTest.java ├── Phase2 │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── airport │ │ │ ├── BusinessFlight.java │ │ │ ├── EconomyFlight.java │ │ │ ├── Flight.java │ │ │ └── Passenger.java │ │ └── test │ │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── airport │ │ └── AirportTest.java ├── Phase3 │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── airport │ │ │ ├── BusinessFlight.java │ │ │ ├── EconomyFlight.java │ │ │ ├── Flight.java │ │ │ └── Passenger.java │ │ └── test │ │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── airport │ │ └── AirportTest.java ├── Phase4 │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── airport │ │ │ ├── BusinessFlight.java │ │ │ ├── EconomyFlight.java │ │ │ ├── Flight.java │ │ │ ├── Passenger.java │ │ │ └── PremiumFlight.java │ │ └── test │ │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── airport │ │ └── AirportTest.java └── Phase5 │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── airport │ │ ├── BusinessFlight.java │ │ ├── EconomyFlight.java │ │ ├── Flight.java │ │ ├── Passenger.java │ │ └── PremiumFlight.java │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── airport │ └── AirportTest.java ├── ch21-bdd ├── Phase1 │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── airport │ │ │ ├── BusinessFlight.java │ │ │ ├── EconomyFlight.java │ │ │ ├── Flight.java │ │ │ ├── Passenger.java │ │ │ └── PremiumFlight.java │ │ └── test │ │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── airport │ │ └── AirportTest.java ├── Phase2 │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── airport │ │ │ ├── BusinessFlight.java │ │ │ ├── EconomyFlight.java │ │ │ ├── Flight.java │ │ │ ├── Passenger.java │ │ │ └── PremiumFlight.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── airport │ │ │ ├── CucumberTest.java │ │ │ └── PassengerPolicy.java │ │ └── resources │ │ └── features │ │ └── passenger_policy.feature ├── Phase3 │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ ├── airport │ │ │ ├── BusinessFlight.java │ │ │ ├── EconomyFlight.java │ │ │ ├── Flight.java │ │ │ ├── Passenger.java │ │ │ └── PremiumFlight.java │ │ │ └── mileage │ │ │ └── Mileage.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── airport │ │ │ ├── BonusPolicy.java │ │ │ ├── CucumberTest.java │ │ │ └── PassengerPolicy.java │ │ └── resources │ │ └── features │ │ ├── bonus_policy.feature │ │ └── passenger_policy.feature ├── Phase4 │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── airport │ │ │ ├── BusinessFlight.java │ │ │ ├── EconomyFlight.java │ │ │ ├── Flight.java │ │ │ ├── Passenger.java │ │ │ └── PremiumFlight.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── manning │ │ │ └── junitbook │ │ │ └── airport │ │ │ ├── PassengersPolicy.java │ │ │ └── PassengersPolicyStory.java │ │ └── resources │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── airport │ │ └── passengers_policy_story.story └── Phase5 │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ ├── airport │ │ ├── BusinessFlight.java │ │ ├── EconomyFlight.java │ │ ├── Flight.java │ │ ├── Passenger.java │ │ └── PremiumFlight.java │ │ └── mileage │ │ └── Mileage.java │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── airport │ │ ├── BonusPolicy.java │ │ ├── BonusPolicyStory.java │ │ ├── PassengersPolicy.java │ │ └── PassengersPolicyStory.java │ └── resources │ └── com │ └── manning │ └── junitbook │ └── airport │ ├── bonus_policy_story.story │ └── passengers_policy_story.story └── ch22-testpyramid ├── Phase1 └── airport │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── testpyramid │ │ └── airport │ │ ├── Flight.java │ │ └── Passenger.java │ └── test │ └── java │ └── com │ └── manning │ └── junitbook │ └── testpyramid │ └── airport │ ├── FlightTest.java │ └── PassengerTest.java ├── Phase2 └── airport │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── testpyramid │ │ └── airport │ │ ├── Flight.java │ │ └── Passenger.java │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── testpyramid │ │ └── airport │ │ ├── FlightBuilderUtil.java │ │ ├── FlightTest.java │ │ ├── FlightWithPassengersTest.java │ │ ├── PassengerTest.java │ │ └── producers │ │ └── FlightProducer.java │ └── resources │ └── flights_information.csv ├── Phase3 └── airport │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── testpyramid │ │ └── airport │ │ ├── DistancesManager.java │ │ ├── Flight.java │ │ └── Passenger.java │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── testpyramid │ │ └── airport │ │ ├── FlightBuilderUtil.java │ │ ├── FlightTest.java │ │ ├── FlightWithPassengersTest.java │ │ ├── PassengerTest.java │ │ ├── annotations │ │ └── FlightNumber.java │ │ └── producers │ │ └── FlightProducer.java │ └── resources │ ├── flights_information.csv │ ├── flights_information2.csv │ └── flights_information3.csv ├── Phase4 └── airport │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── testpyramid │ │ └── airport │ │ ├── DistancesManager.java │ │ ├── Flight.java │ │ └── Passenger.java │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── testpyramid │ │ └── airport │ │ ├── FlightBuilderUtil.java │ │ ├── FlightTest.java │ │ ├── FlightWithPassengersTest.java │ │ ├── PassengerTest.java │ │ ├── annotations │ │ └── FlightNumber.java │ │ └── producers │ │ └── FlightProducer.java │ └── resources │ ├── flights_information.csv │ ├── flights_information2.csv │ └── flights_information3.csv ├── Phase5 └── airport │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── manning │ │ └── junitbook │ │ └── testpyramid │ │ └── airport │ │ ├── DistancesManager.java │ │ ├── Flight.java │ │ └── Passenger.java │ └── test │ ├── java │ └── com │ │ └── manning │ │ └── junitbook │ │ └── testpyramid │ │ └── airport │ │ ├── FlightBuilderUtil.java │ │ ├── FlightTest.java │ │ ├── FlightWithPassengersTest.java │ │ ├── PassengerTest.java │ │ ├── annotations │ │ └── FlightNumber.java │ │ └── producers │ │ └── FlightProducer.java │ └── resources │ ├── flights_information.csv │ ├── flights_information2.csv │ └── flights_information3.csv └── Phase6 └── airport ├── pom.xml └── src ├── main └── java │ └── com │ └── manning │ └── junitbook │ └── testpyramid │ └── airport │ ├── DistancesManager.java │ ├── Flight.java │ └── Passenger.java └── test ├── java └── com │ └── manning │ └── junitbook │ └── testpyramid │ └── airport │ ├── CucumberTest.java │ ├── FlightBuilderUtil.java │ ├── FlightTest.java │ ├── FlightWithPassengersTest.java │ ├── PassengerTest.java │ ├── PassengersPolicy.java │ ├── annotations │ └── FlightNumber.java │ └── producers │ └── FlightProducer.java └── resources ├── features └── passengers_policy.feature ├── flights_information.csv ├── flights_information2.csv └── flights_information3.csv /.gitattributes: -------------------------------------------------------------------------------- 1 | # From https://help.github.com/en/articles/configuring-git-to-handle-line-endings 2 | # Set the default behavior, in case people don't have core.autocrlf set. 3 | * text=auto 4 | 5 | # Explicitly declare text files you want to always be normalized and converted 6 | # to native line endings on checkout. 7 | *.c text 8 | *.h text 9 | 10 | # Declare files that will always have CRLF line endings on checkout. 11 | *.sln text eol=crlf 12 | 13 | # Denote all files that are truly binary and should not be modified. 14 | *.png binary 15 | *.jpg binary 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | target 64 | .idea 65 | .settings 66 | .classpath 67 | .project 68 | *.iml 69 | *.ipr 70 | *.iws 71 | .gradle 72 | cch13-continuous/ 73 | 74 | -------------------------------------------------------------------------------- /ch01-jumpstart/src/main/java/com/manning/junitbook/ch01/Calculator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch01; 23 | 24 | public class Calculator { 25 | public double add(double number1, double number2) { 26 | return number1 + number2; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ch01-jumpstart/src/test/java/com/manning/junitbook/ch01/CalculatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.ch01; 22 | 23 | import static org.junit.jupiter.api.Assertions.assertEquals; 24 | 25 | import org.junit.jupiter.api.Test; 26 | 27 | public class CalculatorTest { 28 | 29 | @Test 30 | public void testAdd() { 31 | Calculator calculator = new Calculator(); 32 | double result = calculator.add(10, 50); 33 | assertEquals(60, result, 0); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/assertions/NoJobException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.assertions; 23 | 24 | public class NoJobException extends RuntimeException { 25 | NoJobException(String message) { 26 | super(message); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/assumptions/Job.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.assumptions; 23 | 24 | public class Job { 25 | } 26 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/assumptions/SUT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.assumptions; 23 | 24 | public class SUT { 25 | private Job currentJob; 26 | 27 | public void run(Job currentJob) { 28 | this.currentJob = currentJob; 29 | } 30 | 31 | public boolean hasJobToRun() { 32 | return currentJob != null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/assumptions/environment/JavaSpecification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.assumptions.environment; 23 | 24 | public class JavaSpecification { 25 | private String version; 26 | 27 | public JavaSpecification(String version) { 28 | this.version = version; 29 | } 30 | 31 | String getVersion() { 32 | return version; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/assumptions/environment/OperationSystem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.assumptions.environment; 23 | 24 | public class OperationSystem { 25 | private String name; 26 | private String architecture; 27 | 28 | public OperationSystem(String name, String architecture) { 29 | this.name = name; 30 | this.architecture = architecture; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public String getArchitecture() { 38 | return architecture; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/displayname/SUT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.displayname; 23 | 24 | class SUT { 25 | String hello() { 26 | return "Hello"; 27 | } 28 | 29 | String bye() { 30 | return "Bye"; 31 | } 32 | 33 | String talk() { 34 | return "How are you?"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/hamcrest/Customer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.hamcrest; 23 | 24 | public class Customer { 25 | private String firstName; 26 | private String lastName; 27 | 28 | public Customer(String firstName, String lastName) { 29 | this.firstName = firstName; 30 | this.lastName = lastName; 31 | } 32 | 33 | public String getFirstName() { 34 | return firstName; 35 | } 36 | 37 | public String getLastName() { 38 | return lastName; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/lifecycle/ResourceForAllTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.lifecycle; 23 | 24 | public class ResourceForAllTests { 25 | 26 | private String resourceName; 27 | 28 | public ResourceForAllTests(String resourceName) { 29 | this.resourceName = resourceName; 30 | System.out.println(resourceName + " from class " + getClass().getSimpleName() + " is initializing."); 31 | } 32 | 33 | public void close() { 34 | System.out.println(resourceName + " from class " + getClass().getSimpleName() + " is closing."); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/nested/Gender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.nested; 23 | 24 | public enum Gender { 25 | MALE, FEMALE; 26 | } 27 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/parametrized/WordCounter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.parametrized; 23 | 24 | public class WordCounter { 25 | public int countWords(String sentence) { 26 | return sentence.split(" ").length; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/predicate/PositiveNumberPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.predicate; 23 | 24 | public class PositiveNumberPredicate { 25 | public boolean check(int number) { 26 | return number > 0; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/repeated/Calculator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.repeated; 23 | 24 | public class Calculator { 25 | public double add(double number1, double number2) { 26 | return number1 + number2; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/tags/Customer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.tags; 23 | 24 | public class Customer { 25 | private String name; 26 | 27 | Customer(String name) { 28 | this.name = name; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch02-core/src/main/java/com/manning/junitbook/ch02/tags/CustomersRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.tags; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | 27 | class CustomersRepository { 28 | private List customers = new ArrayList<>(); 29 | 30 | public boolean contains(String name) { 31 | return customers.stream().anyMatch(customer -> customer.getName().equals(name)); 32 | } 33 | 34 | public void persist(Customer customer) { 35 | customers.add(customer); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ch02-core/src/test/java/com/manning/junitbook/ch02/tags/CustomerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch02.tags; 23 | 24 | import org.junit.jupiter.api.Tag; 25 | import org.junit.jupiter.api.Test; 26 | 27 | import static org.junit.jupiter.api.Assertions.assertEquals; 28 | 29 | @Tag("individual") 30 | public class CustomerTest { 31 | private String CUSTOMER_NAME = "John Smith"; 32 | 33 | @Test 34 | void testCustomer() { 35 | Customer customer = new Customer(CUSTOMER_NAME); 36 | 37 | assertEquals("John Smith", customer.getName()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ch02-core/src/test/resources/word_counter.csv: -------------------------------------------------------------------------------- 1 | 2, Unit testing 2 | 3, JUnit in Action 3 | 4, Write solid Java code -------------------------------------------------------------------------------- /ch03-architecture/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 4.0.0 6 | com.manning.junitbook 7 | ch03-architecture 8 | 1.0-SNAPSHOT 9 | 10 | ch03-architecture 11 | 12 | 13 | UTF-8 14 | 1.8 15 | 1.8 16 | 17 | 18 | 19 | 20 | 21 | maven-surefire-plugin 22 | 2.22.2 23 | 24 | 25 | 26 | 27 | 28 | 29 | org.junit.vintage 30 | junit-vintage-engine 31 | 5.6.0 32 | provided 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /ch03-architecture/src/test/java/com/manning/junitbook/ch03/rules/CustomRuleTester.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch03.rules; 23 | 24 | import org.junit.Rule; 25 | import org.junit.Test; 26 | 27 | public class CustomRuleTester { 28 | 29 | @Rule 30 | public CustomRule myRule = new CustomRule(); 31 | 32 | @Test 33 | public void myCustomRuleTest() { 34 | System.out.println("Call of a test method"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ch03-architecture/src/test/java/com/manning/junitbook/ch03/rules/CustomRuleTester2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch03.rules; 23 | 24 | import org.junit.Rule; 25 | import org.junit.Test; 26 | 27 | public class CustomRuleTester2 { 28 | 29 | private CustomRule myRule = new CustomRule(); 30 | 31 | @Rule 32 | public CustomRule getMyRule() { 33 | return myRule; 34 | } 35 | 36 | @Test 37 | public void myCustomRuleTest() { 38 | System.out.println("Call of a test method"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ch03-architecture/src/test/java/com/manning/junitbook/ch03/runners/CalculatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.ch03.runners; 22 | 23 | 24 | import com.manning.junitbook.ch03.Calculator; 25 | import org.junit.Test; 26 | import org.junit.runner.RunWith; 27 | 28 | import static org.junit.Assert.assertEquals; 29 | 30 | @RunWith(CustomTestRunner.class) 31 | public class CalculatorTest { 32 | 33 | @Test 34 | public void testAdd() { 35 | Calculator calculator = new Calculator(); 36 | double result = calculator.add(10, 50); 37 | assertEquals(60, result, 0); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ch04-migrating/src/main/java/com/manning/junitbook/ch04/assumptions/Job.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.assumptions; 23 | 24 | public class Job { 25 | } 26 | -------------------------------------------------------------------------------- /ch04-migrating/src/main/java/com/manning/junitbook/ch04/assumptions/SUT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.assumptions; 23 | 24 | public class SUT { 25 | private Job currentJob; 26 | 27 | public void run(Job currentJob) { 28 | this.currentJob = currentJob; 29 | } 30 | 31 | public boolean hasJobToRun() { 32 | return currentJob != null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch04-migrating/src/main/java/com/manning/junitbook/ch04/assumptions/environment/JavaSpecification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.assumptions.environment; 23 | 24 | public class JavaSpecification { 25 | private String version; 26 | 27 | public JavaSpecification(String version) { 28 | this.version = version; 29 | } 30 | 31 | String getVersion() { 32 | return version; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch04-migrating/src/main/java/com/manning/junitbook/ch04/assumptions/environment/OperationSystem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.assumptions.environment; 23 | 24 | public class OperationSystem { 25 | private String name; 26 | private String architecture; 27 | 28 | public OperationSystem(String name, String architecture) { 29 | this.name = name; 30 | this.architecture = architecture; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public String getArchitecture() { 38 | return architecture; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ch04-migrating/src/main/java/com/manning/junitbook/ch04/lifecycle/ResourceForAllTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.lifecycle; 23 | 24 | public class ResourceForAllTests { 25 | 26 | private String resourceName; 27 | 28 | public ResourceForAllTests(String resourceName) { 29 | this.resourceName = resourceName; 30 | System.out.println(resourceName + " from class " + getClass().getSimpleName() + " is initializing."); 31 | } 32 | 33 | public void close() { 34 | System.out.println(resourceName + " from class " + getClass().getSimpleName() + " is closing."); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ch04-migrating/src/main/java/com/manning/junitbook/ch04/tags/Customer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.tags; 23 | 24 | public class Customer { 25 | private String name; 26 | 27 | public Customer(String name) { 28 | this.name = name; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch04-migrating/src/main/java/com/manning/junitbook/ch04/tags/CustomersRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.tags; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | 27 | public class CustomersRepository { 28 | private List customers = new ArrayList<>(); 29 | 30 | public boolean contains(String name) { 31 | return customers.stream().anyMatch(customer -> customer.getName().equals(name)); 32 | } 33 | 34 | public void persist(Customer customer) { 35 | customers.add(customer); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ch04-migrating/src/test/java/com/manning/junitbook/ch04/categories/IndividualTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.categories; 23 | 24 | public interface IndividualTests { 25 | } 26 | -------------------------------------------------------------------------------- /ch04-migrating/src/test/java/com/manning/junitbook/ch04/categories/RepositoryTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.categories; 23 | 24 | public interface RepositoryTests { 25 | } 26 | -------------------------------------------------------------------------------- /ch04-migrating/src/test/java/com/manning/junitbook/ch04/extensions/JUnit5CustomExtensionTester.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.extensions; 23 | 24 | import org.junit.jupiter.api.Test; 25 | import org.junit.jupiter.api.extension.ExtendWith; 26 | 27 | @ExtendWith(CustomExtension.class) 28 | public class JUnit5CustomExtensionTester { 29 | 30 | @Test 31 | public void myCustomRuleTest() { 32 | System.out.println("Call of a test method"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch04-migrating/src/test/java/com/manning/junitbook/ch04/rules/JUnit4CustomRuleTester.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.rules; 23 | 24 | import org.junit.Rule; 25 | import org.junit.Test; 26 | 27 | public class JUnit4CustomRuleTester { 28 | 29 | @Rule 30 | public CustomRule myRule = new CustomRule(); 31 | 32 | @Test 33 | public void myCustomRuleTest() { 34 | System.out.println("Call of a test method"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ch04-migrating/src/test/java/com/manning/junitbook/ch04/tags/JUnit5CustomerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch04.tags; 23 | 24 | import org.junit.jupiter.api.Tag; 25 | import org.junit.jupiter.api.Test; 26 | 27 | import static org.junit.jupiter.api.Assertions.assertEquals; 28 | 29 | @Tag("individual") 30 | public class JUnit5CustomerTest { 31 | private String CUSTOMER_NAME = "John Smith"; 32 | 33 | @Test 34 | void testCustomer() { 35 | Customer customer = new Customer(CUSTOMER_NAME); 36 | 37 | assertEquals("John Smith", customer.getName()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ch06-quality/reports/.img/arrowDown.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch06-quality/reports/.img/arrowDown.gif -------------------------------------------------------------------------------- /ch06-quality/reports/.img/arrowUp.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch06-quality/reports/.img/arrowUp.gif -------------------------------------------------------------------------------- /ch08-mocks/src/main/java/com/manning/junitbook/ch08/account/AccountManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.ch08.account; 22 | 23 | /** 24 | * An interface for all the manager implementations. 25 | */ 26 | public interface AccountManager { 27 | /** 28 | * A method to find an account by the given userId. 29 | * 30 | * @param userId 31 | * @return 32 | */ 33 | Account findAccountForUser(String userId); 34 | 35 | /** 36 | * A method to update the given accout. 37 | * 38 | * @param account 39 | */ 40 | void updateAccount(Account account); 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /ch08-mocks/src/main/java/com/manning/junitbook/ch08/configurations/Configuration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.ch08.configurations; 22 | 23 | /** 24 | * We add the configuration interface as part of the refactoring process. 25 | */ 26 | public interface Configuration { 27 | /** 28 | * Getter method to get the SQL query to execute. 29 | * 30 | * @return 31 | */ 32 | String getSQL(String sqlString); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /ch08-mocks/src/main/java/com/manning/junitbook/ch08/configurations/DefaultConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.ch08.configurations; 22 | 23 | public class DefaultConfiguration implements Configuration { 24 | 25 | /** 26 | * Constructor. 27 | * 28 | * @param configurationName 29 | */ 30 | public DefaultConfiguration(String configurationName) { 31 | } 32 | 33 | /** 34 | * Getter method to get the sql that we want to execute. 35 | * 36 | * @return 37 | */ 38 | public String getSQL(String sqlString) { 39 | return null; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ch08-mocks/src/main/java/com/manning/junitbook/ch08/web/ConnectionFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.ch08.web; 22 | 23 | import java.io.InputStream; 24 | 25 | /** 26 | * A connection factory interface. Different connection 27 | * factories that we have, must implement this interface. 28 | */ 29 | public interface ConnectionFactory { 30 | /** 31 | * Read the data from the connection. 32 | * 33 | * @return 34 | * @throws Exception 35 | */ 36 | InputStream getData() throws Exception; 37 | } -------------------------------------------------------------------------------- /ch09-incontainer/src/test/java/com/manning/junitbook/ch09/airport/producers/FlightProducer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.ch09.airport.producers; 22 | 23 | import com.manning.junitbook.ch09.airport.Flight; 24 | import com.manning.junitbook.ch09.airport.FlightBuilderUtil; 25 | 26 | import javax.enterprise.inject.Produces; 27 | import java.io.IOException; 28 | 29 | public class FlightProducer { 30 | 31 | @Produces 32 | public Flight createFlight() throws IOException { 33 | return FlightBuilderUtil.buildFlightFromCsv(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ch09-incontainer/src/test/resources/flights_information.csv: -------------------------------------------------------------------------------- 1 | 1236789; John Smith 2 | 9006789; Jane Underwood 3 | 1236790; James Perkins 4 | 9006790; Mary Calderon 5 | 1236791; Noah Graves 6 | 9006791; Jake Chavez 7 | 1236792; Oliver Aguilar 8 | 9006792; Emma McCann 9 | 1236793; Margaret Knight 10 | 9006793; Amelia Curry 11 | 1236794; Jack Vaughn 12 | 9006794; Liam Lewis 13 | 1236795; Olivia Reyes 14 | 9006795; Samantha Poole 15 | 1236796; Patricia Jordan 16 | 9006796; Robert Sherman 17 | 1236797; Mason Burton 18 | 9006797; Harry Christensen 19 | 1236798; Jennifer Mills 20 | 9006798; Sophia Graham 21 | -------------------------------------------------------------------------------- /ch10-maven-flightsmanagement/flightsmanagement/src/test/java/com/testeddatasystems/flights/PassengerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.testeddatasystems.flights; 22 | 23 | import org.junit.jupiter.api.Test; 24 | 25 | import static org.junit.jupiter.api.Assertions.assertEquals; 26 | 27 | public class PassengerTest { 28 | 29 | @Test 30 | void testPassenger() { 31 | Passenger passenger = new Passenger("123-456-789", "John Smith"); 32 | assertEquals("Passenger John Smith with identifier: 123-456-789", passenger.toString()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch10-maven/src/main/java/com/manning/junitbook/ch10/App.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.ch10; 22 | 23 | /** 24 | * Hello world! 25 | */ 26 | public class App { 27 | public static void main(String[] args) { 28 | System.out.println("Hello World!"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ch10-maven/src/test/java/com/manning/junitbook/ch10/AppTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.ch10; 22 | 23 | 24 | import org.junit.jupiter.api.Test; 25 | 26 | import static org.junit.jupiter.api.Assertions.assertTrue; 27 | 28 | /** 29 | * Unit test for simple App. 30 | */ 31 | public class AppTest { 32 | /** 33 | * Rigourous Test :-) 34 | */ 35 | @Test 36 | public void testApp() { 37 | assertTrue(true); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ch11-gradle-flightsmanagement/flightsmanagement/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /ch11-gradle-flightsmanagement/flightsmanagement/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | -------------------------------------------------------------------------------- /ch11-gradle-flightsmanagement/flightsmanagement/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This generated file contains a sample Java project to get you started. 5 | * For more details take a look at the Java Quickstart chapter in the Gradle 6 | * User Manual available at https://docs.gradle.org/5.5.1/userguide/tutorial_java_projects.html 7 | */ 8 | 9 | plugins { 10 | // Apply the java plugin to add support for Java 11 | id 'java' 12 | 13 | // Apply the application plugin to add support for building a CLI application 14 | id 'application' 15 | } 16 | 17 | repositories { 18 | // Use jcenter for resolving dependencies. 19 | // You can declare any Maven/Ivy/file repository here. 20 | jcenter() 21 | } 22 | 23 | dependencies { 24 | // This dependency is used by the application. 25 | implementation 'com.google.guava:guava:27.1-jre' 26 | 27 | // Use JUnit Jupiter API for testing. 28 | testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' 29 | 30 | // Use JUnit Jupiter Engine for testing. 31 | testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0' 32 | } 33 | 34 | application { 35 | // Define the main class for the application 36 | mainClassName = 'com.manning.junitbook.ch11.App' 37 | } 38 | 39 | test { 40 | // Use junit platform for unit tests 41 | useJUnitPlatform { 42 | includeTags 'individual' 43 | excludeTags 'repository' 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ch11-gradle-flightsmanagement/flightsmanagement/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch11-gradle-flightsmanagement/flightsmanagement/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ch11-gradle-flightsmanagement/flightsmanagement/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /ch11-gradle-flightsmanagement/flightsmanagement/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.0.1/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'junit5withgradle' 11 | -------------------------------------------------------------------------------- /ch11-gradle-flightsmanagement/flightsmanagement/src/test/java/com/testeddatasystems/flights/PassengerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.testeddatasystems.flights; 22 | 23 | import org.junit.jupiter.api.Test; 24 | 25 | import static org.junit.jupiter.api.Assertions.assertEquals; 26 | 27 | public class PassengerTest { 28 | 29 | @Test 30 | void testPassenger() { 31 | Passenger passenger = new Passenger("123-456-789", "John Smith"); 32 | assertEquals("Passenger John Smith with identifier: 123-456-789", passenger.toString()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch11-gradle/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /ch11-gradle/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | -------------------------------------------------------------------------------- /ch11-gradle/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This generated file contains a sample Java project to get you started. 5 | * For more details take a look at the Java Quickstart chapter in the Gradle 6 | * User Manual available at https://docs.gradle.org/5.5.1/userguide/tutorial_java_projects.html 7 | */ 8 | 9 | plugins { 10 | // Apply the java plugin to add support for Java 11 | id 'java' 12 | 13 | // Apply the application plugin to add support for building a CLI application 14 | id 'application' 15 | } 16 | 17 | repositories { 18 | // Use jcenter for resolving dependencies. 19 | // You can declare any Maven/Ivy/file repository here. 20 | jcenter() 21 | } 22 | 23 | dependencies { 24 | // This dependency is used by the application. 25 | implementation 'com.google.guava:guava:27.1-jre' 26 | 27 | // Use JUnit Jupiter API for testing. 28 | testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' 29 | 30 | // Use JUnit Jupiter Engine for testing. 31 | testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0' 32 | } 33 | 34 | application { 35 | // Define the main class for the application 36 | mainClassName = 'com.manning.junitbook.ch11.App' 37 | } 38 | 39 | test { 40 | // Use junit platform for unit tests 41 | useJUnitPlatform { 42 | includeTags 'individual' 43 | excludeTags 'repository' 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ch11-gradle/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch11-gradle/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ch11-gradle/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /ch11-gradle/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.0.1/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'junit5withgradle' 11 | -------------------------------------------------------------------------------- /ch11-gradle/src/main/java/com/manning/junitbook/ch11/App.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This Java source file was generated by the Gradle 'init' task. 3 | */ 4 | package com.manning.junitbook.ch11; 5 | 6 | public class App { 7 | public String getGreeting() { 8 | return "Hello world."; 9 | } 10 | 11 | public static void main(String[] args) { 12 | System.out.println(new App().getGreeting()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ch11-gradle/src/main/java/com/manning/junitbook/ch11/tags/Customer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch11.tags; 23 | 24 | public class Customer { 25 | private String name; 26 | 27 | Customer(String name) { 28 | this.name = name; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch11-gradle/src/main/java/com/manning/junitbook/ch11/tags/CustomersRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch11.tags; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | 27 | class CustomersRepository { 28 | private List customers = new ArrayList<>(); 29 | 30 | public boolean contains(String name) { 31 | return customers.stream().anyMatch(customer -> customer.getName().equals(name)); 32 | } 33 | 34 | public void persist(Customer customer) { 35 | customers.add(customer); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ch11-gradle/src/test/java/com/manning/junitbook/ch11/AppTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This Java source file was generated by the Gradle 'init' task. 3 | */ 4 | package com.manning.junitbook.ch11; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static org.junit.jupiter.api.Assertions.*; 9 | 10 | class AppTest { 11 | @Test 12 | void appHasAGreeting() { 13 | App classUnderTest = new App(); 14 | assertNotNull(classUnderTest.getGreeting(), "app should have a greeting"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ch11-gradle/src/test/java/com/manning/junitbook/ch11/tags/CustomerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch11.tags; 23 | 24 | import com.manning.junitbook.ch11.tags.Customer; 25 | import org.junit.jupiter.api.Tag; 26 | import org.junit.jupiter.api.Test; 27 | 28 | import static org.junit.jupiter.api.Assertions.assertEquals; 29 | 30 | @Tag("individual") 31 | public class CustomerTest { 32 | private String CUSTOMER_NAME = "John Smith"; 33 | 34 | @Test 35 | void testCustomer() { 36 | Customer customer = new Customer(CUSTOMER_NAME); 37 | 38 | assertEquals("John Smith", customer.getName()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ch12-ide/.img/arrowDown.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/.img/arrowDown.gif -------------------------------------------------------------------------------- /ch12-ide/.img/arrowUp.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/.img/arrowUp.gif -------------------------------------------------------------------------------- /ch12-ide/ch12-ide/src_test_resources/index.html: -------------------------------------------------------------------------------- 1 | src/test/resources

src/test/resources

No class files specified.

-------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/branchfc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/branchfc.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/branchnc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/branchnc.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/branchpc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/branchpc.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/bundle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/bundle.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/class.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/class.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/down.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/down.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/greenbar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/greenbar.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/group.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/group.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/method.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/method.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/package.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/package.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/prettify.css: -------------------------------------------------------------------------------- 1 | /* Pretty printing styles. Used with prettify.js. */ 2 | 3 | .str { color: #2A00FF; } 4 | .kwd { color: #7F0055; font-weight:bold; } 5 | .com { color: #3F5FBF; } 6 | .typ { color: #606; } 7 | .lit { color: #066; } 8 | .pun { color: #660; } 9 | .pln { color: #000; } 10 | .tag { color: #008; } 11 | .atn { color: #606; } 12 | .atv { color: #080; } 13 | .dec { color: #606; } 14 | -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/redbar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/redbar.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/report.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/report.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/session.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/session.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/sort.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/sort.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/source.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/source.gif -------------------------------------------------------------------------------- /ch12-ide/jacoco-resources/up.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch12-ide/jacoco-resources/up.gif -------------------------------------------------------------------------------- /ch12-ide/src/main/java/com/manning/junitbook/ch12/displayname/SUT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch12.displayname; 23 | 24 | class SUT { 25 | String hello() { 26 | return "Hello"; 27 | } 28 | 29 | String bye() { 30 | return "Bye"; 31 | } 32 | 33 | String talk() { 34 | return "How are you?"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ch12-ide/src/main/java/com/manning/junitbook/ch12/nested/Gender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch12.nested; 23 | 24 | public enum Gender { 25 | MALE, FEMALE; 26 | } 27 | -------------------------------------------------------------------------------- /ch12-ide/src/main/java/com/manning/junitbook/ch12/parametrized/WordCounter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch12.parametrized; 23 | 24 | public class WordCounter { 25 | public int countWords(String sentence) { 26 | return sentence.split(" ").length; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ch12-ide/src/main/java/com/manning/junitbook/ch12/predicate/PositiveNumberPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch12.predicate; 23 | 24 | public class PositiveNumberPredicate { 25 | public boolean check(int number) { 26 | return number > 0; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ch12-ide/src/main/java/com/manning/junitbook/ch12/repeated/Calculator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch12.repeated; 23 | 24 | public class Calculator { 25 | public double add(double number1, double number2) { 26 | return number1 + number2; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ch12-ide/src/main/java/com/manning/junitbook/ch12/tags/Customer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch12.tags; 23 | 24 | public class Customer { 25 | private String name; 26 | 27 | Customer(String name) { 28 | this.name = name; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch12-ide/src/main/java/com/manning/junitbook/ch12/tags/CustomersRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.ch12.tags; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | 27 | class CustomersRepository { 28 | private List customers = new ArrayList<>(); 29 | 30 | public boolean contains(String name) { 31 | return customers.stream().anyMatch(customer -> customer.getName().equals(name)); 32 | } 33 | 34 | public void persist(Customer customer) { 35 | customers.add(customer); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ch12-ide/src/test/resources/word_counter.csv: -------------------------------------------------------------------------------- 1 | 2, Unit testing 2 | 3, JUnit in Action 3 | 4, Write solid Java code -------------------------------------------------------------------------------- /ch13-continuous/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 4.0.0 6 | com.manning.junitbook 7 | ch13-continuous 8 | 1.0-SNAPSHOT 9 | 10 | ch13-continuous 11 | 12 | 13 | UTF-8 14 | 1.8 15 | 1.8 16 | 17 | 18 | 19 | 20 | 21 | maven-surefire-plugin 22 | 2.22.2 23 | 24 | 25 | 26 | 27 | 28 | 29 | org.junit.jupiter 30 | junit-jupiter-api 31 | 5.6.0 32 | test 33 | 34 | 35 | org.junit.jupiter 36 | junit-jupiter-engine 37 | 5.6.0 38 | test 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ch13-continuous/src/test/resources/word_counter.csv: -------------------------------------------------------------------------------- 1 | 2, Unit testing 2 | 3, JUnit in Action 3 | 4, Write solid Java code -------------------------------------------------------------------------------- /ch14-extensions/src/main/java/com/manning/junitbook/ch14/jdbc/PassengerDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.ch14.jdbc; 22 | 23 | import com.manning.junitbook.ch14.Passenger; 24 | 25 | public interface PassengerDao { 26 | public void insert(Passenger passenger) throws PassengerExistsException; 27 | public void update(String id, String name); 28 | public void delete(Passenger passenger); 29 | public Passenger getById(String id); 30 | } 31 | -------------------------------------------------------------------------------- /ch14-extensions/src/main/java/com/manning/junitbook/ch14/jdbc/PassengerExistsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.ch14.jdbc; 22 | 23 | import com.manning.junitbook.ch14.Passenger; 24 | 25 | public class PassengerExistsException extends Exception { 26 | private Passenger passenger; 27 | 28 | public PassengerExistsException(Passenger passenger, String message) { 29 | super(message); 30 | this.passenger = passenger; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ch14-extensions/src/test/resources/context.properties: -------------------------------------------------------------------------------- 1 | context=regular -------------------------------------------------------------------------------- /ch14-extensions/src/test/resources/logger.properties: -------------------------------------------------------------------------------- 1 | handlers=java.util.logging.ConsoleHandler 2 | .level=ALL 3 | 4 | java.util.logging.ConsoleHandler.level=FINE 5 | -------------------------------------------------------------------------------- /ch15-gui/ch15-htmlunit/src/main/webapp/formtest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | Form Test 17 | 18 |
19 | Value: 20 | 21 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /ch15-gui/ch15-htmlunit/src/main/webapp/submit.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Result 7 | 8 | 9 | 10 | Result 11 | 12 | 13 | -------------------------------------------------------------------------------- /ch16-spring/ch16-spring-junit4/src/test/java/com/manning/junitbook/spring/PassengerUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.spring; 22 | 23 | public class PassengerUtil { 24 | 25 | public static Passenger getExpectedPassenger() { 26 | Passenger passenger = new Passenger("John Smith"); 27 | 28 | Country country = new Country("USA", "US"); 29 | passenger.setCountry(country); 30 | 31 | return passenger; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ch16-spring/ch16-spring-junit4/src/test/resources/application-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ch16-spring/ch16-spring-junit5-new-feature/src/test/java/com/manning/junitbook/spring/PassengerUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.spring; 22 | 23 | public class PassengerUtil { 24 | 25 | public static Passenger getExpectedPassenger() { 26 | Passenger passenger = new Passenger("John Smith"); 27 | 28 | Country country = new Country("USA", "US"); 29 | 30 | passenger.setCountry(country); 31 | 32 | return passenger; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch16-spring/ch16-spring-junit5-new-feature/src/test/resources/application-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ch16-spring/ch16-spring-junit5/src/test/java/com/manning/junitbook/spring/PassengerUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.spring; 22 | 23 | public class PassengerUtil { 24 | 25 | public static Passenger getExpectedPassenger() { 26 | Passenger passenger = new Passenger("John Smith"); 27 | 28 | Country country = new Country("USA", "US"); 29 | 30 | passenger.setCountry(country); 31 | 32 | return passenger; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ch16-spring/ch16-spring-junit5/src/test/resources/application-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ch16-spring/ch16-traditional/pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | com.manning.junitbook 7 | spring 8 | jar 9 | 1.0-SNAPSHOT 10 | 11 | UTF-8 12 | 1.8 13 | 1.8 14 | 15 | 16 | 17 | 18 | 19 | maven-surefire-plugin 20 | 2.22.2 21 | 22 | 23 | 24 | 25 | spring 26 | http://maven.apache.org 27 | 28 | 29 | 30 | org.junit.jupiter 31 | junit-jupiter-api 32 | 5.6.0 33 | test 34 | 35 | 36 | org.junit.jupiter 37 | junit-jupiter-engine 38 | 5.6.0 39 | test 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ch16-spring/ch16-traditional/src/main/java/com/manning/junitbook/spring/Country.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.spring; 22 | 23 | public class Country { 24 | private String name; 25 | private String codeName; 26 | 27 | public Country(String name, String codeName) { 28 | this.name = name; 29 | this.codeName = codeName; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public String getCodeName() { 37 | return codeName; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ch16-spring/ch16-traditional/src/main/java/com/manning/junitbook/spring/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.spring; 22 | 23 | public class Passenger { 24 | private String name; 25 | private Country country; 26 | 27 | public Passenger(String name) { 28 | this.name = name; 29 | this.country = new Country("USA", "US"); 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public Country getCountry() { 37 | return country; 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /ch16-spring/ch16-traditional/src/test/java/com/manning/junitbook/spring/PassengerUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.spring; 22 | 23 | public class PassengerUtil { 24 | 25 | public static Passenger getExpectedPassenger() { 26 | Passenger passenger = new Passenger("John Smith"); 27 | 28 | return passenger; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-beans/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-beans/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch17-spring-boot/ch17-spring-boot-beans/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-beans/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-beans/src/main/java/com/manning/junitbook/spring/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.spring; 22 | 23 | import org.springframework.boot.SpringApplication; 24 | import org.springframework.boot.autoconfigure.SpringBootApplication; 25 | 26 | @SpringBootApplication 27 | public class Application { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(Application.class, args); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-beans/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr-old-feature/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr-old-feature/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch17-spring-boot/ch17-spring-boot-initializr-old-feature/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr-old-feature/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr-old-feature/src/main/java/com/manning/junitbook/springboot/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.springboot; 22 | 23 | import org.springframework.boot.SpringApplication; 24 | import org.springframework.boot.autoconfigure.SpringBootApplication; 25 | 26 | @SpringBootApplication 27 | public class Application { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(Application.class, args); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr-old-feature/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr-old-feature/src/test/resources/application-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch17-spring-boot/ch17-spring-boot-initializr/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr/src/main/java/com/manning/junitbook/springboot/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.springboot; 22 | 23 | import org.springframework.boot.SpringApplication; 24 | import org.springframework.boot.autoconfigure.SpringBootApplication; 25 | 26 | @SpringBootApplication 27 | public class Application { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(Application.class, args); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-initializr/src/test/java/com/manning/junitbook/springboot/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.springboot; 22 | 23 | import org.junit.jupiter.api.Test; 24 | import org.springframework.boot.test.context.SpringBootTest; 25 | 26 | @SpringBootTest 27 | class ApplicationTests { 28 | 29 | @Test 30 | void contextLoads() { 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-new-feature/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-new-feature/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch17-spring-boot/ch17-spring-boot-new-feature/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-new-feature/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-new-feature/src/main/java/com/manning/junitbook/spring/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.spring; 22 | 23 | import org.springframework.boot.SpringApplication; 24 | import org.springframework.boot.autoconfigure.SpringBootApplication; 25 | 26 | @SpringBootApplication 27 | public class Application { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(Application.class, args); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-new-feature/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ch17-spring-boot/ch17-spring-boot-new-feature/src/test/resources/flights_information.csv: -------------------------------------------------------------------------------- 1 | John Smith; UK 2 | Jane Underwood; AU 3 | James Perkins; US 4 | Mary Calderon; US 5 | Noah Graves; UK 6 | Jake Chavez; AU 7 | Oliver Aguilar; US 8 | Emma McCann; AU 9 | Margaret Knight; US 10 | Amelia Curry; UK 11 | Jack Vaughn; US 12 | Liam Lewis; AU 13 | Olivia Reyes; US 14 | Samantha Poole; AU 15 | Patricia Jordan; UK 16 | Robert Sherman; US 17 | Mason Burton; AU 18 | Harry Christensen; UK 19 | Jennifer Mills; US 20 | Sophia Graham; UK 21 | -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch18-rest/ch18-spring-boot-rest/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/Content-Length: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch18-rest/ch18-spring-boot-rest/Content-Length -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/DELETE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch18-rest/ch18-spring-boot-rest/DELETE -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/Host: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch18-rest/ch18-spring-boot-rest/Host -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/PATCH: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch18-rest/ch18-spring-boot-rest/PATCH -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/POST: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch18-rest/ch18-spring-boot-rest/POST -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/PUT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch18-rest/ch18-spring-boot-rest/PUT -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/User-Agent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch18-rest/ch18-spring-boot-rest/User-Agent -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/curl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctudose/junit-in-action-third-edition/c3eae0cf41f43ea070f51c7bf37f1010e2b5bb10/ch18-rest/ch18-spring-boot-rest/curl -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/src/main/java/com/manning/junitbook/spring/exceptions/PassengerNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.spring.exceptions; 23 | 24 | public class PassengerNotFoundException extends RuntimeException { 25 | 26 | public PassengerNotFoundException(Long id) { 27 | super("Passenger id not found : " + id); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/src/main/java/com/manning/junitbook/spring/model/CountryController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.spring.model; 22 | 23 | import org.springframework.beans.factory.annotation.Autowired; 24 | import org.springframework.web.bind.annotation.*; 25 | 26 | import java.util.List; 27 | 28 | @RestController 29 | public class CountryController { 30 | 31 | @Autowired 32 | private CountryRepository repository; 33 | 34 | @GetMapping("/countries") 35 | List findAll() { 36 | return repository.findAll(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/src/main/java/com/manning/junitbook/spring/model/CountryRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.spring.model; 22 | 23 | import org.springframework.data.jpa.repository.JpaRepository; 24 | 25 | public interface CountryRepository extends JpaRepository { 26 | } 27 | -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/src/main/java/com/manning/junitbook/spring/model/PassengerRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.spring.model; 22 | 23 | import org.springframework.data.jpa.repository.JpaRepository; 24 | 25 | public interface PassengerRepository extends JpaRepository { 26 | } 27 | -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8081 2 | 3 | -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/src/main/resources/countries_information.csv: -------------------------------------------------------------------------------- 1 | Australia; AU 2 | USA; US 3 | United Kingdom; UK -------------------------------------------------------------------------------- /ch18-rest/ch18-spring-boot-rest/src/main/resources/flights_information.csv: -------------------------------------------------------------------------------- 1 | John Smith; UK 2 | Jane Underwood; AU 3 | James Perkins; US 4 | Mary Calderon; US 5 | Noah Graves; UK 6 | Jake Chavez; AU 7 | Oliver Aguilar; US 8 | Emma Mccann; AU 9 | Margaret Knight; US 10 | Amelia Curry; UK 11 | Jack Vaughn; US 12 | Liam Lewis; AU 13 | Olivia Reyes; US 14 | Samantha Poole; AU 15 | Patricia Jordan; UK 16 | Robert Sherman; US 17 | Mason Burton; AU 18 | Harry Christensen; UK 19 | Jennifer Mills; US 20 | Sophia Graham; UK 21 | -------------------------------------------------------------------------------- /ch19-databases/hibernate/src/test/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | org.hibernate.jpa.HibernatePersistenceProvider 8 | 9 | com.manning.junitbook.databases.model.Country 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ch19-databases/spring-hibernate/src/test/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | org.hibernate.jpa.HibernatePersistenceProvider 8 | com.manning.junitbook.databases.model.Country 9 | 10 | 11 | -------------------------------------------------------------------------------- /ch19-databases/spring-jdbc/src/test/resources/application-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ch19-databases/spring-jdbc/src/test/resources/db-schema.sql: -------------------------------------------------------------------------------- 1 | create table country( id identity , name varchar (255) , code_name varchar (255) ); -------------------------------------------------------------------------------- /ch20-tdd/Before/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.manning.junitbook 6 | ch20-tdd 7 | jar 8 | 1.0-SNAPSHOT 9 | ch20-tdd 10 | http://maven.apache.org 11 | 12 | 13 | 14 | 15 | maven-compiler-plugin 16 | 3.7.0 17 | 18 | 1.8 19 | 1.8 20 | 21 | 22 | 23 | maven-surefire-plugin 24 | 2.22.2 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ch20-tdd/Before/src/main/java/com/manning/junitbook/airport/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class Passenger { 24 | 25 | private String name; 26 | private boolean vip; 27 | 28 | public Passenger(String name, boolean vip) { 29 | this.name = name; 30 | this.vip = vip; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public boolean isVip() { 38 | return vip; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ch20-tdd/Phase1/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.manning.junitbook 6 | ch20-tdd 7 | jar 8 | 1.0-SNAPSHOT 9 | ch20-tdd 10 | http://maven.apache.org 11 | 12 | 13 | 14 | 15 | maven-compiler-plugin 16 | 3.7.0 17 | 18 | 1.8 19 | 1.8 20 | 21 | 22 | 23 | maven-surefire-plugin 24 | 2.22.2 25 | 26 | 27 | 28 | 29 | 30 | 31 | org.junit.jupiter 32 | junit-jupiter-api 33 | 5.6.0 34 | test 35 | 36 | 37 | org.junit.jupiter 38 | junit-jupiter-engine 39 | 5.6.0 40 | test 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ch20-tdd/Phase1/src/main/java/com/manning/junitbook/airport/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class Passenger { 24 | 25 | private String name; 26 | private boolean vip; 27 | 28 | public Passenger(String name, boolean vip) { 29 | this.name = name; 30 | this.vip = vip; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public boolean isVip() { 38 | return vip; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ch20-tdd/Phase2/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.manning.junitbook 6 | ch20-tdd 7 | jar 8 | 1.0-SNAPSHOT 9 | ch20-tdd 10 | http://maven.apache.org 11 | 12 | 13 | 14 | 15 | maven-compiler-plugin 16 | 3.7.0 17 | 18 | 1.8 19 | 1.8 20 | 21 | 22 | 23 | maven-surefire-plugin 24 | 2.22.2 25 | 26 | 27 | 28 | 29 | 30 | 31 | org.junit.jupiter 32 | junit-jupiter-api 33 | 5.6.0 34 | test 35 | 36 | 37 | org.junit.jupiter 38 | junit-jupiter-engine 39 | 5.6.0 40 | test 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ch20-tdd/Phase2/src/main/java/com/manning/junitbook/airport/BusinessFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class BusinessFlight extends Flight { 24 | 25 | public BusinessFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | if (passenger.isVip()) { 32 | return passengers.add(passenger); 33 | } 34 | return false; 35 | } 36 | 37 | @Override 38 | public boolean removePassenger(Passenger passenger) { 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch20-tdd/Phase2/src/main/java/com/manning/junitbook/airport/EconomyFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class EconomyFlight extends Flight { 24 | 25 | public EconomyFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | return passengers.add(passenger); 32 | } 33 | 34 | @Override 35 | public boolean removePassenger(Passenger passenger) { 36 | if (!passenger.isVip()) { 37 | return passengers.remove(passenger); 38 | } 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch20-tdd/Phase2/src/main/java/com/manning/junitbook/airport/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class Passenger { 24 | 25 | private String name; 26 | private boolean vip; 27 | 28 | public Passenger(String name, boolean vip) { 29 | this.name = name; 30 | this.vip = vip; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public boolean isVip() { 38 | return vip; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ch20-tdd/Phase3/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.manning.junitbook 6 | ch20-tdd 7 | jar 8 | 1.0-SNAPSHOT 9 | ch20-tdd 10 | http://maven.apache.org 11 | 12 | 13 | 14 | 15 | maven-compiler-plugin 16 | 3.7.0 17 | 18 | 1.8 19 | 1.8 20 | 21 | 22 | 23 | maven-surefire-plugin 24 | 2.22.2 25 | 26 | 27 | 28 | 29 | 30 | 31 | org.junit.jupiter 32 | junit-jupiter-api 33 | 5.6.0 34 | test 35 | 36 | 37 | org.junit.jupiter 38 | junit-jupiter-engine 39 | 5.6.0 40 | test 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ch20-tdd/Phase3/src/main/java/com/manning/junitbook/airport/BusinessFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class BusinessFlight extends Flight { 24 | 25 | public BusinessFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | if (passenger.isVip()) { 32 | return passengers.add(passenger); 33 | } 34 | return false; 35 | } 36 | 37 | @Override 38 | public boolean removePassenger(Passenger passenger) { 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch20-tdd/Phase3/src/main/java/com/manning/junitbook/airport/EconomyFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class EconomyFlight extends Flight { 24 | 25 | public EconomyFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | return passengers.add(passenger); 32 | } 33 | 34 | @Override 35 | public boolean removePassenger(Passenger passenger) { 36 | if (!passenger.isVip()) { 37 | return passengers.remove(passenger); 38 | } 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch20-tdd/Phase3/src/main/java/com/manning/junitbook/airport/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class Passenger { 24 | 25 | private String name; 26 | private boolean vip; 27 | 28 | public Passenger(String name, boolean vip) { 29 | this.name = name; 30 | this.vip = vip; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public boolean isVip() { 38 | return vip; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ch20-tdd/Phase4/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.manning.junitbook 6 | ch20-tdd 7 | jar 8 | 1.0-SNAPSHOT 9 | ch20-tdd 10 | http://maven.apache.org 11 | 12 | 13 | 14 | 15 | maven-compiler-plugin 16 | 3.7.0 17 | 18 | 1.8 19 | 1.8 20 | 21 | 22 | 23 | maven-surefire-plugin 24 | 2.22.2 25 | 26 | 27 | 28 | 29 | 30 | 31 | org.junit.jupiter 32 | junit-jupiter-api 33 | 5.6.0 34 | test 35 | 36 | 37 | org.junit.jupiter 38 | junit-jupiter-engine 39 | 5.6.0 40 | test 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ch20-tdd/Phase4/src/main/java/com/manning/junitbook/airport/BusinessFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class BusinessFlight extends Flight { 24 | 25 | public BusinessFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | if (passenger.isVip()) { 32 | return passengers.add(passenger); 33 | } 34 | return false; 35 | } 36 | 37 | @Override 38 | public boolean removePassenger(Passenger passenger) { 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch20-tdd/Phase4/src/main/java/com/manning/junitbook/airport/EconomyFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class EconomyFlight extends Flight { 24 | 25 | public EconomyFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | return passengers.add(passenger); 32 | } 33 | 34 | @Override 35 | public boolean removePassenger(Passenger passenger) { 36 | if (!passenger.isVip()) { 37 | return passengers.remove(passenger); 38 | } 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch20-tdd/Phase4/src/main/java/com/manning/junitbook/airport/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class Passenger { 24 | 25 | private String name; 26 | private boolean vip; 27 | 28 | public Passenger(String name, boolean vip) { 29 | this.name = name; 30 | this.vip = vip; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public boolean isVip() { 38 | return vip; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ch20-tdd/Phase5/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.manning.junitbook 6 | ch20-tdd 7 | jar 8 | 1.0-SNAPSHOT 9 | ch20-tdd 10 | http://maven.apache.org 11 | 12 | 13 | 14 | 15 | maven-compiler-plugin 16 | 3.7.0 17 | 18 | 1.8 19 | 1.8 20 | 21 | 22 | 23 | maven-surefire-plugin 24 | 2.22.2 25 | 26 | 27 | 28 | 29 | 30 | 31 | org.junit.jupiter 32 | junit-jupiter-api 33 | 5.6.0 34 | test 35 | 36 | 37 | org.junit.jupiter 38 | junit-jupiter-engine 39 | 5.6.0 40 | test 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ch20-tdd/Phase5/src/main/java/com/manning/junitbook/airport/BusinessFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class BusinessFlight extends Flight { 24 | 25 | public BusinessFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | if (passenger.isVip()) { 32 | return passengers.add(passenger); 33 | } 34 | return false; 35 | } 36 | 37 | @Override 38 | public boolean removePassenger(Passenger passenger) { 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch20-tdd/Phase5/src/main/java/com/manning/junitbook/airport/EconomyFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class EconomyFlight extends Flight { 24 | 25 | public EconomyFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | return passengers.add(passenger); 32 | } 33 | 34 | @Override 35 | public boolean removePassenger(Passenger passenger) { 36 | if (!passenger.isVip()) { 37 | return passengers.remove(passenger); 38 | } 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch20-tdd/Phase5/src/main/java/com/manning/junitbook/airport/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class Passenger { 24 | 25 | private String name; 26 | private boolean vip; 27 | 28 | public Passenger(String name, boolean vip) { 29 | this.name = name; 30 | this.vip = vip; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public boolean isVip() { 38 | return vip; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ch21-bdd/Phase1/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.manning.junitbook 6 | ch21-bdd 7 | jar 8 | 1.0-SNAPSHOT 9 | ch21-bdd 10 | http://maven.apache.org 11 | 12 | 13 | 14 | 15 | maven-compiler-plugin 16 | 3.7.0 17 | 18 | 1.8 19 | 1.8 20 | 21 | 22 | 23 | maven-surefire-plugin 24 | 2.22.2 25 | 26 | 27 | 28 | 29 | 30 | 31 | org.junit.jupiter 32 | junit-jupiter-api 33 | 5.6.0 34 | test 35 | 36 | 37 | org.junit.jupiter 38 | junit-jupiter-engine 39 | 5.6.0 40 | test 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ch21-bdd/Phase1/src/main/java/com/manning/junitbook/airport/BusinessFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class BusinessFlight extends Flight { 24 | 25 | public BusinessFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | if (passenger.isVip()) { 32 | return passengers.add(passenger); 33 | } 34 | return false; 35 | } 36 | 37 | @Override 38 | public boolean removePassenger(Passenger passenger) { 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch21-bdd/Phase1/src/main/java/com/manning/junitbook/airport/EconomyFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class EconomyFlight extends Flight { 24 | 25 | public EconomyFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | return passengers.add(passenger); 32 | } 33 | 34 | @Override 35 | public boolean removePassenger(Passenger passenger) { 36 | if (!passenger.isVip()) { 37 | return passengers.remove(passenger); 38 | } 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch21-bdd/Phase1/src/main/java/com/manning/junitbook/airport/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class Passenger { 24 | 25 | private String name; 26 | private boolean vip; 27 | 28 | public Passenger(String name, boolean vip) { 29 | this.name = name; 30 | this.vip = vip; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public boolean isVip() { 38 | return vip; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ch21-bdd/Phase2/src/main/java/com/manning/junitbook/airport/BusinessFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class BusinessFlight extends Flight { 24 | 25 | public BusinessFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | if (passenger.isVip()) { 32 | return passengers.add(passenger); 33 | } 34 | return false; 35 | } 36 | 37 | @Override 38 | public boolean removePassenger(Passenger passenger) { 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch21-bdd/Phase2/src/main/java/com/manning/junitbook/airport/EconomyFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class EconomyFlight extends Flight { 24 | 25 | public EconomyFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | return passengers.add(passenger); 32 | } 33 | 34 | @Override 35 | public boolean removePassenger(Passenger passenger) { 36 | if (!passenger.isVip()) { 37 | return passengers.remove(passenger); 38 | } 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch21-bdd/Phase2/src/main/java/com/manning/junitbook/airport/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class Passenger { 24 | 25 | private String name; 26 | private boolean vip; 27 | 28 | public Passenger(String name, boolean vip) { 29 | this.name = name; 30 | this.vip = vip; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public boolean isVip() { 38 | return vip; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ch21-bdd/Phase3/src/main/java/com/manning/junitbook/airport/BusinessFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class BusinessFlight extends Flight { 24 | 25 | public BusinessFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | if (passenger.isVip()) { 32 | return passengers.add(passenger); 33 | } 34 | return false; 35 | } 36 | 37 | @Override 38 | public boolean removePassenger(Passenger passenger) { 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch21-bdd/Phase3/src/main/java/com/manning/junitbook/airport/EconomyFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class EconomyFlight extends Flight { 24 | 25 | public EconomyFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | return passengers.add(passenger); 32 | } 33 | 34 | @Override 35 | public boolean removePassenger(Passenger passenger) { 36 | if (!passenger.isVip()) { 37 | return passengers.remove(passenger); 38 | } 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch21-bdd/Phase3/src/main/java/com/manning/junitbook/airport/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class Passenger { 24 | 25 | private String name; 26 | private boolean vip; 27 | 28 | public Passenger(String name, boolean vip) { 29 | this.name = name; 30 | this.vip = vip; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public boolean isVip() { 38 | return vip; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ch21-bdd/Phase3/src/test/resources/features/bonus_policy.feature: -------------------------------------------------------------------------------- 1 | Feature: Bonus Policy 2 | The company follows a bonus policy, depending on the passenger type and on the mileage 3 | 4 | Scenario Outline: Regular passenger bonus policy 5 | Given we have a regular passenger with a mileage 6 | When the regular passenger travels and and 7 | Then the bonus points of the regular passenger should be 8 | 9 | Examples: 10 | | mileage1 | mileage2 | mileage3| points | 11 | | 349 | 319 | 623 | 64 | 12 | | 312 | 356 | 135 | 40 | 13 | | 223 | 786 | 503 | 75 | 14 | | 482 | 98 | 591 | 58 | 15 | | 128 | 176 | 304 | 30 | 16 | 17 | Scenario Outline: VIP passenger bonus policy 18 | Given we have a VIP passenger with a mileage 19 | When the VIP passenger travels and and 20 | Then the bonus points of the VIP passenger should be 21 | 22 | Examples: 23 | | mileage1 | mileage2 | mileage3| points | 24 | | 349 | 319 | 623 | 129 | 25 | | 312 | 356 | 135 | 80 | 26 | | 223 | 786 | 503 | 151 | 27 | | 482 | 98 | 591 | 117 | 28 | | 128 | 176 | 304 | 60 | -------------------------------------------------------------------------------- /ch21-bdd/Phase4/src/main/java/com/manning/junitbook/airport/BusinessFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class BusinessFlight extends Flight { 24 | 25 | public BusinessFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | if (passenger.isVip()) { 32 | return passengers.add(passenger); 33 | } 34 | return false; 35 | } 36 | 37 | @Override 38 | public boolean removePassenger(Passenger passenger) { 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch21-bdd/Phase4/src/main/java/com/manning/junitbook/airport/EconomyFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class EconomyFlight extends Flight { 24 | 25 | public EconomyFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | return passengers.add(passenger); 32 | } 33 | 34 | @Override 35 | public boolean removePassenger(Passenger passenger) { 36 | if (!passenger.isVip()) { 37 | return passengers.remove(passenger); 38 | } 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch21-bdd/Phase4/src/main/java/com/manning/junitbook/airport/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class Passenger { 24 | 25 | private String name; 26 | private boolean vip; 27 | 28 | public Passenger(String name, boolean vip) { 29 | this.name = name; 30 | this.vip = vip; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public boolean isVip() { 38 | return vip; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ch21-bdd/Phase5/src/main/java/com/manning/junitbook/airport/BusinessFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class BusinessFlight extends Flight { 24 | 25 | public BusinessFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | if (passenger.isVip()) { 32 | return passengers.add(passenger); 33 | } 34 | return false; 35 | } 36 | 37 | @Override 38 | public boolean removePassenger(Passenger passenger) { 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch21-bdd/Phase5/src/main/java/com/manning/junitbook/airport/EconomyFlight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class EconomyFlight extends Flight { 24 | 25 | public EconomyFlight(String id) { 26 | super(id); 27 | } 28 | 29 | @Override 30 | public boolean addPassenger(Passenger passenger) { 31 | return passengers.add(passenger); 32 | } 33 | 34 | @Override 35 | public boolean removePassenger(Passenger passenger) { 36 | if (!passenger.isVip()) { 37 | return passengers.remove(passenger); 38 | } 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch21-bdd/Phase5/src/main/java/com/manning/junitbook/airport/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | package com.manning.junitbook.airport; 22 | 23 | public class Passenger { 24 | 25 | private String name; 26 | private boolean vip; 27 | 28 | public Passenger(String name, boolean vip) { 29 | this.name = name; 30 | this.vip = vip; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public boolean isVip() { 38 | return vip; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ch21-bdd/Phase5/src/test/resources/com/manning/junitbook/airport/bonus_policy_story.story: -------------------------------------------------------------------------------- 1 | Meta: Bonus Policy 2 | The company follows a bonus policy, depending on the passenger type and on the mileage 3 | 4 | Narrative: 5 | As a company 6 | I want to be able to manage the bonus awarding 7 | So that the policies of the company are followed 8 | 9 | Scenario: Regular passenger bonus policy 10 | Given we have a regular passenger with a mileage 11 | When the regular passenger travels and and 12 | Then the bonus points of the regular passenger should be 13 | 14 | Examples: 15 | | mileage1 | mileage2 | mileage3| points | 16 | | 349 | 319 | 623 | 64 | 17 | | 312 | 356 | 135 | 40 | 18 | | 223 | 786 | 503 | 75 | 19 | | 482 | 98 | 591 | 58 | 20 | | 128 | 176 | 304 | 30 | 21 | 22 | Scenario: VIP passenger bonus policy 23 | Given we have a VIP passenger with a mileage 24 | When the VIP passenger travels and and 25 | Then the bonus points of the VIP passenger should be 26 | 27 | Examples: 28 | | mileage1 | mileage2 | mileage3| points | 29 | | 349 | 319 | 623 | 129 | 30 | | 312 | 356 | 135 | 80 | 31 | | 223 | 786 | 503 | 151 | 32 | | 482 | 98 | 591 | 117 | 33 | | 128 | 176 | 304 | 60 | -------------------------------------------------------------------------------- /ch22-testpyramid/Phase3/airport/src/main/java/com/manning/junitbook/testpyramid/airport/DistancesManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ======================================================================== 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * ======================================================================== 20 | */ 21 | 22 | package com.manning.junitbook.testpyramid.airport; 23 | 24 | import java.util.Map; 25 | 26 | public class DistancesManager { 27 | 28 | public Map getPassengersDistancesMap() { 29 | return null; 30 | } 31 | 32 | public Map getPassengersPointsMap() { 33 | return null; 34 | } 35 | 36 | public void addDistance(Passenger passenger, int distance) { 37 | } 38 | 39 | public void calculateGivenPoints() { 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ch22-testpyramid/Phase3/airport/src/test/resources/flights_information2.csv: -------------------------------------------------------------------------------- 1 | 123-45-6789; John Smith; US 2 | 900-45-6789; Jane Underwood; GB 3 | 123-45-6790; James Perkins; US 4 | 900-45-6790; Mary Calderon; GB 5 | 123-45-6791; Noah Graves; US 6 | 123-45-6793; Margaret Knight; US 7 | 900-45-6793; Amelia Curry; GB 8 | 123-45-6794; Jack Vaughn; US 9 | 900-45-6794; Liam Lewis; GB 10 | 123-45-6795; Olivia Reyes; US 11 | 123-45-6796; Patricia Jordan; US 12 | 900-45-6796; Robert Sherman; GB 13 | 123-45-6797; Mason Burton; US 14 | 123-45-6798; Jennifer Mills; US 15 | 900-45-6798; Sophia Graham; GB 16 | 123-45-6799; Bethany King; US 17 | 123-45-6800; Jacob Tucker; US 18 | 900-45-6800; Michael Jenkins; GB 19 | 123-45-6801; Emily Johnson; US 20 | 123-45-6802; Isabella Carpenter; US 21 | 900-45-6802; William Fields; GB 22 | 123-45-6803; Charlie Lord; US 23 | 123-45-6804; Ava Daniel; US 24 | 900-45-6804; Linda Wise; GB 25 | 123-45-6805; Thomas French; US 26 | 123-45-6806; David Byrne; US 27 | 900-45-6806; Megan Austin; GB 28 | 123-45-6807; Mia Ward; US 29 | 123-45-6808; George Burns; US 30 | 900-45-6808; Richard Moody; GB 31 | 123-45-6809; Victoria Montgomery; US 32 | 900-45-6810; Alexander Alexander; GB 33 | 123-45-6811; Jessica Pacheco; US 34 | 900-45-6811; William Schneider; GB 35 | 900-45-6812; Daniel Hart; GB 36 | 123-45-6813; Thomas Wright; US 37 | -------------------------------------------------------------------------------- /ch22-testpyramid/Phase3/airport/src/test/resources/flights_information3.csv: -------------------------------------------------------------------------------- 1 | 123-45-6790; James Perkins; US 2 | 900-45-6790; Mary Calderon; GB 3 | 123-45-6792; Oliver Aguilar; US 4 | 900-45-6792; Emma Mccann; GB 5 | 123-45-6793; Margaret Knight; US 6 | 900-45-6794; Liam Lewis; GB 7 | 123-45-6795; Olivia Reyes; US 8 | 900-45-6796; Robert Sherman; GB 9 | 123-45-6797; Mason Burton; US 10 | 900-45-6797; Harry Christensen; GB 11 | 900-45-6798; Sophia Graham; GB 12 | 123-45-6799; Bethany King; US 13 | 900-45-6800; Michael Jenkins; GB 14 | 123-45-6801; Emily Johnson; US 15 | 900-45-6802; William Fields; GB 16 | 123-45-6803; Charlie Lord; US 17 | 123-45-6804; Ava Daniel; US 18 | 900-45-6804; Linda Wise; GB 19 | 123-45-6805; Thomas French; US 20 | 900-45-6806; Megan Austin; GB 21 | 123-45-6807; Mia Ward; US 22 | 123-45-6810; Joseph Parker; US 23 | 900-45-6810; Alexander Alexander; GB 24 | 123-45-6812; Damian Reid; US 25 | -------------------------------------------------------------------------------- /ch22-testpyramid/Phase4/airport/src/test/resources/flights_information2.csv: -------------------------------------------------------------------------------- 1 | 123-45-6789; John Smith; US 2 | 900-45-6789; Jane Underwood; GB 3 | 123-45-6790; James Perkins; US 4 | 900-45-6790; Mary Calderon; GB 5 | 123-45-6791; Noah Graves; US 6 | 123-45-6793; Margaret Knight; US 7 | 900-45-6793; Amelia Curry; GB 8 | 123-45-6794; Jack Vaughn; US 9 | 900-45-6794; Liam Lewis; GB 10 | 123-45-6795; Olivia Reyes; US 11 | 123-45-6796; Patricia Jordan; US 12 | 900-45-6796; Robert Sherman; GB 13 | 123-45-6797; Mason Burton; US 14 | 123-45-6798; Jennifer Mills; US 15 | 900-45-6798; Sophia Graham; GB 16 | 123-45-6799; Bethany King; US 17 | 123-45-6800; Jacob Tucker; US 18 | 900-45-6800; Michael Jenkins; GB 19 | 123-45-6801; Emily Johnson; US 20 | 123-45-6802; Isabella Carpenter; US 21 | 900-45-6802; William Fields; GB 22 | 123-45-6803; Charlie Lord; US 23 | 123-45-6804; Ava Daniel; US 24 | 900-45-6804; Linda Wise; GB 25 | 123-45-6805; Thomas French; US 26 | 123-45-6806; David Byrne; US 27 | 900-45-6806; Megan Austin; GB 28 | 123-45-6807; Mia Ward; US 29 | 123-45-6808; George Burns; US 30 | 900-45-6808; Richard Moody; GB 31 | 123-45-6809; Victoria Montgomery; US 32 | 900-45-6810; Alexander Alexander; GB 33 | 123-45-6811; Jessica Pacheco; US 34 | 900-45-6811; William Schneider; GB 35 | 900-45-6812; Daniel Hart; GB 36 | 123-45-6813; Thomas Wright; US 37 | -------------------------------------------------------------------------------- /ch22-testpyramid/Phase4/airport/src/test/resources/flights_information3.csv: -------------------------------------------------------------------------------- 1 | 123-45-6790; James Perkins; US 2 | 900-45-6790; Mary Calderon; GB 3 | 123-45-6792; Oliver Aguilar; US 4 | 900-45-6792; Emma Mccann; GB 5 | 123-45-6793; Margaret Knight; US 6 | 900-45-6794; Liam Lewis; GB 7 | 123-45-6795; Olivia Reyes; US 8 | 900-45-6796; Robert Sherman; GB 9 | 123-45-6797; Mason Burton; US 10 | 900-45-6797; Harry Christensen; GB 11 | 900-45-6798; Sophia Graham; GB 12 | 123-45-6799; Bethany King; US 13 | 900-45-6800; Michael Jenkins; GB 14 | 123-45-6801; Emily Johnson; US 15 | 900-45-6802; William Fields; GB 16 | 123-45-6803; Charlie Lord; US 17 | 123-45-6804; Ava Daniel; US 18 | 900-45-6804; Linda Wise; GB 19 | 123-45-6805; Thomas French; US 20 | 900-45-6806; Megan Austin; GB 21 | 123-45-6807; Mia Ward; US 22 | 123-45-6810; Joseph Parker; US 23 | 900-45-6810; Alexander Alexander; GB 24 | 123-45-6812; Damian Reid; US 25 | -------------------------------------------------------------------------------- /ch22-testpyramid/Phase5/airport/src/test/resources/flights_information2.csv: -------------------------------------------------------------------------------- 1 | 123-45-6789; John Smith; US 2 | 900-45-6789; Jane Underwood; GB 3 | 123-45-6790; James Perkins; US 4 | 900-45-6790; Mary Calderon; GB 5 | 123-45-6791; Noah Graves; US 6 | 123-45-6793; Margaret Knight; US 7 | 900-45-6793; Amelia Curry; GB 8 | 123-45-6794; Jack Vaughn; US 9 | 900-45-6794; Liam Lewis; GB 10 | 123-45-6795; Olivia Reyes; US 11 | 123-45-6796; Patricia Jordan; US 12 | 900-45-6796; Robert Sherman; GB 13 | 123-45-6797; Mason Burton; US 14 | 123-45-6798; Jennifer Mills; US 15 | 900-45-6798; Sophia Graham; GB 16 | 123-45-6799; Bethany King; US 17 | 123-45-6800; Jacob Tucker; US 18 | 900-45-6800; Michael Jenkins; GB 19 | 123-45-6801; Emily Johnson; US 20 | 123-45-6802; Isabella Carpenter; US 21 | 900-45-6802; William Fields; GB 22 | 123-45-6803; Charlie Lord; US 23 | 123-45-6804; Ava Daniel; US 24 | 900-45-6804; Linda Wise; GB 25 | 123-45-6805; Thomas French; US 26 | 123-45-6806; David Byrne; US 27 | 900-45-6806; Megan Austin; GB 28 | 123-45-6807; Mia Ward; US 29 | 123-45-6808; George Burns; US 30 | 900-45-6808; Richard Moody; GB 31 | 123-45-6809; Victoria Montgomery; US 32 | 900-45-6810; Alexander Alexander; GB 33 | 123-45-6811; Jessica Pacheco; US 34 | 900-45-6811; William Schneider; GB 35 | 900-45-6812; Daniel Hart; GB 36 | 123-45-6813; Thomas Wright; US 37 | -------------------------------------------------------------------------------- /ch22-testpyramid/Phase5/airport/src/test/resources/flights_information3.csv: -------------------------------------------------------------------------------- 1 | 123-45-6790; James Perkins; US 2 | 900-45-6790; Mary Calderon; GB 3 | 123-45-6792; Oliver Aguilar; US 4 | 900-45-6792; Emma Mccann; GB 5 | 123-45-6793; Margaret Knight; US 6 | 900-45-6794; Liam Lewis; GB 7 | 123-45-6795; Olivia Reyes; US 8 | 900-45-6796; Robert Sherman; GB 9 | 123-45-6797; Mason Burton; US 10 | 900-45-6797; Harry Christensen; GB 11 | 900-45-6798; Sophia Graham; GB 12 | 123-45-6799; Bethany King; US 13 | 900-45-6800; Michael Jenkins; GB 14 | 123-45-6801; Emily Johnson; US 15 | 900-45-6802; William Fields; GB 16 | 123-45-6803; Charlie Lord; US 17 | 123-45-6804; Ava Daniel; US 18 | 900-45-6804; Linda Wise; GB 19 | 123-45-6805; Thomas French; US 20 | 900-45-6806; Megan Austin; GB 21 | 123-45-6807; Mia Ward; US 22 | 123-45-6810; Joseph Parker; US 23 | 900-45-6810; Alexander Alexander; GB 24 | 123-45-6812; Damian Reid; US 25 | -------------------------------------------------------------------------------- /ch22-testpyramid/Phase6/airport/src/test/resources/features/passengers_policy.feature: -------------------------------------------------------------------------------- 1 | Feature: Passengers Policy 2 | The company follows a policy of adding and removing passengers, depending on the passenger type 3 | 4 | Scenario Outline: Flight with regular passengers 5 | Given there is a flight having number "" and seats with passengers defined into "" 6 | When we have regular passengers 7 | Then you can remove them from the flight 8 | And add them to another flight 9 | 10 | Examples: 11 | |flightNumber | seats | file | 12 | | AA1234 | 50 | flights_information.csv | 13 | | AA1235 | 50 | flights_information2.csv | 14 | | AA1236 | 50 | flights_information3.csv | 15 | 16 | Scenario Outline: Flight with VIP passengers 17 | Given there is a flight having number "" and seats with passengers defined into "" 18 | When we have VIP passengers 19 | Then you cannot remove them from the flight 20 | 21 | Examples: 22 | |flightNumber | seats | file | 23 | | AA1234 | 50 | flights_information.csv | 24 | | AA1235 | 50 | flights_information2.csv | 25 | | AA1236 | 50 | flights_information3.csv | 26 | -------------------------------------------------------------------------------- /ch22-testpyramid/Phase6/airport/src/test/resources/flights_information2.csv: -------------------------------------------------------------------------------- 1 | 123-45-6789; John Smith; US; Y 2 | 900-45-6789; Jane Underwood; GB 3 | 123-45-6790; James Perkins; US 4 | 900-45-6790; Mary Calderon; GB 5 | 123-45-6791; Noah Graves; US 6 | 123-45-6793; Margaret Knight; US 7 | 900-45-6793; Amelia Curry; GB 8 | 123-45-6794; Jack Vaughn; US 9 | 900-45-6794; Liam Lewis; GB 10 | 123-45-6795; Olivia Reyes; US 11 | 123-45-6796; Patricia Jordan; US 12 | 900-45-6796; Robert Sherman; GB 13 | 123-45-6797; Mason Burton; US 14 | 123-45-6798; Jennifer Mills; US 15 | 900-45-6798; Sophia Graham; GB 16 | 123-45-6799; Bethany King; US 17 | 123-45-6800; Jacob Tucker; US 18 | 900-45-6800; Michael Jenkins; GB; Y 19 | 123-45-6801; Emily Johnson; US 20 | 123-45-6802; Isabella Carpenter; US 21 | 900-45-6802; William Fields; GB 22 | 123-45-6803; Charlie Lord; US 23 | 123-45-6804; Ava Daniel; US 24 | 900-45-6804; Linda Wise; GB 25 | 123-45-6805; Thomas French; US 26 | 123-45-6806; David Byrne; US 27 | 900-45-6806; Megan Austin; GB 28 | 123-45-6807; Mia Ward; US 29 | 123-45-6808; George Burns; US 30 | 900-45-6808; Richard Moody; GB 31 | 123-45-6809; Victoria Montgomery; US 32 | 900-45-6810; Alexander Alexander; GB 33 | 123-45-6811; Jessica Pacheco; US 34 | 900-45-6811; William Schneider; GB 35 | 900-45-6812; Daniel Hart; GB 36 | 123-45-6813; Thomas Wright; US 37 | -------------------------------------------------------------------------------- /ch22-testpyramid/Phase6/airport/src/test/resources/flights_information3.csv: -------------------------------------------------------------------------------- 1 | 123-45-6790; James Perkins; US 2 | 900-45-6790; Mary Calderon; GB 3 | 123-45-6792; Oliver Aguilar; US; Y 4 | 900-45-6792; Emma Mccann; GB 5 | 123-45-6793; Margaret Knight; US 6 | 900-45-6794; Liam Lewis; GB 7 | 123-45-6795; Olivia Reyes; US 8 | 900-45-6796; Robert Sherman; GB 9 | 123-45-6797; Mason Burton; US 10 | 900-45-6797; Harry Christensen; GB 11 | 900-45-6798; Sophia Graham; GB 12 | 123-45-6799; Bethany King; US 13 | 900-45-6800; Michael Jenkins; GB; Y 14 | 123-45-6801; Emily Johnson; US 15 | 900-45-6802; William Fields; GB 16 | 123-45-6803; Charlie Lord; US 17 | 123-45-6804; Ava Daniel; US 18 | 900-45-6804; Linda Wise; GB 19 | 123-45-6805; Thomas French; US 20 | 900-45-6806; Megan Austin; GB 21 | 123-45-6807; Mia Ward; US 22 | 123-45-6810; Joseph Parker; US 23 | 900-45-6810; Alexander Alexander; GB 24 | 123-45-6812; Damian Reid; US 25 | --------------------------------------------------------------------------------