song-water

song-water

Member Since 9 months ago

Experience Points
0
follower
Lessons Completed
0
follow
Lessons Completed
32
stars
Best Reply Awards
5
repos

28 contributions in the last year

Pinned
⚡ android template
⚡ android common template, android only
⚡ :heavy_check_mark: A framework that helps the keyboard smoothly transition to the function panel 一个帮助键盘平稳过渡到功能面板的框架,支持动画无缝衔接,支持 activity/fragment/dialog/dialogFragment/popupWindow 容器,支持IM/直播/视频播放/信息流评论等场景,支持全屏模式。
Activity
Nov
14
3 weeks ago
started
started time in 3 weeks ago
Nov
7
4 weeks ago
Activity icon
fork

song-water forked YummyLau/PanelSwitchHelper

⚡ :heavy_check_mark: A framework that helps the keyboard smoothly transition to the function panel 一个帮助键盘平稳过渡到功能面板的框架,支持动画无缝衔接,支持 activity/fragment/dialog/dialogFragment/popupWindow 容器,支持IM/直播/视频播放/信息流评论等场景,支持全屏模式。
song-water Apache License 2.0 Updated
fork time in 4 weeks ago
Nov
1
1 month ago
push

song-water push song-water/AndroidCommonTemplate

song-water
song-water

[Brief] 完善全屏DialogFragment [Type] Widget [Issue-ID] 无 [Problem] 完善全屏DialogFragment [Solution] 完善全屏DialogFragment

commit sha: 6800242d65edc945da14449e282206baf0afa034

push time in 1 month ago
Oct
30
1 month ago
push

song-water push song-water/AndroidCommonTemplate

song-water
song-water

[Brief] 添加卡片画廊效果 [Type] Widget [Issue-ID] 无 [Problem] 添加卡片画廊效果 [Solution] 从RxTool将画廊导入(Anti 996 License),项目中期再考虑匹配开源协议的问题。

commit sha: 53a539e8abf7661f8f1f3d6187de701faf88fe62

push time in 1 month ago
push

song-water push song-water/AndroidCommonTemplate

song-water
song-water

[Brief] 添加BaseActivity, BaseFragment [Type] Widget [Issue-ID] 无 [Problem] 添加BaseActivity, BaseFragment [Solution] 添加基本基类BaseActivity, BaseFragment等

commit sha: f1b8ab716c1df5d3dedc7e316f4b4e627e633bc5

push time in 1 month ago
started
started time in 1 month ago
Oct
23
1 month ago
started
started time in 1 month ago
started
started time in 1 month ago
started
started time in 1 month ago
started
started time in 1 month ago
push

song-water push song-water/AndroidCommonTemplate

song-water
song-water

[Brief] 添加全屏DialogFragment [Type] Widget [Issue-ID] 无 [Problem] 添加全屏DialogFragment [Solution] 添加全屏沉浸式DialogFragment

commit sha: 0a7496b6fb9cb049a35e6cf25bf426f0db1e03de

push time in 1 month ago
Activity icon
issue

song-water issue comment robolectric/robolectric

song-water
song-water

static use of Android classes fails with ParameterizedRobolectricTestRunner

Description

I want to write a parameterized test whose data includes Android classes (android.location.Location), specifically. It appears, though, that ParameterizedRobolectricTestRunner installs the classloader too late, because if I create the test data objects in public static Collection<Object[]> data(), I get an exception saying the relevant method was not mocked (meaning the class loaded wasn't Robolectric's).

The same thing (creating a Location in a static block) succeeds with RobolectricTestRunner.

Test source code

@RunWith(ParameterizedRobolectricTestRunner.class)
@Config(constants = BuildConfig.class)
public class ParameterizedTestTest{


	@ParameterizedRobolectricTestRunner.Parameters
	public static Collection<Object[]> data(){
		Location location = new Location("test");
		location.setTime(System.currentTimeMillis());
		return Arrays.asList(new Object[][]{
			{location}
		});
	}


