Package org.araneaframework.uilib.widgets.lists.tests.mock

Examples of org.araneaframework.uilib.widgets.lists.tests.mock.MockSqlStringExpression


    // SQL String
    assertEquals("SqlCollectionExpression must return an empty string",
        new SqlCollectionExpression().toSqlString(), "");
    assertEquals("SqlCollectionExpression must return \"a\"",
        new SqlCollectionExpression().add(
            new MockSqlStringExpression("a")).toSqlString(), "a");
    assertEquals("SqlCollectionExpression must return \"a, b\"",
        new SqlCollectionExpression().add(
            new MockSqlStringExpression("a")).add(
            new MockSqlStringExpression("b")).toSqlString(), "a, b");

    // SQL arguments
    assertTrue("SqlCollectionExpression must return an empty array", Arrays
        .equals(new SqlCollectionExpression().getValues(),
            new Object[0]));
    assertTrue("SqlCollectionExpression must return an empty array",
        Arrays
            .equals(
                new SqlCollectionExpression().add(
                    new MockSqlStringExpression(
                        new Object[0])).add(
                    new MockSqlStringExpression(
                        new Object[0])).getValues(),
                new Object[0]));
    assertTrue(
        "SqlCollectionExpression must return (\"a\", \"b\") as values",
        Arrays.equals(new SqlCollectionExpression().add(
            new MockSqlStringExpression(new Object[] { "a" })).add(
            new MockSqlStringExpression(new Object[] { "b" }))
            .getValues(), new Object[] { "a", "b" }));
  }
View Full Code Here


    // SQL String
    assertEquals("SqlProcedureExpression must return \"a()\"",
        new SqlProcedureExpression("a").toSqlString(), "a()");
    assertEquals("SqlProcedureExpression must return \"a(b)\"",
        new SqlProcedureExpression("a").add(
            new MockSqlStringExpression("b")).toSqlString(), "a(b)");
    assertEquals("SqlProcedureExpression must return \"a(b, c)\"",
        new SqlProcedureExpression("a").add(
            new MockSqlStringExpression("b")).add(
            new MockSqlStringExpression("c")).toSqlString(),
        "a(b, c)");

    // SQL arguments
    assertTrue("SqlProcedureExpression must return an empty array",
        Arrays.equals(new SqlProcedureExpression("x").getValues(),
            new Object[0]));
    assertTrue("SqlProcedureExpression must return an empty array",
        Arrays
            .equals(
                new SqlProcedureExpression("x").add(
                    new MockSqlStringExpression(
                        new Object[0])).add(
                    new MockSqlStringExpression(
                        new Object[0])).getValues(),
                new Object[0]));
    assertTrue(
        "SqlProcedureExpression must return (\"a\", \"b\") as values",
        Arrays.equals(new SqlProcedureExpression("x").add(
            new MockSqlStringExpression(new Object[] { "a" })).add(
            new MockSqlStringExpression(new Object[] { "b" }))
            .getValues(), new Object[] { "a", "b" }));
  }
View Full Code Here

      fail("Constructing of SqlEqualsExpression with NULL as SqlExpression arguments should fail");
    } catch (Exception e) {
      // normal
    }
    try {
      new SqlEqualsExpression(null, new MockSqlStringExpression("a"));
      fail("Constructing of SqlEqualsExpression with NULL as first SqlExpression argument should fail");
    } catch (Exception e) {
      // normal
    }
    try {
      new SqlEqualsExpression(new MockSqlStringExpression("a"), null);
      fail("Constructing of SqlEqualsExpression with NULL as second SqlExpression argument should fail");
    } catch (Exception e) {
      // normal
    }

    // SQL String
    assertEquals("SqlEqualsExpression must return \" = \"",
        new SqlEqualsExpression(new MockSqlStringExpression(""),
            new MockSqlStringExpression("")).toSqlString(), " = ");
    assertEquals("SqlEqualsExpression must return \"a = b\"",
        new SqlEqualsExpression(new MockSqlStringExpression("a"),
            new MockSqlStringExpression("b")).toSqlString(),
        "a = b");

    // SQL arguments
    assertTrue("SqlEqualsExpression must return an empty array", Arrays
        .equals(new SqlEqualsExpression(
            new MockSqlStringExpression(""),
            new MockSqlStringExpression("")).getValues(),
            new Object[0]));
    assertTrue("SqlEqualsExpression must return an empty array", Arrays
        .equals(new SqlEqualsExpression(new MockSqlStringExpression(
            new Object[] { "a" }), new MockSqlStringExpression(
            new Object[] { "b" })).getValues(), new Object[] { "a",
            "b" }));
  }
