Package org.eclipse.jetty.toolchain.test
Class StringAssert
- java.lang.Object
-
- org.eclipse.jetty.toolchain.test.StringAssert
-
public final class StringAssert extends java.lang.Object
Collection of common asserts for Strings.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
StringAssert()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assertContains(java.lang.String msg, java.lang.String haystack, java.lang.String needle)
Asserts that string (haystack
) contains specified text (needle
).static void
assertContains(java.lang.String msg, java.lang.String haystack, java.lang.String needle, int offset)
Asserts that string (haystack
) contains specified text (needle
), starting at offset (inhaystack
).static void
assertContainsSame(java.lang.String msg, java.util.List<java.lang.String> linesExpected, java.util.List<java.lang.String> linesActual)
Asserts that the list of String lines contains the same lines (without a regard for the order of those lines)static void
assertNotContains(java.lang.String msg, java.lang.String haystack, java.lang.String needle)
Asserts that string (haystack
) does not contain specified text (needle
).static void
assertNotContains(java.lang.String msg, java.lang.String haystack, java.lang.String needle, int offset)
Asserts that string (haystack
) does not contain specified text (needle
), starting at offset (inhaystack
).static void
assertStartsWith(java.lang.String msg, java.lang.String haystack, java.lang.String expected)
Asserts that the string (haystack
) starts with the string (expected
)
-
-
-
Method Detail
-
assertContains
public static void assertContains(java.lang.String msg, java.lang.String haystack, java.lang.String needle)
Asserts that string (haystack
) contains specified text (needle
).- Parameters:
msg
- the assertion messagehaystack
- the text to search inneedle
- the text to search for
-
assertContains
public static void assertContains(java.lang.String msg, java.lang.String haystack, java.lang.String needle, int offset)
Asserts that string (haystack
) contains specified text (needle
), starting at offset (inhaystack
).- Parameters:
msg
- the assertion messagehaystack
- the text to search inneedle
- the text to search foroffset
- the offset in (haystack) to perform search from
-
assertContainsSame
public static void assertContainsSame(java.lang.String msg, java.util.List<java.lang.String> linesExpected, java.util.List<java.lang.String> linesActual)
Asserts that the list of String lines contains the same lines (without a regard for the order of those lines)- Parameters:
msg
- the assertion messagelinesExpected
- the list of expected lineslinesActual
- the list of actual lines
-
assertNotContains
public static void assertNotContains(java.lang.String msg, java.lang.String haystack, java.lang.String needle)
Asserts that string (haystack
) does not contain specified text (needle
).- Parameters:
msg
- the assertion messagehaystack
- the text to search inneedle
- the text to search for
-
assertNotContains
public static void assertNotContains(java.lang.String msg, java.lang.String haystack, java.lang.String needle, int offset)
Asserts that string (haystack
) does not contain specified text (needle
), starting at offset (inhaystack
).- Parameters:
msg
- the assertion messagehaystack
- the text to search inneedle
- the text to search foroffset
- the offset in (haystack) to perform search from
-
assertStartsWith
public static void assertStartsWith(java.lang.String msg, java.lang.String haystack, java.lang.String expected)
Asserts that the string (haystack
) starts with the string (expected
)- Parameters:
msg
- the assertion messagehaystack
- the text to search inexpected
- the expected starts with text
-
-