### Question:
TabletLocationState { public TabletState getState(Set<TServerInstance> liveServers) { switch ((current == null ? 0 : _HAS_CURRENT) | (future == null ? 0 : _HAS_FUTURE) | (suspend == null ? 0 : _HAS_SUSPEND)) { case 0: return TabletState.UNASSIGNED; case _HAS_SUSPEND: return TabletState.SUSPENDED; case _HAS_FUTURE: case (_HAS_FUTURE | _HAS_SUSPEND): return liveServers.contains(future) ? TabletState.ASSIGNED : TabletState.ASSIGNED_TO_DEAD_SERVER; case _HAS_CURRENT: case (_HAS_CURRENT | _HAS_SUSPEND): return liveServers.contains(current) ? TabletState.HOSTED : TabletState.ASSIGNED_TO_DEAD_SERVER; default: throw new IllegalStateException(); } } TabletLocationState(KeyExtent extent, TServerInstance future, TServerInstance current,
      TServerInstance last, SuspendingTServer suspend, Collection<Collection<String>> walogs,
      boolean chopped); TServerInstance futureOrCurrent(); @Override String toString(); TServerInstance getServer(); TabletState getState(Set<TServerInstance> liveServers); final KeyExtent extent; final TServerInstance future; final TServerInstance current; final TServerInstance last; final SuspendingTServer suspend; final Collection<Collection<String>> walogs; final boolean chopped; }### Answer:
@Test public void testGetState_Unassigned1() throws Exception { tls = new TabletLocationState(keyExtent, null, null, null, null, walogs, true); assertEquals(TabletState.UNASSIGNED, tls.getState(null)); }
@Test public void testGetState_Unassigned2() throws Exception { tls = new TabletLocationState(keyExtent, null, null, last, null, walogs, true); assertEquals(TabletState.UNASSIGNED, tls.getState(null)); }
@Test public void testGetState_Assigned() throws Exception { Set<TServerInstance> liveServers = new java.util.HashSet<>(); liveServers.add(future); tls = new TabletLocationState(keyExtent, future, null, last, null, walogs, true); assertEquals(TabletState.ASSIGNED, tls.getState(liveServers)); }
@Test public void testGetState_Hosted() throws Exception { Set<TServerInstance> liveServers = new java.util.HashSet<>(); liveServers.add(current); tls = new TabletLocationState(keyExtent, null, current, last, null, walogs, true); assertEquals(TabletState.HOSTED, tls.getState(liveServers)); }
@Test public void testGetState_Dead1() throws Exception { Set<TServerInstance> liveServers = new java.util.HashSet<>(); liveServers.add(current); tls = new TabletLocationState(keyExtent, future, null, last, null, walogs, true); assertEquals(TabletState.ASSIGNED_TO_DEAD_SERVER, tls.getState(liveServers)); }
@Test public void testGetState_Dead2() throws Exception { Set<TServerInstance> liveServers = new java.util.HashSet<>(); liveServers.add(future); tls = new TabletLocationState(keyExtent, null, current, last, null, walogs, true); assertEquals(TabletState.ASSIGNED_TO_DEAD_SERVER, tls.getState(liveServers)); }