As we all know, spam (unsolicited junk email)
is clogging up the arteries of
the internet. In this project you are going to modify the mail-system
project from chapter 3 to filter spam. Here are the specifications
for this
project. Read them carefully:
Do Exercise 3.33 if you haven't already (we
did this in class).
Modify the MailServer so that it uses a HashMap to store
MailItems. The keys
to the HashMap should be the names of the recipients, and each
value should
be an ArrayList containing all the MailItems stored for that
recipient.
Any email whose subject starts with the word "SPAM" or
whose message
contains the word "viagra" (capitalized or not) is
spam, and should not be
posted by the MailServer so that the intended recipient doesn't
see it when
he or she retrieves MailItems.
Add a method to the MailServer class called
printAllMessages, that iterates
through the users, prints out each user name, and prints
out all the emails
associated with that user.
Write unit tests that thoroughly test your
modified mail-system. Make sure
you test the case where you request mail for a user who
has not yet received
any mail.
|