コード例 #1
0
 private boolean isValuePartOfAddressList(List<Address> list, String formated) {
   if (list != null) {
     for (Address actAttribute : list) {
       if (actAttribute.getFormatted().equals(formated)) {
         return true;
       }
     }
   }
   return false;
 }
コード例 #2
0
  @Test
  public void convertsAddressCorrectly() {

    Address address = new Address();
    address.city = "New York";
    address.street = "Broadway";

    DBObject dbObject = new BasicDBObject();

    converter.write(address, dbObject);

    assertThat(dbObject.get("city").toString(), is("New York"));
    assertThat(dbObject.get("street").toString(), is("Broadway"));
  }
コード例 #3
0
 private Address getAddress(List<Address> addresses, String formatted) {
   Address returnAddress = null;
   if (addresses != null) {
     for (Address actAddress : addresses) {
       if (actAddress.getFormatted().equals(formatted)) {
         returnAddress = actAddress;
         break;
       }
     }
   }
   if (returnAddress == null) {
     fail("The address with the formatted part of " + formatted + " could not be found");
   }
   return returnAddress;
 }