Pergunta

Consider the test messageTest(see below)

  publicclassmessageTest { 
    @Test
    publicvoidtestMessageLength() {
    String message = "Test Message";

    }
}

Add Assert method to verify that text in message contains 12 characters.

Nenhuma solução correta

Outras dicas

You can assert it with actual length and expected length of the String. You need to import either junit Assert or testNg Assert, in order to use it

@Test
    publicvoidtestMessageLength() {
    String message = "Test Message";
    Assert.assertEquals(message.length(), 12);
    }

String.length()

If that is what you are looking for.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top