@@ -0,0 +1,2076 @@
+// This file is part of me.christopherdavis.beanstalkc%0A// Copyright: (c) 2014 Christopher Davis %3Chttp://christopherdavis.me%3E%0A// License: MIT http://opensource.org/licenses/MIT%0A%0Apackage me.christopherdavis.beanstalkc;%0A%0Aimport java.util.Map;%0Aimport java.util.Random;%0Aimport org.junit.Test;%0Aimport org.junit.Assert;%0A%0Apublic class StatsTest%0A%7B%0A    private Client client;%0A    private Random rand;%0A%0A    public StatsTest() throws Exception%0A    %7B%0A        client = ConnectionHelper.create();%0A        rand = new Random();%0A    %7D%0A%0A    @Test%0A    public void testStatsJob() throws Exception%0A    %7B%0A        Map%3CString, String%3E res;%0A        final String tube = generateTubeName();%0A%0A        // Job 10000 should exist yet, null response%0A        res = client.statsJob(10000);%0A        Assert.assertNull(res);%0A%0A        Assert.assertTrue(client.use(tube));%0A        Job j = client.put(%22test%22.getBytes());%0A%0A        res = client.statsJob(j);%0A        Assert.assertNotNull(res);%0A        Assert.assertTrue(res.containsKey(%22id%22));%0A        Assert.assertTrue(res.containsKey(%22tube%22));%0A        Assert.assertEquals(tube, res.get(%22tube%22));%0A    %7D%0A%0A    @Test%0A    public void testStatsTube() throws Exception%0A    %7B%0A        Map%3CString, String%3E res;%0A        final String tube = generateTubeName();%0A%0A        // the tube shouldn't exist yet, null response%0A        res = client.statsTube(tube);%0A        Assert.assertNull(res);%0A%0A        // let's make the tube exist by inserted a job.%0A        Assert.assertTrue(client.use(tube));%0A        Job j = client.put(%22test%22.getBytes());%0A%0A        res = client.statsTube(tube);%0A        Assert.assertNotNull(res);%0A        Assert.assertTrue(res.containsKey(%22current-jobs-ready%22));%0A        Assert.assertEquals(%221%22, res.get(%22current-jobs-ready%22));%0A    %7D%0A%0A    @Test%0A    public void testStats() throws Exception%0A    %7B%0A        Map%3CString, String%3E res = client.stats();%0A%0A        Assert.assertNotNull(res);%0A        Assert.assertTrue(res.containsKey(%22version%22));%0A    %7D%0A%0A    private String generateTubeName()%0A    %7B%0A        return String.format(%22peektest_tube_%25d%22, rand.nextInt(10000));%0A    %7D%0A%7D%0A

Test the stats commands