	private final Location location;


	public ParameterizedTestTest(Location l){
		this.location = l;
	}


	@Test
	public void test(){

	}


}

Robolectric & Android Version

3.6.1 & 23

song-water
song-water

Hi, is there any actual progress on this issue?

This is still present in 4.6.1.

https://github.com/robolectric/robolectric/blob/master/robolectric/src/test/java/org/robolectric/ParameterizedRobolectricTestRunnerClassLoaderTest.java is work well in my PC, but fail with Kotlin :

@RunWith(ParameterizedRobolectricTestRunner::class)
  class ParameterizedRobolectricTestRunnerDemoTest(
      private var uri: Uri
  ) {
      @Test
      @Config(manifest = Config.NONE)
      fun parse() {
          val currentUri = Uri.parse("http://host/")
          assertThat(currentUri).isEqualTo(uri)
      }
  
      companion object {
          @ParameterizedRobolectricTestRunner.Parameters
          @JvmStatic
          fun getTestData(): Collection<*> {
              val data = arrayOf(arrayOf<Any>(Uri.parse("http://host/")))
              return listOf(data)
          }
      }
  }

error log:

parse("http://host/") must not be null
java.lang.NullPointerException: parse("http://host/") must not be null

Test environment

Robolectric: 4.6.1 Kotlin: 1.5.31 AGP: 7.0.0 JDK: 11 PC: windows 10

push

song-water push song-water/AndroidCommonTemplate

song-water
song-water

[Brief] 添加 junit.dataprovider 参数化例子 [Type] 质量保证 [Issue-ID] 无 [Problem] 添加 junit.dataprovider 参数化例子 [Solution] junit.dataprovider 实现方便的参数化测试使用方法

commit sha: df74bd2bcaa9d04f74f81816d4ea975d2f41bce8

push time in 1 month ago
push

song-water push song-water/AndroidCommonTemplate

song-water
song-water

[Brief] 添加库 approvaltests [Type] 质量保证 [Issue-ID] 无 [Problem] 添加库 approvaltests,方便测试 [Solution] 1.approvaltests 可方便的用于getter/setter的测试,2.approvaltests 也可以方便的为用例提供测试数据。

commit sha: 00720c19fb015782e760ff78c5e3a75f0836a9e4

push time in 1 month ago
push

song-water push song-water/AndroidCommonTemplate

song-water
song-water

[Brief] 升级 sdk api 31 [Type] 升级 [Issue-ID] 无 [Problem] 升级 sdk (S os) [Solution] 1.compile sdk 30 -> 31, 2.target sdk 30 -> 31, 3. robolectric.properties 30.

commit sha: 262bdb00bd5c9b1b1d42b0a59b8a0825ef879cf2

push time in 1 month ago
Oct
17
1 month ago
push

song-water push song-water/AndroidCommonTemplate

song-water
song-water

[Brief] 为LauncherActivity添加单元测试 [Type] 质量保证 [Issue-ID] 无 [Problem] 为LauncherActivity添加单元测试 [Solution] 1.LauncherActivity添加单元测试;2.添加跳转SplashActivity,方便测试

commit sha: 90e0b885a71beb57ff626b66a028e66dc9864977

push time in 1 month ago
started
started time in 1 month ago
push

song-water push song-water/AndroidCommonTemplate

song-water
song-water

[Brief] 添加fastkv [Type] 新功能 [Issue-ID] 无 [Problem] 添加fastkv [Solution] 添加fast,并且实现简单包装和初始化

commit sha: 58d201999ee201a577a381a4f39c5c2345454679

push time in 1 month ago
started
started time in 1 month ago
started
started time in 1 month ago
Oct
16
1 month ago
push

song-water push song-water/AndroidCommonTemplate

song-water
song-water

[Brief] 新样板 [Type] 新样板 [Issue-ID] 无 [Problem] 新样板 [Solution] 新样板

commit sha: bb37bca6da12f4bd4c70d097c32d51b69f48898b

push time in 1 month ago