congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TextViewAssert.hasTextString
Code IndexAdd Tabnine to your IDE (free)

How to use
hasTextString
method
in
org.assertj.android.api.widget.TextViewAssert

Best Java code snippets using org.assertj.android.api.widget.TextViewAssert.hasTextString (Showing top 12 results out of 315)

origin: hidroh/materialistic

@Test
public void testTrimHtmlWhitespaces() {
  TextView textView = new TextView(context);
  textView.setText(AppUtils.fromHtml("<p>paragraph</p><p><br/><br/><br/></p>"));
  assertThat(textView).hasTextString("paragraph");
  textView.setText(AppUtils.fromHtml(""));
  assertThat(textView).hasTextString("");
  textView.setText(AppUtils.fromHtml("paragraph"));
  assertThat(textView).hasTextString("paragraph");
}
origin: hidroh/materialistic

@Test
public void testStory() {
  item.setIsViewed(true);
  verify(itemManager).getItem(any(), eq(ItemManager.MODE_DEFAULT), itemListener.capture());
  itemListener.getValue().onResponse(item);
  RecyclerView.ViewHolder holder = adapter.getViewHolder(0);
  assertThat((View) holder.itemView.findViewById(R.id.bookmarked)).isNotVisible();
  assertThat((TextView) holder.itemView.findViewById(R.id.rank)).hasTextString("46");
  assertThat((TextView) holder.itemView.findViewById(R.id.title)).hasTextString("title");
  assertThat((TextView) holder.itemView.findViewById(R.id.comment))
      .isVisible()
      .isEmpty();
  assertViewed();
}
origin: hidroh/materialistic

@Test
public void testBinding() {
  verify(userManager).getUser(eq("username"), userCaptor.capture());
  userCaptor.getValue().onResponse(user);
  assertThat((TextView) activity.findViewById(R.id.title)).hasTextString("username (2,016)");
  assertThat((TextView) activity.findViewById(R.id.about)).hasTextString("about");
  assertEquals(activity.getResources().getQuantityString(R.plurals.submissions_count, 2, 2),
      ((TabLayout) activity.findViewById(R.id.tab_layout)).getTabAt(0).getText());
  assertEquals(2, (((RecyclerView) activity.findViewById(R.id.recycler_view)).getAdapter())
      .getItemCount());
  shadowOf(activity).recreate();
  assertThat((TextView) activity.findViewById(R.id.title)).hasTextString("username (2,016)");
}
origin: hidroh/materialistic

@Test
public void testQuote() {
  assertTrue(shadowOf(activity).getOptionsMenu().findItem(R.id.menu_quote).isVisible());
  ((EditText) activity.findViewById(R.id.edittext_body)).setText("Reply");
  shadowOf(activity).clickMenuItem(R.id.menu_quote);
  assertThat((EditText) activity.findViewById(R.id.edittext_body))
      .hasTextString("> Paragraph 1\n\n> Paragraph 2\n\nReply");
}
origin: hidroh/materialistic

@Test
public void testDeriveTitleAndUrl() {
  controller.pause().stop().destroy();
  controller = Robolectric.buildActivity(SubmitActivity.class,
      new Intent().putExtra(Intent.EXTRA_TEXT, "title - http://example.com"));
  activity = controller
      .create().start().resume().visible().get();
  assertThat((EditText) activity.findViewById(R.id.edittext_title)).hasTextString("title");
  assertThat((EditText) activity.findViewById(R.id.edittext_content)).hasTextString("http://example.com");
  shadowOf(activity).recreate();
  assertThat((EditText) activity.findViewById(R.id.edittext_title)).hasTextString("title");
  assertThat((EditText) activity.findViewById(R.id.edittext_content)).hasTextString("http://example.com");
}
origin: hidroh/materialistic

@Test
public void testCommentBinding() {
  verify(userManager).getUser(eq("username"), userCaptor.capture());
  userCaptor.getValue().onResponse(user);
  RecyclerView recyclerView = (RecyclerView) activity.findViewById(R.id.recycler_view);
  verify(itemManager).getItem(eq("1"),
      eq(ItemManager.MODE_DEFAULT),
      itemCaptor.capture());
  itemCaptor.getValue().onResponse(new TestHnItem(1L) {
    @Override
    public String getText() {
      return "content";
    }
    @Override
    public String getParent() {
      return "2";
    }
  });
  RecyclerView.ViewHolder viewHolder = customShadowOf(recyclerView.getAdapter()).getViewHolder(0);
  assertThat((View) viewHolder.itemView.findViewById(R.id.title)).isNotVisible();
  assertThat((TextView) viewHolder.itemView.findViewById(R.id.text))
      .isVisible()
      .hasTextString("content");
  viewHolder.itemView.findViewById(R.id.comment).performClick();
  assertThat(shadowOf(activity).getNextStartedActivity())
      .hasComponent(activity, ThreadPreviewActivity.class)
      .hasExtra(ThreadPreviewActivity.EXTRA_ITEM);
}
origin: hidroh/materialistic

