Question

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.

No correct solution

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top