### Question:
ZooKeeperStateProvider extends AbstractStateProvider { @Override public void setState(final Map<String, String> state, final String componentId) throws IOException { setState(state, -1, componentId); } ZooKeeperStateProvider(); @Override List<PropertyDescriptor> getSupportedPropertyDescriptors(); @Override synchronized void init(final StateProviderInitializationContext context); @Override synchronized void shutdown(); @Override void onComponentRemoved(final String componentId); @Override Scope[] getSupportedScopes(); @Override void setState(final Map<String, String> state, final String componentId); @Override StateMap getState(final String componentId); @Override boolean replace(final StateMap oldValue, final Map<String, String> newValue, final String componentId); @Override void clear(final String componentId);  }### Answer:
@Test(timeout = 20000) public void testStateTooLargeExceptionThrownOnSetState() throws InterruptedException { final Map<String, String> state = new HashMap<>(); final StringBuilder sb = new StringBuilder(); for (int i = 0; i < 6500; i++) { sb.append("0123456789"); } for (int i = 0; i < 20; i++) { state.put("numbers." + i, sb.toString()); } while (true) { try { getProvider().setState(state, componentId); Assert.fail("Expected StateTooLargeException"); } catch (final StateTooLargeException stle) { break; } catch (final IOException ioe) { Thread.sleep(1000L); } catch (final Exception e) { e.printStackTrace(); Assert.fail("Expected StateTooLargeException but " + e.getClass() + " was thrown", e); } } }