string comparison + linkedList

Asked

Viewed 71 times

1

Good evening, I am trying to compare a string with a Linked list but I am not having success, the Linked list is being returned a value of another function but I will put here the output of the Linked list.

assertEquals("nome composto",frase.converterCamelCase("nomeComposto"));

the test accuses what happened.

java.lang.Assertionerror: expected:< compound name> but was:<[name, compound]>

how can I make this test pass?

  • the method has to return a linkedlist, because this expresses that the method has to return this type.

  • I was able to help?

1 answer

1

What you really want to test is the output of this method converterCamelCase, so I would do the following, test that for each item present in LinkedList returned this method is in accordance with the string passed as parameter, in code it would look something like this:

assertEquals("nome",frase.converterCamelCase("nomeComposto").get(0));
assertEquals("composto",frase.converterCamelCase("nomeComposto").get(1));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.