saket / Dank

Here lies the greatest Reddit app that was never released
https://saket.me/dank
Apache License 2.0
813 stars 134 forks source link

Allow opening YouTube URLs in third-party clients and MODs. #19

Closed SubhrajyotiSen closed 1 year ago

SubhrajyotiSen commented 5 years ago

Addresses #16

saket commented 5 years ago

Thank you for contributing this @SubhrajyotiSen! The feature looks alright, but I think the design can be improved. I've left some feedback. Let me know what you think.

SubhrajyotiSen commented 5 years ago

When I tried running the tests in UrlParserTest, I got the following error. I couldn't find a solution to this. Can you please help me with this?

Exception in thread "main" java.lang.ExceptionInInitializerError
    at org.mockito.internal.exceptions.stacktrace.ConditionalStackTraceFilter.<init>(ConditionalStackTraceFilter.java:17)
    at org.mockito.exceptions.base.MockitoException.filterStackTrace(MockitoException.java:41)
    at org.mockito.exceptions.base.MockitoException.<init>(MockitoException.java:30)
    at org.mockito.exceptions.misusing.MockitoConfigurationException.<init>(MockitoConfigurationException.java:18)
    at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:66)
    at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:24)
    at org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:12)
    at org.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:11)
    at org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:24)
    at org.mockito.internal.MockitoCore.<init>(MockitoCore.java:44)
    at org.mockito.Mockito.<clinit>(Mockito.java:975)
    at sun.misc.Unsafe.ensureClassInitialized(Native Method)
    at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
    at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:156)
    at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1088)
    at java.lang.reflect.Field.getFieldAccessor(Field.java:1069)
    at java.lang.reflect.Field.get(Field.java:393)
    at org.powermock.reflect.internal.WhiteboxImpl.getInternalState(WhiteboxImpl.java:419)
    at org.powermock.reflect.Whitebox.getInternalState(Whitebox.java:292)
    at org.powermock.api.extension.reporter.MockingFrameworkReporterFactoryImpl$MockitoMockingFrameworkReporter.getMockitoCoreForCurrentClassLoader(MockingFrameworkReporterFactoryImpl.java:47)
    at org.powermock.api.extension.reporter.MockingFrameworkReporterFactoryImpl$MockitoMockingFrameworkReporter.enable(MockingFrameworkReporterFactoryImpl.java:37)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:120)
    at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
    at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.NullPointerException
    at org.mockito.internal.configuration.plugins.Plugins.getStackTraceCleanerProvider(Plugins.java:17)
    at org.mockito.internal.exceptions.stacktrace.StackTraceFilter.<clinit>(StackTraceFilter.java:21)
    ... 29 more
saket commented 5 years ago

:S I can't think of anything. The way how things are mocked in UrlParserTest is quite messy. I need to get rid of mocks, especially the static ones. They could be the source of issue here.

I will try taking a look at your branch in May and see if I can do this? A bit occupied until then.

SubhrajyotiSen commented 5 years ago

No problem. I will push my latest changes in the morning.

SubhrajyotiSen commented 5 years ago

@Tunous I will make the requested changes and make a PR on your fork.