Save this video free

UNC COMP 301 - F26/Lec 9 - Software Testing - JUnit; Design Patterns Introduction

Muhammad Sayeed Ghani · 1:15:34 · Watch on YouTube

Part of UNC Chapel Hill COMP 301. See all 22 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Muhammad Sayeed Ghani explains Java checked exceptions, then focuses on unit testing with JUnit: configuring Maven, writing assertion-based tests, measuring coverage, and using test-driven development (TDD) to expose missing requirements. He closes with an introduction to the Gang of Four’s design-pattern categories and the Iterator pattern, which hides collection implementation details.

Key takeaways

Chapters

0:00 Custom Checked Exceptions: ShortOfFunds and Its Shortfall
7:10 Throw Early, Use Specific Exceptions, and Catch When You Can Act
9:30 Four Levels of Software Testing, from Unit to Acceptance
12:40 JUnit Setup in Maven and the TDD Idea
15:35 JUnit Test Classes, @Test Methods, and Maven Folder Structure
20:40 Run a JUnit Test Method or the Entire Test Class
23:20 JUnit Assertions Turn Expected Results into Test Outcomes
27:00 JUnit Assertion Choices and a Null-Safe Equality Check
36:30 Focused Tests Isolate Cases and Dependencies
42:20 JUnit Coverage Reports Lines, Methods, Classes, and Branches
51:25 TDD Cycles Between Requirements, Tests, and Implementation
55:20 A PrimeCounter Test Reveals an Unspecified Default
1:01:00 Expand PrimeCounter Tests and Consider TDD Tradeoffs
1:09:30 Gang of Four Design Patterns: Three Categories
1:12:40 Iterator Hides Collection Implementations

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:01 So we having a midterm a week from today. Um today's lecture should be the last lecture that will be covered in the midterm. And uh we should primarily be discussing uh the topic of software testing today. Um we will likely not get into design patterns and that should be covered starting uh Tuesday. Uh but before we get into software testing, let's finish up on where we were on error handling. Uh where we were talking about creating our own exception type. So let's take a look at how we can create our own exception type. I gave you a small example where we're creating a custom type for handling a bank account where we're running short

0:50 of funds and when somebody withdraws an amount which is more than what the funds are uh available seem to indicate uh then they need to give uh an exception which we are calling short of funds. Now short of funds as I explained last last in the last lecture is an extension of exception and if you go and take a look at exception then that is a checked exception and so when you extend from that uh you get another exception which is also um checked. All right. And so this is an example of a checked exception. Uh it has a couple of methods. One of them well one method and the constructor. The constructor takes a

1:38 message and it also takes uh another parameter the shortfall and it actually has a field which is uh set up which is um going to be uh going to have the value of the shortfall and uh it calls starting with the uh super uh and if you take a look at the actual code uh we can figure out what uh super uh the the call

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Muhammad Sayeed Ghani.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.