void (int expected, JLabel label) { int actual = 0; for (PropertyChangeListener listener : label.getPropertyChangeListeners("font")) { if (listener instanceof RelativeFont) { actual++; } } assertEquals(expected, actual); }