0

I'm joining a list of strings by using TextUtils.join but it's returning NULL. I'm doing this on a simple unit test.

Here's the code in question:

@Test
public void testJoinText(){
    List<String> letters = Lists.newArrayList();
    letters.add("A");
    letters.add("B");
    letters.add("C");
    letters.add("D");
    letters.add("E");

    String joinedLetters = TextUtils.join(";", letters); //This is returning null.
}

Am I doing something wrong?

Kim Montano
  • 2,185
  • 4
  • 26
  • 39
  • 1
    possible duplicate of https://stackoverflow.com/questions/35763289/need-help-to-write-a-unit-test-using-mockito-and-junit4 – Gaurav Chauhan Oct 18 '18 at 04:13

1 Answers1

1

TextUtils class is in android.util.*. So you cannot use TextUtils' functions in test package. You should test this code in androidTest package.

sso.techie
  • 136
  • 7