@Test public void shouldReturnPolishHolidays() { final Locale poland = new Locale("pl", "PL"); final Holidays holidays = HolidaysFactory.of(poland); assertThat(holidays).isInstanceOf(PolishHolidays.class); }
public static Holidays of(Locale locale) { switch (locale.getCountry()) { case "PL": return new PolishHolidays(); case "US": return new AmericanHolidays(); default: throw new IllegalArgumentException("Unsupported: " + locale.getCountry()); } }
HolidaysFactory { public static Holidays of(Locale locale) { switch (locale.getCountry()) { case "PL": return new PolishHolidays(); case "US": return new AmericanHolidays(); default: throw new IllegalArgumentException("Unsupported: " + locale.getCountry()); } } }
HolidaysFactory { public static Holidays of(Locale locale) { switch (locale.getCountry()) { case "PL": return new PolishHolidays(); case "US": return new AmericanHolidays(); default: throw new IllegalArgumentException("Unsupported: " + locale.getCountry()); } }  }
HolidaysFactory { public static Holidays of(Locale locale) { switch (locale.getCountry()) { case "PL": return new PolishHolidays(); case "US": return new AmericanHolidays(); default: throw new IllegalArgumentException("Unsupported: " + locale.getCountry()); } }  static Holidays of(Locale locale); }
HolidaysFactory { public static Holidays of(Locale locale) { switch (locale.getCountry()) { case "PL": return new PolishHolidays(); case "US": return new AmericanHolidays(); default: throw new IllegalArgumentException("Unsupported: " + locale.getCountry()); } }  static Holidays of(Locale locale);  }