/mycila-testing/tags/mycila-testing-2.1/mycila-testing-api/src/main/java/com/mycila/testing/core/TestExecutionImpl.java

http://mycila.googlecode.com/ · Java · 80 lines · 47 code · 15 blank · 18 comment · 0 complexity · 94aada7e050099a6988cb77dafa5a772 MD5 · raw file

  1. /**
  2. * Copyright (C) 2008 Mathieu Carbou <mathieu.carbou@gmail.com>
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.mycila.testing.core;
  17. import com.mycila.testing.core.api.Attributes;
  18. import static com.mycila.testing.core.api.Ensure.*;
  19. import com.mycila.testing.core.api.Step;
  20. import com.mycila.testing.core.api.TestContext;
  21. import com.mycila.testing.core.api.TestExecution;
  22. import java.lang.reflect.Method;
  23. /**
  24. * @author Mathieu Carbou (mathieu.carbou@gmail.com)
  25. */
  26. final class TestExecutionImpl implements TestExecution {
  27. private final ExecutionImpl execution;
  28. private boolean mustSkip;
  29. TestExecutionImpl(TestContext context, Method method) {
  30. notNull("Test context", context);
  31. notNull("Test method", method);
  32. execution = new ExecutionImpl(context, method);
  33. }
  34. public boolean mustSkip() {
  35. return mustSkip;
  36. }
  37. public void setSkip(boolean mustSkip) {
  38. this.mustSkip = mustSkip;
  39. }
  40. public Attributes attributes() {
  41. return execution.attributes();
  42. }
  43. TestExecutionImpl changeStep(Step step) {
  44. execution.changeStep(step);
  45. return this;
  46. }
  47. public Step step() {
  48. return execution.step();
  49. }
  50. public Method method() {
  51. return execution.method();
  52. }
  53. public TestContext context() {
  54. return execution.context();
  55. }
  56. public Throwable throwable() {
  57. return execution.throwable();
  58. }
  59. public boolean hasFailed() {
  60. return execution.hasFailed();
  61. }
  62. public void setThrowable(Throwable throwable) {
  63. execution.setThrowable(throwable);
  64. }
  65. }