### Question:
ReceiveActivity extends CommoditySelectableActivity implements Serializable { @Override protected Button getSubmitButton() { return buttonSubmitReceive; }  List<String> getReceiveSources(); Receive generateReceive(); void setAllocation(String allocationId); void validateAllocationId(String text); void validateAllocationId(); void onEvent(AllocationCreateEvent event); void clearInput(); static final String ALLOCATION_ID; @InjectView(R.id.spinnerSource)
    public Spinner spinnerSource; }### Answer:
@Test public void shouldToastInvalidFieldMessageWhenFieldsAreInvalid() throws Exception { ReceiveActivity receiveActivity = getReceiveActivity(); receiveActivity.textViewAllocationId.setText(VALID_ALLOCATION_ID); fireCommodityToggledEvent(receiveActivity); receiveActivity.getSubmitButton().performClick(); assertThat(ShadowToast.getTextOfLatestToast(), is(receiveActivity.getResources().getString(R.string.receive_quantities_validation_error_message))); }
@Test public void shouldNotRequireAllocationIdWhenNotRecievingFromLGA() throws Exception { ReceiveActivity receiveActivity = getReceiveActivity(); setSource(receiveActivity, application.getString(R.string.zonal_store_for_receive)); ANDROID.assertThat(receiveActivity.textViewAllocationId).isDisabled(); setupValidCommodity(receiveActivity); receiveActivity.getSubmitButton().performClick(); ShadowHandler.idleMainLooper(); assertThat(ShadowToast.getTextOfLatestToast(), is(nullValue())); }