@Test public void initIsNotCalledWhenDifferentFormIdIsRequested() { final BasePreferencePortable preference = mock(BasePreferencePortable.class); final PreferenceHierarchyElement hierarchyElement = new PreferenceHierarchyElement(); hierarchyElement.setId("another-preference-id"); hierarchyElement.setPortablePreference(preference); HierarchyItemFormInitializationEvent event = new HierarchyItemFormInitializationEvent(hierarchyElement); basePreferenceForm.hierarchyItemFormInitializationEvent(event); verify(basePreferenceForm, never()).init(any(BasePreferencePortable.class)); }
public String getPreferenceIdentifier() { return hierarchyElement.getPortablePreference().identifier(); }
public <T extends BasePreferencePortable<?>> T getPreference() { Class<T> preferenceClass = (Class<T>) hierarchyElement.getPortablePreference().getPojoClass(); return (T) hierarchyElement.getPortablePreference(); }
public HierarchyItemSelectedEvent(final PreferenceHierarchyElement<?> hierarchyElement) { super(hierarchyElement.getId()); this.hierarchyElement = hierarchyElement; }