Class: VertxUnit::TestCompletion

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_completion.rb

Overview

This object provides callback-ability for the end of a test suite.

Instance Method Summary (collapse)

Instance Method Details

- (void) await(timeoutMillis = nil)

This method returns an undefined value.

Cause the current thread to wait until the test suite completes with a configurable timeout.

If completion times out or the current thread is interrupted, an exception will be thrown.

Parameters:

  • timeoutMillis (Fixnum) (defaults to: nil)
    the timeout in milliseconds

Raises:

  • (ArgumentError)


65
66
67
68
69
70
71
72
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_completion.rb', line 65

def await(timeoutMillis=nil)
  if !block_given? && timeoutMillis == nil
    return @j_del.java_method(:await, []).call()
  elsif timeoutMillis.class == Fixnum && !block_given?
    return @j_del.java_method(:await, [Java::long.java_class]).call(timeoutMillis)
  end
  raise ArgumentError, "Invalid arguments when calling await(timeoutMillis)"
end

- (void) await_success(timeoutMillis = nil)

This method returns an undefined value.

Cause the current thread to wait until the test suite completes and succeeds with a configurable timeout.

If completion times out or the current thread is interrupted or the suite fails, an exception will be thrown.

Parameters:

  • timeoutMillis (Fixnum) (defaults to: nil)
    the timeout in milliseconds

Raises:

  • (ArgumentError)


78
79
80
81
82
83
84
85
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_completion.rb', line 78

def await_success(timeoutMillis=nil)
  if !block_given? && timeoutMillis == nil
    return @j_del.java_method(:awaitSuccess, []).call()
  elsif timeoutMillis.class == Fixnum && !block_given?
    return @j_del.java_method(:awaitSuccess, [Java::long.java_class]).call(timeoutMillis)
  end
  raise ArgumentError, "Invalid arguments when calling await_success(timeoutMillis)"
end

- (true, false) completed?

@return true if the test suite completed

Returns:

  • (true, false)

Raises:

  • (ArgumentError)


28
29
30
31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_completion.rb', line 28

def completed?
  if !block_given?
    return @j_del.java_method(:isCompleted, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling completed?()"
end

- (true, false) failed?

@return true if the test suite completed and failed

Returns:

  • (true, false)

Raises:

  • (ArgumentError)


44
45
46
47
48
49
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_completion.rb', line 44

def failed?
  if !block_given?
    return @j_del.java_method(:isFailed, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling failed?()"
end

- (void) handler { ... }

This method returns an undefined value.

Completion handler for the end of the test, the result is successful when all test cases pass otherwise it is failed.

Yields:

  • the completion handler

Raises:

  • (ArgumentError)


54
55
56
57
58
59
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_completion.rb', line 54

def handler
  if block_given?
    return @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling handler()"
end

- (void) resolve(future = nil)

This method returns an undefined value.

Completes the future when all test cases of the test suite passes, otherwise fails it.

Parameters:

  • future (::Vertx::Future) (defaults to: nil)
    the future to resolve

Raises:

  • (ArgumentError)


20
21
22
23
24
25
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_completion.rb', line 20

def resolve(future=nil)
  if future.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:resolve, [Java::IoVertxCore::Future.java_class]).call(future.j_del)
  end
  raise ArgumentError, "Invalid arguments when calling resolve(future)"
end

- (true, false) succeeded?

@return true if the test suite completed and succeeded

Returns:

  • (true, false)

Raises:

  • (ArgumentError)


36
37
38
39
40
41
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_completion.rb', line 36

def succeeded?
  if !block_given?
    return @j_del.java_method(:isSucceeded, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling succeeded?()"
end