@Test
 public void shouldAllocateNewCookieForEveryGetCookieRequest() throws Exception {
   AgentIdentifier identifier = new AgentIdentifier("host", "192.168.1.1", "uuid");
   when(oldImplementation.getCookie(identifier, "/foo/bar")).thenReturn("cookie");
   assertThat(producer.getCookie(identifier, "/foo/bar"), is("cookie"));
   // should not cache
   when(oldImplementation.getCookie(identifier, "/foo/bar")).thenReturn("cookie1");
   assertThat(producer.getCookie(identifier, "/foo/bar"), is("cookie1"));
 }
 @Test
 public void shouldDelegatePingToTheOldImplementation() {
   producer.ping(
       new AgentRuntimeInfo(
           agentIdentifier,
           AgentRuntimeStatus.Idle,
           currentWorkingDirectory(),
           "cookie",
           null,
           false));
   verify(oldImplementation)
       .ping(
           new AgentRuntimeInfo(
               agentIdentifier,
               AgentRuntimeStatus.Idle,
               currentWorkingDirectory(),
               "cookie",
               null,
               false));
 }
 @Test
 public void shouldDelegateReportJobStatusToTheOldImplementation() {
   producer.reportCurrentStatus(
       new AgentRuntimeInfo(
           agentIdentifier,
           AgentRuntimeStatus.Idle,
           currentWorkingDirectory(),
           "cookie",
           null,
           false),
       jobIdentifier,
       assigned);
   verify(oldImplementation)
       .reportCurrentStatus(
           new AgentRuntimeInfo(
               agentIdentifier,
               AgentRuntimeStatus.Idle,
               currentWorkingDirectory(),
               "cookie",
               null,
               false),
           jobIdentifier,
           assigned);
 }
 @Test
 public void shouldUseEventDrivenImplementationByDefault() {
   producer.getWork(AGENT_INFO);
   verify(newImplementation).getWork(AGENT_INFO);
 }
 @Test
 public void shouldDelegateIgnoreingQueryToTheOldImplementation() {
   producer.isIgnored(jobIdentifier);
   verify(oldImplementation).isIgnored(jobIdentifier);
 }