@Test public void write_nullContainer_throwsNullPointerException() throws Exception { assertThrows(NullPointerException.class, () -> storageClient.write(null)); assertThat(getFileAsString()).isEmpty(); }
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; }
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; } }
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); }
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(); }
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();  }