Ejemplo n.º 1
0
 @Test
 public void testEquals() {
   ZipCode zipcode1 = new ZipCode(code);
   ZipCode zipcodeEquals = new ZipCode(code);
   ZipCode zipcodeNotEquals = new ZipCode(code + code);
   Assert.assertTrue("Equals must be base on the code", zipcode1.equals(zipcodeEquals));
   Assert.assertFalse("Equals must be base on the code", zipcode1.equals(zipcodeNotEquals));
 }
 /**
  * Used to inform if Vcard can be used.
  *
  * @return True if the address has data in street, zipcode and city, otherwise false.
  */
 public boolean getHasVcardData() {
   if (StringUtil.isEmpty(street)
       || StringUtil.isEmpty(zipCode.getZipCode())
       || StringUtil.isEmpty(city)) {
     return false;
   }
   return true;
 }
  /**
   * @inheritDoc
   * @return True if the address is empty.
   */
  @Override
  public boolean isEmpty() {
    boolean empty = true;

    empty &= StringUtil.isEmpty(street);
    empty &= StringUtil.isEmpty(zipCode.getZipCode());
    empty &= StringUtil.isEmpty(city);

    if (additionalInfo != null && additionalInfo.size() > 0) {
      for (int i = 0; i < additionalInfo.size(); i++) {
        empty &= StringUtil.isEmpty(additionalInfo.get(i));
      }
    }
    return empty;
  }
Ejemplo n.º 4
0
 @Test
 public void testToString() {
   ZipCode zipCode = new ZipCode(code);
   Assert.assertEquals("toString should return the code ", "CODE", zipCode.toString());
 }
Ejemplo n.º 5
0
 @Test
 public void testConstructorShouldUpperCaseCode() {
   ZipCode zipCode = new ZipCode(code);
   Assert.assertEquals("zipcode constructor should upper case", "CODE", zipCode.getCode());
 }