草庐IT

wear-mock

全部标签

Android Wear 设备作为 iBeacon

是否可以将AndroidWear设备用作蓝牙低功耗信标,与其与手机的连接分开?我正在使用连接到iOS和Android设备的iBeacon,各种移动设备的iBeacon(蓝牙低功耗)功能差异很大。大多数Apple设备(iPhone、最新的iPad和笔记本电脑/台式机设备)都可以作为iBeacon进行传输。只有某些最新的Android设备可以这样做,例如Nexus6和Nexus9。我刚买了一个Moto360玩玩,它确实使用BLE传输到配对设备,但我很好奇我是否可以编写一个应用程序,使其传输任意数据包和任意UUID。有人这样做过吗?似乎应该是可能的。我已经完成了AndroidWear开发人员

ios - 如何在 iOS 测试中实际使用 Stub 或 Mocking 对象?

我的问题分为两部分。首先,我对iOS中的测试有非常基本的了解,我正在尝试学习使用模拟。据我所知,当难以访问该对象(例如查询数据库或不可预测的情况)时,模拟对象是对假对象的模拟。你能解释一个简单的例子如何模拟数据库的行为吗?在我的情况下,我想测试从FacebookAPI的API调用接收到的JSON数据包。我想确保这些数据包不为空并且存在特定节点。对此进行测试的最佳方法是什么? 最佳答案 stub是一种伪造物,在调用时提供固定响应。模拟是一种记录其调用方式的伪造品。这就是为什么模拟对象框架(例如OCMock或OCMockito)基本上可

java - Spring JUnit : How to Mock autowired component in autowired component

我有一个我想测试的Spring组件,并且这个组件有一个Autowiring的属性,我需要更改它以进行单元测试。问题是,该类在post-construct方法中使用Autowiring组件,因此在实际使用之前我无法替换它(即通过ReflectionTestUtils)。我该怎么做?这是我要测试的类:@ComponentpublicfinalclassTestedClass{@AutowiredprivateResourceresource;@PostConstructprivatevoidinit(){//Ineedthistoreturndifferentresultresource.

java - Spring JUnit : How to Mock autowired component in autowired component

我有一个我想测试的Spring组件,并且这个组件有一个Autowiring的属性,我需要更改它以进行单元测试。问题是,该类在post-construct方法中使用Autowiring组件,因此在实际使用之前我无法替换它(即通过ReflectionTestUtils)。我该怎么做?这是我要测试的类:@ComponentpublicfinalclassTestedClass{@AutowiredprivateResourceresource;@PostConstructprivatevoidinit(){//Ineedthistoreturndifferentresultresource.

php - mock :测试参数是否是包含键/值对的数组

我如何使用mockery和hamcrest断言当调用模拟对象的方法时,传递给它的参数之一是包含键/值对的数组?例如,我的测试代码可能如下所示:$mock=m::mock('\Jodes\MyClass');$mock->shouldReceive('myMethod')->once()->with(arrayContainsPair('my_key','my_value'));我知道我可以用闭包来写它,但我只是想知道是否有另一种方法可以让它读起来稍微好一点:$mock->shouldReceive('myMethod')->once()->with(m::on(function($op

php - 单元测试 : Explain the usefulness of Mock Objects

这个问题在这里已经有了答案:关闭12年前。PossibleDuplicate:WhatisObjectMockingandwhendoIneedit?

PHPUnit 调用未定义的方法 `Mock_x_::method()`

我正在尝试创建我的第一个phpunit测试,发现自己需要在IMailer接口(interface)上stub一个方法。interfaceIMailer{publicfunctionsend($to,$from,$cc,$subject,$body);publicfunctionsent();}$mailer=$this->getMockBuilder('IMailer',array('send','sent'))->getMock();$mailer->method('send')->willRreturn(0);然而,我不断得到PHPFatalerror:Calltoundefine

php - mock 没有匹配的关闭处理程序

我不明白为什么我会在这次测试中遇到这个错误。我的测试似乎与其余代码完全匹配。我忽略了什么?在我的测试中我有:$passwordBroker=m::mock('Illuminate\Auth\Reminders\PasswordBroker');$passwordBroker->shouldReceive('reset')->once()->with($this->resetAttributes,m::on(function(\Closure$closure){$this->entity->shouldReceive('setAttribute')->once()->with('pass

android - 在 Android Wear 中以低位模式进入 BW 是否真的为所有设备节省电池?

我最近将一个AndroidWear表盘放到了GooglePlay商店:https://play.google.com/store/apps/details?id=com.watchfuldesign.wearboy&hl=en我最近收到了这条评论:"Pleaseaddoptionstoaddasmalldayofmonthonthegameboyscreenaswellasnotgoingblackandwhitesincethatdoesn'tsavebatteryforeveryone."这是真的吗?我曾认为通过在环境模式下变为黑白模式可以节省电池电量-特定设备不是这样吗?我在An

android - 无法将卡片与 Android Wear 底部对齐

我正在遵循Android文档中的教程here但他们没有按照我的期望去做。我创建了一个CardFrame来在watch上显示一张卡片,并使用属性app:layout_box="bottom"让它出现在watch的底部,但正如您所看到的屏幕截图并非如此。这是我的XML:这是卡片的截图:谁能阐明为什么该属性没有按预期工作? 最佳答案 在CardFrame标签中添加属性android:layout_gravity="bottom",如下所示:这解决了我的问题,卡片出现在底部。解释:我认为cardframe教程中属性“layout_box”的