* <p>
* @param sourceCountry Source Country instance to copy data from
* @param targetCountry Target Country instance to copy data to
+ * <p>
+ * @throws NullPointerException If sourceCountry or targetCountry is null
+ * @throws IllegalArgumentException If both Country instances are equal
*/
public static void copyCountry (final Country sourceCountry, final Country targetCountry) {
// Parameters should not be null
// Throw NPE
throw new NullPointerException("targetCountry is null"); //NOI18N
} else if (Objects.equals(sourceCountry, targetCountry)) {
- // Should never be equal
+ /*
+ * Source and target country should never be equal, please check the
+ * condition before invoking this method.
+ */
+ throw new IllegalArgumentException("Both sourceCountry and targetCountry are equal.");
}
// Copy all fields