### Question:
ServerCacheClient { public ServerCache addServerCache( ScanRanges keyRanges, final ImmutableBytesWritable cachePtr, final byte[] txState, final ServerCacheFactory cacheFactory, final PTable cacheUsingTable) throws SQLException { return addServerCache(keyRanges, cachePtr, txState, cacheFactory, cacheUsingTable, false); } ServerCacheClient(PhoenixConnection connection); PhoenixConnection getConnection(); ServerCache createServerCache(byte[] cacheId, QueryPlan delegate); ServerCache addServerCache(
            ScanRanges keyRanges, final ImmutableBytesWritable cachePtr, final byte[] txState,
            final ServerCacheFactory cacheFactory, final PTable cacheUsingTable); ServerCache addServerCache(
            ScanRanges keyRanges, final ImmutableBytesWritable cachePtr, final byte[] txState,
            final ServerCacheFactory cacheFactory, final PTable cacheUsingTable,
            boolean storeCacheOnClient); ServerCache addServerCache(
            ScanRanges keyRanges, final byte[] cacheId, final ImmutableBytesWritable cachePtr,
            final byte[] txState, final ServerCacheFactory cacheFactory,
            final PTable cacheUsingTable, final boolean usePersistentCache,
            boolean storeCacheOnClient); static byte[] generateId(); static String idToString(byte[] uuid); boolean addServerCache(byte[] startkeyOfRegion, ServerCache cache, HashCacheFactory cacheFactory,
             byte[] txState, PTable pTable); boolean addServerCache(Table htable, byte[] key, final PTable cacheUsingTable, final byte[] cacheId,
            final ImmutableBytesWritable cachePtr, final ServerCacheFactory cacheFactory, final byte[] txState, final boolean usePersistentCache); static final int UUID_LENGTH; static final byte[] KEY_IN_FIRST_REGION; static final String HASH_JOIN_SERVER_CACHE_RESEND_PER_SERVER; }### Answer:
@Test public void testAddServerCache() throws SQLException { PhoenixConnection connection = Mockito.mock(PhoenixConnection.class); ConnectionQueryServices services = Mockito.mock(ConnectionQueryServices.class); Mockito.when(services.getExecutor()).thenReturn(null); Mockito.when(connection.getQueryServices()).thenReturn(services); byte[] tableName = Bytes.toBytes("TableName"); PTableImpl pTable = Mockito.mock(PTableImpl.class); Mockito.when(pTable.getPhysicalName()).thenReturn(PNameFactory.newName("TableName")); Mockito.when(services.getAllTableRegions(tableName)).thenThrow(new SQLException("Test Exception")); ServerCacheClient client = new ServerCacheClient(connection); try { client.addServerCache(null, null, null, null, pTable, false); } catch (Exception e) { assertEquals(e.getMessage(), "Test Exception"); } }