コード例 #1
0
  @Test
  @Named("null if spec description is empty")
  @Order(1)
  public void _nullIfSpecDescriptionIsEmpty() throws Exception {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package test");
    _builder.newLine();
    _builder.append("describe \"\"{}");
    this._modelStore.parseSpec(_builder);
    String _qualifiedName = this.qualifiedName();
    Matcher<String> _nullValue = CoreMatchers.<String>nullValue();
    boolean _should_be = Should.<String>should_be(_qualifiedName, _nullValue);
    Assert.assertTrue(
        "\nExpected qualifiedName should be null but"
            + "\n     qualifiedName is "
            + new StringDescription().appendValue(_qualifiedName).toString()
            + "\n",
        _should_be);

    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("describe \"\"{}");
    this._modelStore.parseSpec(_builder_1);
    String _qualifiedName_1 = this.qualifiedName();
    Matcher<String> _nullValue_1 = CoreMatchers.<String>nullValue();
    boolean _should_be_1 = Should.<String>should_be(_qualifiedName_1, _nullValue_1);
    Assert.assertTrue(
        "\nExpected qualifiedName should be null but"
            + "\n     qualifiedName is "
            + new StringDescription().appendValue(_qualifiedName_1).toString()
            + "\n",
        _should_be_1);
  }
  /**
   * If you want to express how an object should behave, you can use `should`. It passes if the
   * result of the left expression is equal to the result of the right expression. You can also use
   * `not` to assert that both expressions have different results. You have already seen the short
   * cut `=>` which has the same effect as `should be`.
   */
  @Test
  @Named("\\\'should\\\' and `=>`")
  @Order(11)
  public void _shouldAnd() throws Exception {
    boolean _should_be = Should.<Boolean>should_be(Boolean.valueOf(true), true);
    Assert.assertTrue(
        "\nExpected true should be true but"
            + "\n     true should be true is "
            + new StringDescription().appendValue(null).toString()
            + "\n",
        _should_be);

    boolean _doubleArrow =
        Should.operator_doubleArrow(Boolean.valueOf(false), Boolean.valueOf(false));
    Assert.assertTrue(
        "\nExpected false => false but"
            + "\n     false => false is "
            + new StringDescription().appendValue(_doubleArrow).toString()
            + "\n",
        _doubleArrow);

    int _plus = (1 + 1);
    boolean _should_be_1 = Should.should_be(Integer.valueOf(_plus), Integer.valueOf(1));
    Assert.assertFalse(
        "\nExpected 1 + 1 should not be 1 but"
            + "\n     1 + 1 is "
            + new StringDescription().appendValue(Integer.valueOf(_plus)).toString()
            + "\n",
        _should_be_1);

    int _plus_1 = (1 + 1);
    boolean _doubleArrow_1 =
        Should.operator_doubleArrow(Integer.valueOf(_plus_1), Integer.valueOf(2));
    Assert.assertTrue(
        "\nExpected 1 + 1 => 2 but"
            + "\n     1 + 1 is "
            + new StringDescription().appendValue(Integer.valueOf(_plus_1)).toString()
            + "\n",
        _doubleArrow_1);
  }
コード例 #3
0
 @Test
 @Named("implementedStep.isPending[] should be false")
 @Order(2)
 public void _implementedStepIsPendingShouldBeFalse() throws Exception {
   Given _implementedStep = Features.implementedStep();
   boolean _isPending = _implementedStep.isPending();
   boolean _should_be = Should.<Boolean>should_be(Boolean.valueOf(_isPending), false);
   Assert.assertTrue(
       "\nExpected implementedStep.isPending() should be false but"
           + "\n     implementedStep.isPending() is "
           + new StringDescription().appendValue(Boolean.valueOf(_isPending)).toString()
           + "\n     implementedStep is "
           + new StringDescription().appendValue(_implementedStep).toString()
           + "\n",
       _should_be);
 }
コード例 #4
0
 @Test
 @Named("stepWithoutImplementation.isPending[] should be true")
 @Order(1)
 public void _stepWithoutImplementationIsPendingShouldBeTrue() throws Exception {
   Given _stepWithoutImplementation = Features.stepWithoutImplementation();
   boolean _isPending = _stepWithoutImplementation.isPending();
   boolean _should_be = Should.<Boolean>should_be(Boolean.valueOf(_isPending), true);
   Assert.assertTrue(
       "\nExpected stepWithoutImplementation.isPending() should be true but"
           + "\n     stepWithoutImplementation.isPending() is "
           + new StringDescription().appendValue(Boolean.valueOf(_isPending)).toString()
           + "\n     stepWithoutImplementation is "
           + new StringDescription().appendValue(_stepWithoutImplementation).toString()
           + "\n",
       _should_be);
 }