assertThat((TextView) viewHolder.itemView.findViewById(R.id.title))
    .isVisible()
    .hasTextString("title");
assertThat((TextView) viewHolder.itemView.findViewById(R.id.text))
    .isVisible()
    .hasTextString("content");
viewHolder.itemView.findViewById(R.id.comment).performClick();
assertThat(shadowOf(activity).getNextStartedActivity())
origin: hidroh/materialistic

RecyclerView.ViewHolder viewHolder = CustomShadows.customShadowOf(recyclerView.getAdapter())
    .getViewHolder(0);
assertThat((TextView) viewHolder.itemView.findViewById(R.id.text)).hasTextString("text");
assertThat((View) viewHolder.itemView.findViewById(R.id.comment)).isVisible();
viewHolder.itemView.findViewById(R.id.comment).performClick();
origin: hidroh/materialistic

@Test
public void testDeriveEmptyTitle() {
  controller.pause().stop().destroy();
  controller = Robolectric.buildActivity(SubmitActivity.class,
      new Intent().putExtra(Intent.EXTRA_TEXT, " : http://example.com"));
  activity = controller
      .create().start().resume().visible().get();
  assertThat((EditText) activity.findViewById(R.id.edittext_title)).isEmpty();
  assertThat((EditText) activity.findViewById(R.id.edittext_content)).hasTextString("http://example.com");
}
origin: hidroh/materialistic

@Test
public void testDeriveNoMatches() {
  controller.pause().stop().destroy();
  controller = Robolectric.buildActivity(SubmitActivity.class,
      new Intent().putExtra(Intent.EXTRA_TEXT, "title - http://example.com blah blah"));
  activity = controller
      .create().start().resume().visible().get();
  assertThat((EditText) activity.findViewById(R.id.edittext_title)).isEmpty();
  assertThat((EditText) activity.findViewById(R.id.edittext_content))
      .hasTextString("title - http://example.com blah blah");
}
origin: hidroh/materialistic

@Test
public void testToggle() {
  assertThat((View) activity.findViewById(R.id.toggle)).isVisible();
  assertThat((View) activity.findViewById(R.id.text)).isNotVisible();
  activity.findViewById(R.id.toggle).performClick();
  assertThat((View) activity.findViewById(R.id.text)).isVisible();
  assertThat((TextView) activity.findViewById(R.id.text))
      .hasTextString("Paragraph 1\n\nParagraph 2");
  activity.findViewById(R.id.toggle).performClick();
  assertThat((View) activity.findViewById(R.id.text)).isNotVisible();
}
origin: passy/Android-DirectoryChooser

@Test
public void testCreateDirectoryDialogAllowFolderNameModification() {
  final String directoryName = "mydir";
  final DirectoryChooserFragment fragment = DirectoryChooserFragment.newInstance(
      DirectoryChooserConfig.builder()
          .newDirectoryName(directoryName)
          .initialDirectory("")
          .allowReadOnlyDirectory(false)
          .allowNewDirectoryNameModification(true)
          .build());
  startFragment(fragment, DirectoryChooserActivityMock.class);
  fragment.onOptionsItemSelected(new TestMenuItem() {
    @Override
    public int getItemId() {
      return R.id.new_folder_item;
    }
  });
  final AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog();
  final ShadowAlertDialog shadowAlertDialog = Shadows.shadowOf(dialog);
  assertThat(shadowAlertDialog.getTitle()).isEqualTo("Create folder");
  assertThat(ShadowDialog.getShownDialogs()).contains(dialog);
  final TextView msgView = (TextView) dialog.findViewById(R.id.msgText);
  assertThat(msgView).hasText("Create new folder with name \"mydir\"?");
  final EditText editText = (EditText) dialog.findViewById(R.id.editText);
  assertThat(editText).isVisible();
  assertThat(editText).hasTextString(directoryName);
}
org.assertj.android.api.widgetTextViewAsserthasTextString

Popular methods of TextViewAssert

  • <init>
  • hasText
  • isVisible
  • containsText
  • doesNotContainText
  • hasCurrentTextColor
  • isEmpty
  • isGone
  • isNotNull
  • isNotVisible

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getContentResolver (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • JFileChooser (javax.swing)
  • JTextField (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now