Learning Outcomes
At the end of this lecture, you’ll be able to:
- Implement the
IndexedList
ADT using Java’s built-in array. - Explain why we use generics in ADT declarations.
- Identify the syntax of Java Generics.
- Translate the
IndexedList
ADT into a generic interface. - Implement the generic
IndexedList
ADT with a concrete Java class. - Create an array of generic types in Java with a fixed size.
- Explain the need for testing the implementations of an ADT.
- Define what a unit test is.
- Apply the JUnit framework to unit testing Java code.
- Express best practices of unit testing.
- Write simple unit tests using the JUnit framework.
- Use JUnit’s
@BeforeEach
annotation to create setup methods. - Appreciate the value of Unit Testing & Test-First Development in software construction.
Lecture Plan
In this lecture, we'll cover the following lessons:
- IndexedList ADT: Review
- ArrayIndexedList: An Implementation of IndexedList⚡
- IndexedList ADT: Limited to Integer Values?!⚡
- IndexedList ADT: Lift the Limit with Java Generics!
- IndexedList ADT: The syntax of Generics in Java
- ArrayIndexedList: Generic Implementation⚡
- ArrayIndexedList: Generic Array
- ArrayIndexedList: Testing Correctness
- IndexedListTest: JUnit Framework
- IndexedListTest: Unit Tests
- Unit Tests: Easier said than done!
- Unit Tests: Use Descriptive Names!
- Unit Tests: Exercise⚡
- Unit Tests: BeforeEach
- Unit Testing: Summary
Lessons marked with ⚡ contain exercise/activity.