@Test public void getControlHandlersWithEmptyString_returnEmptyHandlersArray() throws Exception { //when Handler<Message>[] handlers = commOpenHandler.getKernelControlChanelHandlers(""); //then Assertions.assertThat(handlers).isEmpty(); }
@Test public void getControlHandlersWithEmptyString_returnEmptyHandlersArray() throws Exception { //when Handler<Message>[] handlers = commOpenHandler.getKernelControlChanelHandlers(""); //then Assertions.assertThat(handlers).isEmpty(); }
@Test public void getStringArrayWithNullArrayParam_returnEmptyArray() throws Exception { //when String[] value = valueWidget.getStringArray(null); //then Assertions.assertThat(value).isEmpty(); }
@Test public void getControlHandlersWithEmptyString_returnEmptyHandlersArray() throws Exception { //when Handler<Message>[] handlers = commOpenHandler.getKernelControlChanelHandlers(""); //then Assertions.assertThat(handlers).isEmpty(); }
@Test public void getControlHandlersWithEmptyString_returnEmptyHandlersArray() throws Exception { //when Handler<Message>[] handlers = commOpenHandler.getKernelControlChanelHandlers(""); //then Assertions.assertThat(handlers).isEmpty(); }
@Test public void getControlHandlersWithEmptyString_returnEmptyHandlersArray() throws Exception { //when Handler<Message>[] handlers = commOpenHandler.getKernelControlChanelHandlers(""); //then Assertions.assertThat(handlers).isEmpty(); }
@Test public void testGetStoriesEmpty() { AlgoliaClient.AlgoliaHits hits = new GsonBuilder().create().fromJson("{\"hits\":[]}", AlgoliaClient.AlgoliaHits.class); when(TestRestServiceFactory.algoliaRestService.searchByDate(eq("filter"))) .thenReturn(Observable.just(hits)); client.getStories("filter", ItemManager.MODE_DEFAULT, storiesListener); verify(TestRestServiceFactory.algoliaRestService).searchByDate(eq("filter")); verify(storiesListener).onResponse(getStoriesResponse.capture()); assertThat(getStoriesResponse.getValue()).isEmpty(); }
@Test public void fillInStackTrace() { StorePassThroughException e = new StorePassThroughException(new Exception()); assertThat(e.getStackTrace()).isEmpty(); }
@Test public void testGetAskEmpty() { when(TestRestServiceFactory.hnRestService.askStoriesRx()) .thenReturn(Observable.just(new int[0])); client.getStories(ItemManager.ASK_FETCH_MODE, ItemManager.MODE_DEFAULT, storiesListener); verify(TestRestServiceFactory.hnRestService).askStoriesRx(); verify(storiesListener).onResponse(getStoriesResponse.capture()); assertThat(getStoriesResponse.getValue()).isEmpty(); }
@Test public void testGetKidItems() { assertThat(item.getKidItems()).isEmpty(); item.populate(new TestItem() { @Override public long[] getKids() { return new long[]{1l, 2l}; } }); assertThat(item.getKidItems()).hasSize(2); assertEquals(1, item.getKidItems()[0].getRank()); assertEquals(2, item.getKidItems()[1].getRank()); }
@Config(sdk = 21) @Test public void testRemoveAccount() { AccountManager.get(activity).addAccountExplicitly(new Account("existing", BuildConfig.APPLICATION_ID), "password", null); Preferences.setUsername(activity, "existing"); drawerAccount.performClick(); AlertDialog alertDialog = ShadowAlertDialog.getLatestAlertDialog(); assertNotNull(alertDialog); assertThat(alertDialog.getListView().getAdapter()).hasCount(1); alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL).performClick(); assertThat(alertDialog).isNotShowing(); assertThat(AccountManager.get(activity).getAccounts()).isEmpty(); }
@Test public void injectUnitVariablesNoDataSourceInUnit() { factory.bindVariable("numberVariable", BigDecimal.ONE); factory.bindVariable("stringList", Collections.singletonList("test")); final TestRuleUnit testRuleUnit = new TestRuleUnit(new Integer[]{}, BigDecimal.ZERO); testRuleUnit.getStringList().add("bla"); final InternalRuleUnitExecutor ruleUnitExecutor = mock(InternalRuleUnitExecutor.class); factory.injectUnitVariables(ruleUnitExecutor, testRuleUnit); // Unassigned variables or numbers equal 0 should be reassigned if a variable exists. assertThat(testRuleUnit.getNumber()).isEqualTo(BigDecimal.ONE); // Others should remain the same. assertThat(testRuleUnit.bound).isFalse(); assertThat(testRuleUnit.getNumbersArray()).isNotNull().isEmpty(); assertThat(testRuleUnit.getSimpleFactList()).isNotNull().isEmpty(); assertThat(testRuleUnit.getStringList()).isNotNull().hasSize(1).containsExactly("bla"); verifyZeroInteractions(ruleUnitExecutor); }
@Test public void testGetters() { assertThat(colorSettingsPage).isNotNull(); assertThat(colorSettingsPage.getColorDescriptors()).isEmpty(); assertThat(colorSettingsPage.getDisplayName()).isEqualTo("SonarLint"); assertThat(colorSettingsPage.getHighlighter()).isInstanceOf(PlainSyntaxHighlighter.class); }
@Test public void canParseToEmpty() throws Exception { Integer[] intArray = parser.parse("null", Integer[].class); assertThat(intArray) .isInstanceOf(Integer[].class) .isEmpty(); }
@Test public void testHandleMetadataAddition() { final String metadata = "a_b_c"; popup.handleMetadataAddition(metadata); assertThat(model.attributes).isEmpty(); assertThat(model.metadataList).containsExactly(new RuleMetadata(metadata, "")); }
@Test public void testHandleAttributeAddition_LockLHS() { popup.handleAttributeAddition(RuleAttributeWidget.LOCK_LHS); assertThat(model.attributes).isEmpty(); assertThat(model.metadataList).containsExactly(new RuleMetadata(RuleAttributeWidget.LOCK_LHS, "true")); verify(refreshCommand).execute(); }
@Test public void testHandleAttributeAddition_LockRHS() { popup.handleAttributeAddition(RuleAttributeWidget.LOCK_RHS); assertThat(model.attributes).isEmpty(); assertThat(model.metadataList).containsExactly(new RuleMetadata(RuleAttributeWidget.LOCK_RHS, "true")); verify(refreshCommand).execute(); }
@Test public void testHandleAttributeAddition_LockLHS() { popup.handleAttributeAddition(RuleAttributeWidget.LOCK_LHS); assertThat(model.attributes).isEmpty(); assertThat(model.metadataList).containsExactly(new RuleMetadata(RuleAttributeWidget.LOCK_LHS, "true")); verify(refreshCommand).execute(); }
@Test public void testHandleAttributeAddition_Timer() { popup.handleAttributeAddition(RuleAttributeWidget.TIMER_ATTR); assertThat(model.attributes).containsExactly(new RuleAttribute(RuleAttributeWidget.TIMER_ATTR, "")); assertThat(model.metadataList).isEmpty(); verify(refreshCommand).execute(); }
@Test public void disposeShouldReleaseEditor() throws Exception { // exercise application.invokeAndWait(() -> underTest.dispose()); // verify final Editor[] actual = EditorFactory.getInstance().getAllEditors(); assertThat(actual) .isEmpty(); }