Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jnosql-dev] Tests improvements

Hello guys,

In JNoSQL Drivers, we have to test a lot of things, like inserts, selects, updates and others. When we are testing a select statement we have to insert some records and now a days, we insert with a Template ou Reposity first and then, we test the select/delete feature, but the problem is that the tests are ugly.

For example (Delete with Redis Driver):

@Test

    public void shouldRemoveList() {

        fruits.add(orange);

        fruits.add(banana);

        fruits.add(waterMelon);


        fruits.remove(waterMelon);

        assertThat(fruits, not(contains(waterMelon)));

    }


Now with JNoSQL Aphrodite we can improve ours tests  with an annotation to do something (scripts with queries) before or after the tests. Something like:


@Query(“fruits.jnosql”)

@Test

    public void shouldRemoveList() {

        fruits.remove(waterMelon);

        assertThat(fruits, not(contains(waterMelon)));

    }

For more details, you can see on this issue https://github.com/eclipse/jnosql-diana-driver/issues/88


What do you think?


Back to the top