@Test
public void testCodeIntent() {

    Intent intent = new Intent(ApplicationProvider.getApplicationContext(), TestService.class);
    intent.putExtra("code", "1234");
    intent.setAction("");
    controller = Robolectric.buildService(TestService.class, intent);
    service = controller.create().get();
    controller.startCommand(0, 0);
    assertEquals("1234", service.getNearbyCode());
}