Assertion { public static void checkArgument( boolean condition, String messagePattern, Object ... arguments ) { if( !condition ) { throw new IllegalArgumentException( formatErrorMessage( messagePattern, arguments ) ); } }  static void checkArgument( boolean condition, String messagePattern, Object ... arguments ); static void checkState( boolean condition, String messagePattern, Object ... arguments); static String formatErrorMessage( String messagePattern, Object... arguments );  }
@Test public void checkArgumentWithValidCondition() { Throwable actual = thrownBy( () -> Assertion.checkArgument( true, MESSAGE_PATTERN, ARGUMENT_ONE, ARGUMENT_TWO ) ); assertThat( actual ).isNull(); }
@Test public void checkArgumentWithInvalidCondition() { Throwable actual = thrownBy( () -> Assertion.checkArgument( false, MESSAGE_PATTERN, ARGUMENT_ONE, ARGUMENT_TWO ) ); assertThat( actual ) .isInstanceOf( IllegalArgumentException.class ) .hasMessage( EXPECTED_MESSAGE ); }