### Question:
TenantIdAccessor { public long getRequestedTenantId() throws ServletException { return parseTenantId(request.getTenantId()); } TenantIdAccessor(HttpServletRequestAccessor request); long getRequestedTenantId(); long ensureTenantId(); long getDefaultTenantId(); long getTenantIdFromRequestOrCookie();  }### Answer:
@Test public void testIfWeRetrieveRequestedTenantId() throws Exception { doReturn("5").when(requestAccessor).getTenantId(); TenantIdAccessor accessor = new TenantIdAccessor(requestAccessor); assertEquals(5L, accessor.getRequestedTenantId()); }
@Test public void testNullTenantId() throws Exception { doReturn(null).when(requestAccessor).getTenantId(); TenantIdAccessor accessor = new TenantIdAccessor(requestAccessor); assertEquals(-1L, accessor.getRequestedTenantId()); }