test_class.declarator: mockContext
test_class.original_string: Context mockContext;
test_class.type: Context
test_class.var_name: mockContext
test_class.declarator: mockAssets
test_class.original_string: AssetManager mockAssets;
test_class.type: AssetManager
test_class.var_name: mockAssets
test_class.declarator: testResult
test_class.original_string: int testResult;
test_class.type: int
test_class.var_name: testResult
test_class.file: app/src/test/java/org/jak_linux/dns66/FileHelperTest.java
test_class.identifier: FileHelperTest
test_case.body: @Test
      public void testOpenWrite() throws Exception {
          File file = mock(File.class);
          File file2 = mock(File.class);
          FileOutputStream fos = mock(FileOutputStream.class);
          when(mockContext.getFileStreamPath(eq("filename"))).thenReturn(file);
          when(mockContext.getFileStreamPath(eq("filename.bak"))).thenReturn(file2);
          when(mockContext.openFileOutput(eq("filename"), anyInt())).thenReturn(fos);
  
          assertSame(fos, FileHelper.openWrite(mockContext, "filename"));
  
          Mockito.verify(file).renameTo(file2);
          Mockito.verify(mockContext).openFileOutput(eq("filename"), anyInt());
      }
test_case.class_method_signature: FileHelperTest.testOpenWrite()
test_case.full_signature: @Test public void testOpenWrite()
test_case.identifier: testOpenWrite
test_case.invocations: mock mock mock thenReturn when getFileStreamPath eq thenReturn when getFileStreamPath eq thenReturn when openFileOutput eq anyInt assertSame openWrite renameTo verify openFileOutput verify eq anyInt
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testOpenWrite()
focal_class.file: app/src/main/java/org/jak_linux/dns66/FileHelper.java
focal_class.identifier: FileHelper
focal_class.class_method_signature: FileHelper.openRead(Context context, String filename)
focal_class.full_signature: public static InputStream openRead(Context context, String filename)
focal_class.identifier: openRead
focal_class.modifiers: public static
focal_class.parameters: (Context context, String filename)
focal_class.return: InputStream
focal_class.signature: InputStream openRead(Context context, String filename)
focal_class.class_method_signature: FileHelper.openWrite(Context context, String filename)
focal_class.full_signature: public static OutputStream openWrite(Context context, String filename)
focal_class.identifier: openWrite
focal_class.modifiers: public static
focal_class.parameters: (Context context, String filename)
focal_class.return: OutputStream
focal_class.signature: OutputStream openWrite(Context context, String filename)
focal_class.class_method_signature: FileHelper.readConfigFile(Context context, String name, boolean defaultsOnly)
focal_class.full_signature: private static Configuration readConfigFile(Context context, String name, boolean defaultsOnly)
focal_class.identifier: readConfigFile
focal_class.modifiers: private static
focal_class.parameters: (Context context, String name, boolean defaultsOnly)
focal_class.return: Configuration
focal_class.signature: Configuration readConfigFile(Context context, String name, boolean defaultsOnly)
focal_class.class_method_signature: FileHelper.loadCurrentSettings(Context context)
focal_class.full_signature: public static Configuration loadCurrentSettings(Context context)
focal_class.identifier: loadCurrentSettings
focal_class.modifiers: public static
focal_class.parameters: (Context context)
focal_class.return: Configuration
focal_class.signature: Configuration loadCurrentSettings(Context context)
focal_class.class_method_signature: FileHelper.loadPreviousSettings(Context context)
focal_class.full_signature: public static Configuration loadPreviousSettings(Context context)
focal_class.identifier: loadPreviousSettings
focal_class.modifiers: public static
focal_class.parameters: (Context context)
focal_class.return: Configuration
focal_class.signature: Configuration loadPreviousSettings(Context context)
focal_class.class_method_signature: FileHelper.loadDefaultSettings(Context context)
focal_class.full_signature: public static Configuration loadDefaultSettings(Context context)
focal_class.identifier: loadDefaultSettings
focal_class.modifiers: public static
focal_class.parameters: (Context context)
focal_class.return: Configuration
focal_class.signature: Configuration loadDefaultSettings(Context context)
focal_class.class_method_signature: FileHelper.writeSettings(Context context, Configuration config)
focal_class.full_signature: public static void writeSettings(Context context, Configuration config)
focal_class.identifier: writeSettings
focal_class.modifiers: public static
focal_class.parameters: (Context context, Configuration config)
focal_class.return: void
focal_class.signature: void writeSettings(Context context, Configuration config)
focal_class.class_method_signature: FileHelper.getItemFile(Context context, Configuration.Item item)
focal_class.full_signature: public static File getItemFile(Context context, Configuration.Item item)
focal_class.identifier: getItemFile
focal_class.modifiers: public static
focal_class.parameters: (Context context, Configuration.Item item)
focal_class.return: File
focal_class.signature: File getItemFile(Context context, Configuration.Item item)
focal_class.class_method_signature: FileHelper.openItemFile(Context context, Configuration.Item item)
focal_class.full_signature: public static InputStreamReader openItemFile(Context context, Configuration.Item item)
focal_class.identifier: openItemFile
focal_class.modifiers: public static
focal_class.parameters: (Context context, Configuration.Item item)
focal_class.return: InputStreamReader
focal_class.signature: InputStreamReader openItemFile(Context context, Configuration.Item item)
focal_class.class_method_signature: FileHelper.poll(StructPollfd[] fds, int timeout)
focal_class.full_signature: public static int poll(StructPollfd[] fds, int timeout)
focal_class.identifier: poll
focal_class.modifiers: public static
focal_class.parameters: (StructPollfd[] fds, int timeout)
focal_class.return: int
focal_class.signature: int poll(StructPollfd[] fds, int timeout)
focal_class.class_method_signature: FileHelper.closeOrWarn(FileDescriptor fd, String tag, String message)
focal_class.full_signature: public static FileDescriptor closeOrWarn(FileDescriptor fd, String tag, String message)
focal_class.identifier: closeOrWarn
focal_class.modifiers: public static
focal_class.parameters: (FileDescriptor fd, String tag, String message)
focal_class.return: FileDescriptor
focal_class.signature: FileDescriptor closeOrWarn(FileDescriptor fd, String tag, String message)
focal_class.class_method_signature: FileHelper.closeOrWarn(T fd, String tag, String message)
focal_class.full_signature: public static T closeOrWarn(T fd, String tag, String message)
focal_class.identifier: closeOrWarn
focal_class.modifiers: public static
focal_class.parameters: (T fd, String tag, String message)
focal_class.return: T
focal_class.signature: T closeOrWarn(T fd, String tag, String message)
focal_method.body: public static OutputStream openWrite(Context context, String filename) throws IOException {
          File out = context.getFileStreamPath(filename);
  
          // Create backup
          out.renameTo(context.getFileStreamPath(filename + ".bak"));
  
          return context.openFileOutput(filename, Context.MODE_PRIVATE);
      }
focal_method.class_method_signature: FileHelper.openWrite(Context context, String filename)
focal_method.full_signature: public static OutputStream openWrite(Context context, String filename)
focal_method.identifier: openWrite
focal_method.invocations: getFileStreamPath renameTo getFileStreamPath openFileOutput
focal_method.modifiers: public static
focal_method.parameters: (Context context, String filename)
focal_method.return: OutputStream
focal_method.signature: OutputStream openWrite(Context context, String filename)