Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lpush actually does an rpush #34

Open
jtownson opened this issue May 8, 2015 · 1 comment
Open

lpush actually does an rpush #34

jtownson opened this issue May 8, 2015 · 1 comment

Comments

@jtownson
Copy link

jtownson commented May 8, 2015

A test such as the following one fails. When retrieving the elements with lrange, they come out in reverse order.

    @Test
    public void lpushShouldPushToTheFrontOfAList() {

        // given
        MockJedis jedis = new MockJedis("localhost");
        jedis.lpush("list", "c");
        jedis.lpush("list", "b");
        jedis.lpush("list", "a");

        // when
        List<String> list = jedis.lrange("list", 0, -1);

        // then
        assertThat(list, is(asList("a", "b", "c")));
    }

I guess the root of the bug is in com.fiftyonred.mock_jedis.MockStorage#lpush where values are added via Collections.addAll.

@kylejmcintyre
Copy link

I encountered this as well but just saw your issue. I resolved it in the Centricient fork of this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants