PhoneBook
The main purpose of this example is to show you :
The PhoneBookSystemUnderDevelopment is a Fixture Factory
that take care of :
- Importing the
com.greenpepper.confluence.demo.phonebook
Java package. This way, no need to use the Import Table or the Import Macro on every specification - Registering the custom converter PhoneBookEntryTypeConverter. This way, no need to modify our domain object with the 'Self Conversion' methods
parse
ortoString
. - Manage our instance of the PhoneBookFixture to make sure the instance of PhoneBook is the same for all interpreters. This is really optional but provide a way to use the same instance (singleton) of the PhoneBook that contains a list of contact. A better approach would be to use Spring or Guice.
Setup Example
The contact
column string value will be converted automagically
to a PhoneBookEntry using our custom converter PhoneBookEntryTypeConverter.
setup |
phone book |
---|---|
contact |
|
Fred, Flintstone, (123) 456-7890 |
|
Barney, Rubble, (123) 321-7666 |
|
Great, Gazoo, (123) 989-4455 |
List Of Example
We list all PhoneBookEntry found in the PhoneBook in the same order as it was added to the list.
list of |
phone book |
|
---|---|---|
First Name |
Last Name |
Number |
Fred |
Flintstone |
(123) 456-7890 |
Barney |
Rubble |
(123) 321-7666 |
Great |
Gazoo |
(123) 989-4455 |
Do With Example
do with |
phone book |
---|
We verify the contact information of Fred Flintstone
.
check |
that number of |
Fred |
|
Flintstone |
is |
(123) 456-7890 |
We update the phone number of Fred Flintstone
.
accept |
update number of |
Fred |
|
Flintstone |
to |
(123) 567-8904 |
We verify that the update of the phone number of Fred Flintstone
is correct.
check |
that number of |
Fred |
|
Flintstone |
is |
(123) 567-8904 |
We verify that Wilma Flinstone
is not already in the list of contact.
check |
that number of |
Wilma |
|
Flintstone |
is |
nothing |
We try to update the contact Wilma Flintstone
that do not exist (the check confirms that Wilma Flintstone
in not in the list).
reject |
update number of |
Wilma |
|
Flintstone |
to |
(123) 567-8904 |
We inserts Wilma Flintstone
in the list.
insert |
Wilma |
|
Flintstone |
with number |
(123) 567-8904 |
end |
Subset Of Example
We confirm using the subset of
interpreter that Wilma Flintstone
now belong to our list of contact.
subset of |
phone book entries |
|
---|---|---|
First Name |
Last Name |
Number |
Wilma |
Flintstone |
(123) 567-8904 |
Source Code
PhoneBook.java
PhoneBookSystemUnderDevelopment.java
PhoneBookEntry.java
PhoneBookEntryTypeConverter.java
PhoneBookFixture.java