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
      @PrepareForTest({Environment.class})
      public void testGetItemFile() throws Exception {
          File file = new File("/dir/");
          when(mockContext.getExternalFilesDir(null)).thenReturn(file);
  
          Configuration.Item item = new Configuration.Item();
          item.location = "http://example.com/";
          assertEquals(new File("/dir/http%3A%2F%2Fexample.com%2F"), FileHelper.getItemFile(mockContext, item));
  
          item.location = "https://example.com/";
          assertEquals(new File("/dir/https%3A%2F%2Fexample.com%2F"), FileHelper.getItemFile(mockContext, item));
  
          item.location = "file:/myfile";
          assertNull(FileHelper.getItemFile(mockContext, item));
  
          mockStatic(Environment.class);
          when(Environment.getExternalStorageDirectory()).thenReturn(new File("/sdcard/"));
  
          item.location = "file:myfile";
          assertNull(null, FileHelper.getItemFile(mockContext, item));
  
  
          item.location = "ahost.com";
          assertNull(FileHelper.getItemFile(mockContext, item));
      }
test_case.class_method_signature: FileHelperTest.testGetItemFile()
test_case.full_signature: @Test @PrepareForTest({Environment.class}) public void testGetItemFile()
test_case.identifier: testGetItemFile
test_case.invocations: thenReturn when getExternalFilesDir assertEquals getItemFile assertEquals getItemFile assertNull getItemFile mockStatic thenReturn when getExternalStorageDirectory assertNull getItemFile assertNull getItemFile
test_case.modifiers: @Test @PrepareForTest({Environment.class}) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetItemFile()
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 File getItemFile(Context context, Configuration.Item item) {
          if (item.isDownloadable()) {
              try {
                  return new File(context.getExternalFilesDir(null), java.net.URLEncoder.encode(item.location, "UTF-8"));
              } catch (UnsupportedEncodingException e) {
                  e.printStackTrace();
                  return null;
              }
          } else {
              return null;
          }
      }
focal_method.class_method_signature: FileHelper.getItemFile(Context context, Configuration.Item item)
focal_method.full_signature: public static File getItemFile(Context context, Configuration.Item item)
focal_method.identifier: getItemFile
focal_method.invocations: isDownloadable getExternalFilesDir encode printStackTrace
focal_method.modifiers: public static
focal_method.parameters: (Context context, Configuration.Item item)
focal_method.return: File
focal_method.signature: File getItemFile(Context context, Configuration.Item item)