本文整理汇总了Java中org.fest.assertions.api.ANDROID类的典型用法代码示例。如果您正苦于以下问题:Java ANDROID类的具体用法?Java ANDROID怎么用?Java ANDROID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ANDROID类属于org.fest.assertions.api包,在下文中一共展示了ANDROID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCategoryButtonClickChangesTheEmptyViewText
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void testCategoryButtonClickChangesTheEmptyViewText() throws Exception {
Dialog dialog = ShadowDialog.getLatestDialog();
TextView textViewEmptyText = (TextView) dialog.findViewById(R.id.editTextEmptyText);
LinearLayout categoriesLayout = (LinearLayout) dialog.findViewById(R.id.itemSelectOverlayCategories);
Button secondCategoryButton = (Button) categoriesLayout.getChildAt(1);
secondCategoryButton.performClick();
GridView commoditiesLayout = (GridView) dialog.findViewById(R.id.gridViewCommodities);
assertThat(commoditiesLayout, not(nullValue()));
assertThat(commoditiesLayout.getAdapter().getCount(), is(1));
assertThat(secondCategoryButton.isSelected(), is(true));
ANDROID.assertThat(textViewEmptyText).hasText("No Commodities Available");
}
示例2: shouldEnableAllocationIfReceivingFromLGA
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldEnableAllocationIfReceivingFromLGA() throws Exception {
ReceiveActivity receiveActivity = getReceiveActivity();
receiveActivity.textViewAllocationId.setText("INVALIDALLOCATIONID");
setSource(receiveActivity, application.getString(R.string.zonal_store_for_receive));
assertThat(receiveActivity.textViewAllocationId.getError(), nullValue());
ANDROID.assertThat(receiveActivity.textViewAllocationId).isDisabled();
receiveActivity.setAllocation("INVALIDALLOCATIONID");
setSource(receiveActivity, application.getString(R.string.lga_for_receive));
ANDROID.assertThat(receiveActivity.textViewAllocationId).isEnabled();
ANDROID.assertThat(receiveActivity.textViewAllocationId).isVisible();
ANDROID.assertThat(receiveActivity.textViewAllocationLabel).isVisible();
receiveActivity.validateAllocationId();
CharSequence error = receiveActivity.textViewAllocationId.getError();
assertThat(error, notNullValue());
assertThat(error.toString(), is(String.format(
application.getString(R.string.error_allocation_id_wrong_format),
receiveActivity.getAllocationIdFormat())));
}
示例3: shouldShowErrorMessageForNonVaccinesWhenReturnToLGAIsSelected
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldShowErrorMessageForNonVaccinesWhenReturnToLGAIsSelected() throws Exception {
ArrayList<AdjustmentsViewModel> commodities = new ArrayList<>();
Commodity commodity = mock(Commodity.class);
when(commodity.isVaccine()).thenReturn(false);
AdjustmentsViewModel adjustmentsViewModel = new AdjustmentsViewModel(commodity, 12, false);
adjustmentsViewModel.setAdjustmentReason(AdjustmentReason.PHYSICAL_COUNT);
commodities.add(adjustmentsViewModel);
AdjustmentsActivity activity = getAdjustmentsActivity();
AdjustmentsAdapter adjustmentsAdapter = new AdjustmentsAdapter(activity, R.layout.selected_adjustment_commodity_list_item, commodities);
View row = ListTestUtils.getRowFromListView(0, adjustmentsAdapter, R.layout.selected_adjustment_commodity_list_item);
TextView textView = (TextView) row.findViewById(R.id.textViewCommodityName);
assertThat(textView.getError(), is(Matchers.nullValue()));
activity.spinnerAdjustmentReason.setSelection(4);
View row2 = ListTestUtils.getRowFromListView(0, adjustmentsAdapter, R.layout.selected_adjustment_commodity_list_item);
textView = (TextView) row2.findViewById(R.id.textViewCommodityName);
ANDROID.assertThat(textView).hasError();
}
示例4: shouldSetTheCountedTextViewIfTheCountedIsSetInTheViewModel
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldSetTheCountedTextViewIfTheCountedIsSetInTheViewModel() throws Exception {
ArrayList<AdjustmentsViewModel> commodities = new ArrayList<>();
Commodity commodity = mock(Commodity.class);
when(commodity.getStockOnHand()).thenReturn(100);
AdjustmentsViewModel adjustmentsViewModel = new AdjustmentsViewModel(commodity, 12, false);
adjustmentsViewModel.setAdjustmentReason(AdjustmentReason.PHYSICAL_COUNT);
int stockCounted = 300;
commodities.add(adjustmentsViewModel);
AdjustmentsAdapter adapter = new AdjustmentsAdapter(activity, R.layout.selected_adjustment_commodity_list_item, commodities);
View row = ListTestUtils.getRowFromListView(0, adapter, R.layout.selected_adjustment_commodity_list_item);
EditText editText = (EditText) row.findViewById(R.id.editTextQuantity);
TextView textView = (TextView) row.findViewById(R.id.textViewDifference);
editText.setText(Integer.toString(stockCounted));
ANDROID.assertThat(textView).containsText("200");
}
示例5: shouldShowErrorMessageForNonDevicesWhenReturnToLGAIsSelected
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldShowErrorMessageForNonDevicesWhenReturnToLGAIsSelected() throws Exception {
ArrayList<AdjustmentsViewModel> commodities = new ArrayList<>();
Commodity commodity = mock(Commodity.class);
when(commodity.isVaccine()).thenReturn(false);
AdjustmentsViewModel adjustmentsViewModel = new AdjustmentsViewModel(commodity, 12, false);
adjustmentsViewModel.setAdjustmentReason(AdjustmentReason.PHYSICAL_COUNT);
commodities.add(adjustmentsViewModel);
AdjustmentsAdapter adjustmentsAdapter = new AdjustmentsAdapter(activity, R.layout.selected_adjustment_commodity_list_item, commodities);
activity.spinnerAdjustmentReason.setSelection(4);
View row = ListTestUtils.getRowFromListView(0, adjustmentsAdapter, R.layout.selected_adjustment_commodity_list_item);
TextView textView = (TextView) row.findViewById(R.id.textViewCommodityName);
ANDROID.assertThat(textView).hasError();
}
示例6: shouldShowSpinnerForUnexpectedOrderReasonsIfStartOrderDateIsChangedWhenOrderTypeIsRoutine
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldShowSpinnerForUnexpectedOrderReasonsIfStartOrderDateIsChangedWhenOrderTypeIsRoutine() throws Exception {
Date currentDate = new Date();
commodityViewModel.setOrderReasonPosition(null);
commodityViewModel.setOrderPeriodStartDate(currentDate);
View rowView = getRowView();
TextView textViewStartDate = (TextView) rowView.findViewById(R.id.textViewStartDate);
Calendar calendar = Calendar.getInstance();
calendar.setTime(currentDate);
calendar.add(Calendar.DAY_OF_MONTH, 2);
textViewStartDate.setText(SelectedOrderCommoditiesAdapter.SIMPLE_DATE_FORMAT.format(calendar.getTime()));
Spinner spinnerUnexpectedOrderReasons = (Spinner) rowView.findViewById(R.id.spinnerUnexpectedQuantityReasons);
ANDROID.assertThat(spinnerUnexpectedOrderReasons).isVisible();
}
开发者ID:clintonhealthaccess,项目名称:chailmis-android,代码行数:17,代码来源:SelectedOrderCommoditiesAdapterTest.java
示例7: shouldShowSpinnerForUnexpectedOrderReasonsIfEndOrderDateIsChangedWhenOrderReasonIsRoutine
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldShowSpinnerForUnexpectedOrderReasonsIfEndOrderDateIsChangedWhenOrderReasonIsRoutine() throws Exception {
Date currentDate = new Date();
commodityViewModel.setOrderReasonPosition(null);
commodityViewModel.setOrderPeriodEndDate(currentDate);
View rowView = getRowView();
TextView textView = (TextView) rowView.findViewById(R.id.textViewEndDate);
Calendar calendar = Calendar.getInstance();
calendar.setTime(currentDate);
calendar.add(Calendar.DAY_OF_MONTH, 2);
textView.setText(SelectedOrderCommoditiesAdapter.SIMPLE_DATE_FORMAT.format(calendar.getTime()));
Spinner spinnerUnexpectedOrderReasons = (Spinner) rowView.findViewById(R.id.spinnerUnexpectedQuantityReasons);
ANDROID.assertThat(spinnerUnexpectedOrderReasons).isVisible();
}
开发者ID:clintonhealthaccess,项目名称:chailmis-android,代码行数:17,代码来源:SelectedOrderCommoditiesAdapterTest.java
示例8: shouldPrePopulateOrderPeriodStartAndEndDateWhenOrderReasonIsRoutine
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldPrePopulateOrderPeriodStartAndEndDateWhenOrderReasonIsRoutine() throws Exception {
Date currentDate = new Date();
commodities = new ArrayList<>();
commodityViewModel.setOrderPeriodStartDate(currentDate);
commodities.add(commodityViewModel);
adapter = new SelectedOrderCommoditiesAdapter(orderActivity, list_item_layout, commodities, orderReasons, routine);
View rowView = getRowView();
TextView textViewStartDate = (TextView) rowView.findViewById(R.id.textViewStartDate);
TextView textViewEndDate = (TextView) rowView.findViewById(R.id.textViewEndDate);
String dateString = SIMPLE_DATE_FORMAT.format(currentDate);
String endDateString = SIMPLE_DATE_FORMAT.format(commodityViewModel.getExpectedEndDate());
ANDROID.assertThat(textViewStartDate).hasText(dateString);
assertThat(textViewEndDate.getText().toString(), is(endDateString));
}
开发者ID:clintonhealthaccess,项目名称:chailmis-android,代码行数:19,代码来源:SelectedOrderCommoditiesAdapterTest.java
示例9: shouldSetCommodityName
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldSetCommodityName() throws Exception {
ArrayList<FacilityCommodityConsumptionRH1ReportItem> reportItems = new ArrayList<>();
String commodityName = "food";
FacilityCommodityConsumptionRH1ReportItem reportItem = new FacilityCommodityConsumptionRH1ReportItem(new Commodity(commodityName));
reportItem.setValues(newArrayList(Arrays.asList(new ConsumptionValue(new Date(), 5), new ConsumptionValue(new Date(), 5))));
reportItems.add(reportItem);
FacilityCommodityConsumptionReportRH1Adapter adapter = new FacilityCommodityConsumptionReportRH1Adapter(Robolectric.application,
R.layout.facility_commodity_consumption_report_rh1_item, reportItems);
LinearLayout view = (LinearLayout) adapter.getView(0, null, null);
assertThat(view.getChildCount(), is(3));
TextView textViewName = (TextView) view.getChildAt(0);
ANDROID.assertThat(textViewName).hasText(commodityName);
}
开发者ID:clintonhealthaccess,项目名称:chailmis-android,代码行数:17,代码来源:FacilityCommoditityConsumptionReportRH1AdapterTest.java
示例10: shouldSetFirstConsumptionValue
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldSetFirstConsumptionValue() throws Exception {
ArrayList<FacilityCommodityConsumptionRH1ReportItem> reportItems = new ArrayList<>();
String commodityName = "food";
FacilityCommodityConsumptionRH1ReportItem reportItem = new FacilityCommodityConsumptionRH1ReportItem(new Commodity(commodityName));
int firstConsumptionValue = 20;
reportItem.setValues(newArrayList(Arrays.asList(new ConsumptionValue(new Date(), firstConsumptionValue), new ConsumptionValue(new Date(), 5))));
reportItems.add(reportItem);
FacilityCommodityConsumptionReportRH1Adapter adapter = new FacilityCommodityConsumptionReportRH1Adapter(Robolectric.application,
R.layout.facility_commodity_consumption_report_rh1_item, reportItems);
LinearLayout view = (LinearLayout) adapter.getView(0, null, null);
assertThat(view.getChildCount(), is(3));
TextView textViewName = (TextView) view.getChildAt(1);
ANDROID.assertThat(textViewName).hasText(String.valueOf(firstConsumptionValue));
}
开发者ID:clintonhealthaccess,项目名称:chailmis-android,代码行数:18,代码来源:FacilityCommoditityConsumptionReportRH1AdapterTest.java
示例11: shouldSetSecondConsumptionValue
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldSetSecondConsumptionValue() throws Exception {
ArrayList<FacilityCommodityConsumptionRH1ReportItem> reportItems = new ArrayList<>();
String commodityName = "food";
FacilityCommodityConsumptionRH1ReportItem reportItem = new FacilityCommodityConsumptionRH1ReportItem(new Commodity(commodityName));
int firstConsumptionValue = 20;
int secondConsumptionValue = 5;
reportItem.setValues(newArrayList(Arrays.asList(new ConsumptionValue(new Date(), firstConsumptionValue), new ConsumptionValue(new Date(), secondConsumptionValue))));
reportItems.add(reportItem);
FacilityCommodityConsumptionReportRH1Adapter adapter = new FacilityCommodityConsumptionReportRH1Adapter(Robolectric.application,
R.layout.facility_commodity_consumption_report_rh1_item, reportItems);
LinearLayout view = (LinearLayout) adapter.getView(0, null, null);
assertThat(view.getChildCount(), is(3));
TextView textViewName = (TextView) view.getChildAt(2);
ANDROID.assertThat(textViewName).hasText(String.valueOf(secondConsumptionValue));
}
开发者ID:clintonhealthaccess,项目名称:chailmis-android,代码行数:19,代码来源:FacilityCommoditityConsumptionReportRH1AdapterTest.java
示例12: getAdView_shouldSetupOnCloseListener
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Ignore("Mraid 2.0")
@Test
public void getAdView_shouldSetupOnCloseListener() throws Exception {
reset(mraidWebView);
ArgumentCaptor<MraidListener> captor = ArgumentCaptor.forClass(MraidListener.class);
View actualAdView = subject.getAdView();
assertThat(actualAdView).isSameAs(mraidWebView);
verify(mraidController).setMraidListener(captor.capture());
captor.getValue().onClose();
ANDROID.assertThat(subject).isFinishing();
}
示例13: shouldOnlyShowStartMonthAndStartYear
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldOnlyShowStartMonthAndStartYear() throws Exception {
FacilityConsumptionReportRH1Activity activity = getActivity();
ANDROID.assertThat(activity.spinnerStartingYear).isVisible();
ANDROID.assertThat(activity.spinnerEndingYear).isInvisible();
ANDROID.assertThat(activity.spinnerStartingMonth).isVisible();
ANDROID.assertThat(activity.spinnerEndingMonth).isInvisible();
}
开发者ID:clintonhealthaccess,项目名称:chailmis-android,代码行数:10,代码来源:FacilityConsumptionReportRH1ActivityTest.java
示例14: testThatAnelgesisticsShouldShowTwoReportsWhenClicked
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void testThatAnelgesisticsShouldShowTwoReportsWhenClicked() throws Exception {
commodityService.initialise(new User("test", "pass"));
ReportsActivity reportsActivity = getReportsActivity();
LinearLayout categoryLayout = (LinearLayout) reportsActivity.findViewById(R.id.layoutCategories);
ListView reportButtonsLayout = (ListView) reportsActivity.findViewById(R.id.listViewCategoryReports);
int buttonAmount = categoryLayout.getChildCount();
assertThat(buttonAmount, is(7));
Button button = (Button) categoryLayout.getChildAt(0);
ANDROID.assertThat(button).hasTextString("Anti Malarials");
button.performClick();
assertThat(reportButtonsLayout.getAdapter().getCount(), is(2));
}
示例15: shouldDisableAndHideAllocationIfNotRecievingFromLGA
import org.fest.assertions.api.ANDROID; //导入依赖的package包/类
@Test
public void shouldDisableAndHideAllocationIfNotRecievingFromLGA() throws Exception {
ReceiveActivity receiveActivity = getReceiveActivity();
setSource(receiveActivity, application.getString(R.string.zonal_store_for_receive));
ANDROID.assertThat(receiveActivity.textViewAllocationId).isDisabled();
ANDROID.assertThat(receiveActivity.textViewAllocationId).isInvisible();
ANDROID.assertThat(receiveActivity.textViewAllocationLabel).isInvisible();
assertThat(receiveActivity.textViewAllocationId.getError(), nullValue());
}