0% found this document useful (0 votes)
27 views

Tutorial: Unit Testing and Arrays: Recommended Preparation

This document provides a tutorial on unit testing and arrays. It recommends reviewing lecture notes on testing and arrays. It then lists 6 questions about test driven development, JUnit, defining array operations with an interface, easy and hard array activities, writing a method to test if an array is a palindrome, and writing JUnit tests for the palindrome method. Finally, it mentions discussing the next practical assignment.

Uploaded by

Abhishek Gambhir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Tutorial: Unit Testing and Arrays: Recommended Preparation

This document provides a tutorial on unit testing and arrays. It recommends reviewing lecture notes on testing and arrays. It then lists 6 questions about test driven development, JUnit, defining array operations with an interface, easy and hard array activities, writing a method to test if an array is a palindrome, and writing JUnit tests for the palindrome method. Finally, it mentions discussing the next practical assignment.

Uploaded by

Abhishek Gambhir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Tutorial: Unit Testing and Arrays

CS2001
Week 2, 2017-18

Recommended Preparation
You should study the lecture notes on the following topics:

• Testing

• Arrays

If you do not understand any of these concepts, please ask your tutor to explain them further.

Questions
1. What are the pros and cons of Test Driven Development? What other approaches might you
follow?

2. How do the features of JUnit support TDD?


3. Consider an array as an Abstract Data Type. What would be the operations? Define a correspond-
ing Java interface.
4. Give examples of storage and retrieval activities that are easy using arrays, and some that are
hard.
5. A palindrome is a sequence that is identical to the reverse of itself e.g. “madam” or (ignoring spaces
and punctuation) “Naomi, did I moan?” or “No, Mel Gibson is a casino’s big lemon.” Write a Java
method that tests whether a given input array of characters is a palindrome, assuming:

(a) that the input string contains no punctuation


(b) that the input string contains punctuation and a second array contains a list of allowed punc-
tuation. You can assume the existence of an array membership function e.g.
public static boolean contains(char[] array, char c);

6. Write some JUnit tests for the method isPalindrome(char[] s)

Related to Coursework
Discuss the next practical.
.

You might also like