package com.example.tests;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

public class AddressChecks extends AddressBookBase
{
	protected void checkAddressesUiAndDb()
	{
		if ( wantToCheck() )
	    {
		    if ( "yes".equals(app.getProperty("check.db")) )
		    {
		    	assertThat(app.getModel().getAddresses(), equalTo(app.getHibernateHelper().listAddresses()));
		    }
		    if ( "yes".equals(app.getProperty("check.ui")) )
		    {
		    	assertThat(app.getModel().getAddresses(), equalTo(app.getAddressHelper().getUiAddresses()));
		    }
	    }
	}
}
