سؤال

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.

لا يوجد حل صحيح

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top