/** * Tests the ISO 19115:2003 {@link DefaultContact#setPhone(Telephone)} method, * then query with both the new and the deprecated methods. */ @Test @DependsOnMethod("testSetPhones") public void testSetPhone() { testSetPhone(false); }
init(); final DefaultTelephone tel = new DefaultTelephone(); tel.setVoices(Arrays.asList("00.02", "00.04")); view = tel; verifyLegacyLists(tel); verifyLegacyLists(view); assertArrayEquals("getPhones", new DefaultTelephone[] { new DefaultTelephone("00.02", UnsupportedCodeList.VOICE),
/** * Tests the ISO 19115:2014 {@link DefaultContact#setPhones(Collection)} method, * then query with both the new and the deprecated methods. */ @Test @SuppressWarnings("deprecation") public void testSetPhones() { init(); final DefaultTelephone tel1 = new DefaultTelephone("00.01", UnsupportedCodeList.valueOf("SMS")); final DefaultTelephone tel2 = new DefaultTelephone("00.02", UnsupportedCodeList.VOICE); final DefaultTelephone tel3 = new DefaultTelephone("00.03", UnsupportedCodeList.FACSIMILE); final DefaultTelephone tel4 = new DefaultTelephone("00.04", UnsupportedCodeList.VOICE); final DefaultTelephone[] tels = new DefaultTelephone[] {tel1, tel2, tel3, tel4}; final DefaultContact contact = new DefaultContact(); contact.setPhones(Arrays.asList(tel1, tel2, tel3, tel4)); assertArrayEquals("getPhones", tels, contact.getPhones().toArray()); /* * Test the deprecated 'getPhone()' method. Invoking that method shall emit * a warning, since the ISO 19115:2003 methods can not represent SMS numbers. */ assertSame("getPhone", tel2, contact.getPhone()); // Shall ignore the TelephoneType.SMS. assertEquals("warningOccured", "IgnoredPropertyAssociatedTo_1", resourceKey); assertArrayEquals("warningOccured", new String[] {"SMS"}, parameters); verifyLegacyLists(tels); }
/** * Same as {@link #testSetPhone()}, but hiding to {@link DefaultContact} the fact that we * are using a SIS implementation of {@code Telephone}. This will test an other code path. */ @Test @DependsOnMethod("testSetPhones") public void testSetNonSISPhone() { testSetPhone(true); }