### Question:
TicketRegistryDecorator extends AbstractTicketRegistry { @Override public int sessionCount() { if (this.ticketRegistry instanceof TicketRegistryState) { return ((TicketRegistryState) this.ticketRegistry).sessionCount(); } logger.debug("Ticket registry {} does not support report the sessionCount() operation of the registry state.", this.ticketRegistry.getClass().getName()); return super.sessionCount(); } TicketRegistryDecorator(final TicketRegistry actualTicketRegistry, final Map<String, String> cache); @Override void addTicket(final Ticket ticket); @Override Ticket getTicket(final String ticketId); @Override boolean deleteTicket(final String ticketId); @Override Collection<Ticket> getTickets(); @Override int sessionCount(); @Override int serviceTicketCount();  }### Answer:
@Test public void sessionCount() { assertEquals(Integer.MIN_VALUE, decorator.sessionCount()); }
@Test public void sessionCountWithTicketRegistryState() { TicketRegistry registryState = Mockito.mock(TicketRegistry.class, withSettings().extraInterfaces(TicketRegistryState.class)); when(((TicketRegistryState)registryState).sessionCount()).thenReturn(123); decorator = new TicketRegistryDecorator(registryState, cache); assertEquals(123, decorator.sessionCount()); }