View Full Code Here

      fail("Constructing of SqlGreaterThanExpression with NULL as SqlExpression arguments should fail");
    } catch (Exception e) {
      // normal
    }
    try {
      new SqlGreaterThanExpression(null, new MockSqlStringExpression("a"));
      fail("Constructing of SqlGreaterThanExpression with NULL as first SqlExpression argument should fail");
    } catch (Exception e) {
      // normal
    }
    try {
      new SqlGreaterThanExpression(new MockSqlStringExpression("a"), null);
      fail("Constructing of SqlGreaterThanExpression with NULL as second SqlExpression argument should fail");
    } catch (Exception e) {
      // normal
    }

    // SQL String
    assertEquals("SqlGreaterThanExpression must return \" > \"",
        new SqlGreaterThanExpression(new MockSqlStringExpression(""),
            new MockSqlStringExpression("")).toSqlString(), " > ");
    assertEquals("SqlGreaterThanExpression must return \"a > b\"",
        new SqlGreaterThanExpression(new MockSqlStringExpression("a"),
            new MockSqlStringExpression("b")).toSqlString(),
        "a > b");

    // SQL arguments
    assertTrue("SqlGreaterThanExpression must return an empty array",
        Arrays.equals(new SqlGreaterThanExpression(
            new MockSqlStringExpression(""),
            new MockSqlStringExpression("")).getValues(),
            new Object[0]));
    assertTrue("SqlGreaterThanExpression must return an empty array",
        Arrays.equals(new SqlGreaterThanExpression(
            new MockSqlStringExpression(new Object[] { "a" }),
            new MockSqlStringExpression(new Object[] { "b" }))
            .getValues(), new Object[] { "a", "b" }));
  }
View Full Code Here

      fail("Constructing of SqlLowerThanExpression with NULL as SqlExpression arguments should fail");
    } catch (Exception e) {
      // normal
    }
    try {
      new SqlLowerThanExpression(null, new MockSqlStringExpression("a"));
      fail("Constructing of SqlLowerThanExpression with NULL as first SqlExpression argument should fail");
    } catch (Exception e) {
      // normal
    }
    try {
      new SqlLowerThanExpression(new MockSqlStringExpression("a"), null);
      fail("Constructing of SqlLowerThanExpression with NULL as second SqlExpression argument should fail");
    } catch (Exception e) {
      // normal
    }

    // SQL String
    assertEquals("SqlLowerThanExpression must return \" < \"",
        new SqlLowerThanExpression(new MockSqlStringExpression(""),
            new MockSqlStringExpression("")).toSqlString(), " < ");
    assertEquals("SqlLowerThanExpression must return \"a < b\"",
        new SqlLowerThanExpression(new MockSqlStringExpression("a"),
            new MockSqlStringExpression("b")).toSqlString(),
        "a < b");

    // SQL arguments
    assertTrue("SqlLowerThanExpression must return an empty array", Arrays
        .equals(new SqlLowerThanExpression(new MockSqlStringExpression(
            ""), new MockSqlStringExpression("")).getValues(),
            new Object[0]));
    assertTrue("SqlLowerThanExpression must return an empty array", Arrays
        .equals(new SqlLowerThanExpression(new MockSqlStringExpression(
            new Object[] { "a" }), new MockSqlStringExpression(
            new Object[] { "b" })).getValues(), new Object[] { "a",
            "b" }));
  }
View Full Code Here

      fail("Constructing of SqlLikeExpression with NULL as SqlExpression arguments should fail");
    } catch (Exception e) {
      // normal
    }
    try {
      new SqlLikeExpression(null, new MockSqlStringExpression("a"));
      fail("Constructing of SqlLikeExpression with NULL as first SqlExpression argument should fail");
    } catch (Exception e) {
      // normal
    }
    try {
      new SqlLikeExpression(new MockSqlStringExpression("a"), null);
      fail("Constructing of SqlLikeExpression with NULL as second SqlExpression argument should fail");
    } catch (Exception e) {
      // normal
    }

    // SQL String
    assertEquals("SqlLikeExpression must return \" LIKE \"",
        new SqlLikeExpression(new MockSqlStringExpression(""),
            new MockSqlStringExpression("")).toSqlString(),
        " LIKE ");
    assertEquals("SqlLikeExpression must return \"a LIKE b\"",
        new SqlLikeExpression(new MockSqlStringExpression("a"),
            new MockSqlStringExpression("b")).toSqlString(),
        "a LIKE b");

    // SQL arguments
    assertTrue("SqlLikeExpression must return an empty array", Arrays
        .equals(new SqlLikeExpression(new MockSqlStringExpression(""),
            new MockSqlStringExpression("")).getValues(),
            new Object[0]));
    assertTrue("SqlLikeExpression must return an empty array", Arrays
        .equals(new SqlLikeExpression(new MockSqlStringExpression(
            new Object[] { "a" }), new MockSqlStringExpression(
            new Object[] { "b" })).getValues(), new Object[] { "a",
            "b" }));
  }
View Full Code Here

TOP

Related Classes of org.araneaframework.uilib.widgets.lists.tests.mock.MockSqlStringExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.