### Question:
ConfigStorageClient { public synchronized Void write(ConfigContainer container) throws IOException { FileOutputStream outputStream = context.openFileOutput(fileName, Context.MODE_PRIVATE); try { outputStream.write(container.toString().getBytes(JSON_STRING_ENCODING)); } finally { outputStream.close(); } return null; } private  ConfigStorageClient(Context context, String fileName); synchronized Void write(ConfigContainer container); @Nullable synchronized ConfigContainer read(); synchronized Void clear(); static synchronized ConfigStorageClient getInstance(Context context, String fileName); @VisibleForTesting static synchronized void clearInstancesForTest();  }### Answer:
@Test public void write_validContainer_writesContainerToFile() throws Exception { storageClient.write(configContainer); assertThat(getFileAsString()).isEqualTo(configContainer.toString()); }
@Test public void write_nullContainer_throwsNullPointerException() throws Exception { assertThrows(NullPointerException.class, () -> storageClient.write(null)); assertThat(getFileAsString()).isEmpty(); }