RouteOptionsPanel extends OptionsPanel implements OptionItem.OnChangedListener { public void setRouteOptions(final RouteOptions routeOptions) { mRouteOptions = routeOptions; select(getSelectedOptions()); } RouteOptionsPanel(final Context context);  RouteOptionsPanel(final Context context, final AttributeSet attrs);  RouteOptionsPanel(final Context context, final AttributeSet attrs, final int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  RouteOptionsPanel(final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes); RouteOptions getRouteOptions(); void setRouteOptions(final RouteOptions routeOptions); @SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NcssCount"}) void populateRouteOptions(); @Override void onChanged(OptionItem item);  }
@Test public void testChangeListener() { final MockUtils.MockRouteOptionsBuilder builder = new MockUtils.MockRouteOptionsBuilder(); final RouteOptions options = builder.withFewDriveOptions().build(); mRouteOptionsPanel.setRouteOptions(options); mRouteOptionsPanel.setListener(new OptionsPanel.Listener() { @Override public void onOptionCreated(List<OptionItem> item) { mCallbackCalled = false; } @Override public void onOptionChanged(OptionItem item) { mCallbackCalled = true; } }); when(options.areCarShuttleTrainsAllowed()).thenReturn(false); mRouteOptionsPanel.setRouteOptions(options); assertThat(mCallbackCalled, is(true)); }