Search in sources :

Example 1 with QueryParameter

use of io.spine.client.QueryParameter in project core-java by SpineEventEngine.

the class QueryParameterShould method support_toString.

@Test
public void support_toString() {
    final String name = "myColumn";
    final int value = 42;
    final QueryParameter param = eq(name, value);
    final String stringRepr = param.toString();
    assertThat(stringRepr, containsString(name));
    assertThat(stringRepr, containsString(valueOf(value)));
}
Also used : QueryParameter(io.spine.client.QueryParameter) String(java.lang.String) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 2 with QueryParameter

use of io.spine.client.QueryParameter in project core-java by SpineEventEngine.

the class QueryParameterShould method support_equality.

@Test
public void support_equality() {
    final String param1 = "param1";
    final String param2 = "param2";
    final String foobar = "foobar";
    final String baz = "baz";
    final StringValue foobarValue = StringValue.newBuilder().setValue(foobar).build();
    final QueryParameter parameter1 = eq(param1, foobar);
    final QueryParameter parameter2 = eq(param1, foobarValue);
    final QueryParameter parameter3 = eq(param1, baz);
    final QueryParameter parameter4 = eq(param2, foobar);
    new EqualsTester().addEqualityGroup(parameter1, parameter2).addEqualityGroup(parameter3).addEqualityGroup(parameter4).testEquals();
}
Also used : QueryParameter(io.spine.client.QueryParameter) EqualsTester(com.google.common.testing.EqualsTester) String(java.lang.String) Matchers.containsString(org.hamcrest.Matchers.containsString) StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Aggregations

QueryParameter (io.spine.client.QueryParameter)2 String (java.lang.String)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 Test (org.junit.Test)2 EqualsTester (com.google.common.testing.EqualsTester)1 StringValue (com.google.protobuf.StringValue)1