@Test public void getValuesAsDictionaryWithParam_returnedMapIsNotEmpty() throws Exception { //when Map<String, Object> dictionary = TableDisplay.getValuesAsDictionary(Arrays.asList(Arrays.asList("k1", 1), Arrays.asList("k2", 2))); //then assertThat(dictionary).isNotEmpty(); }
@Test public void defaults() { Map<String, String> map = DefaultIndexSettings.defaults().build().getAsMap(); assertThat(map).isNotEmpty(); // test some values assertThat(map.get("index.number_of_shards")).isEqualTo("1"); assertThat(map.get("index.analysis.analyzer." + SORTABLE_ANALYZER.getName() + ".tokenizer")).isEqualTo("keyword"); }
@Test public void saveAuthorizedClientWhenSavedThenSavedToSession() { OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient( this.registration2, this.principalName1, mock(OAuth2AccessToken.class)); this.authorizedClientRepository.saveAuthorizedClient(authorizedClient, null, this.request, this.response); HttpSession session = this.request.getSession(false); assertThat(session).isNotNull(); @SuppressWarnings("unchecked") Map<String, OAuth2AuthorizedClient> authorizedClients = (Map<String, OAuth2AuthorizedClient>) session.getAttribute(HttpSessionOAuth2AuthorizedClientRepository.class.getName() + ".AUTHORIZED_CLIENTS"); assertThat(authorizedClients).isNotEmpty(); assertThat(authorizedClients).hasSize(1); assertThat(authorizedClients.values().iterator().next()).isSameAs(authorizedClient); }
private void verifyFakeIndex() { ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = mappings(); MappingMetaData mapping = mappings.get("fakes").get("fake"); assertThat(mapping.type()).isEqualTo("fake"); assertThat(mapping.getSourceAsMap()).isNotEmpty(); assertThat(countMappingFields(mapping)).isEqualTo(2); assertThat(field(mapping, "updatedAt").get("type")).isEqualTo("date"); }
@Test public void executeUpdate_executes_PreparedStatement() throws Exception { dbTester.executeInsert(USERS_DB_TABLE, LOGIN_DB_COLUMN, "the_login", NAME_DB_COLUMN, "the name", IS_ROOT_DB_COLUMN, false); try (Connection connection = dbTester.openConnection()) { underTest.executeDdl(connection, "update users set " + NAME_DB_COLUMN + "='new name' where " + LOGIN_DB_COLUMN + "='the_login'"); } Map<String, Object> row = dbTester.selectFirst("select " + NAME_DB_COLUMN + " from users where " + LOGIN_DB_COLUMN + "='the_login'"); assertThat(row).isNotEmpty(); assertThat(row.get("NAME")).isEqualTo("new name"); }
@Test public void initialize_with_current_env() { Command command = Command.create("java"); assertThat(command.getEnvironmentVariables()).isNotEmpty(); }
@Test public void handle_sentMessageHasContent() throws Exception { //when handler.handle(message); //then Message sentMessage = kernel.getSentMessages().get(0); Assertions.assertThat(sentMessage.getContent()).isNotEmpty(); }
@Test public void handle_sentMessageHasContent() throws Exception { //when handler.handle(message); //then Message sentMessage = kernel.getSentMessages().get(0); Assertions.assertThat(sentMessage.getContent()).isNotEmpty(); }
@Test public void handle_sentMessageHasContent() throws Exception { //when handler.handle(message); //then Message sentMessage = kernel.getSentMessages().get(0); Assertions.assertThat(sentMessage.getContent()).isNotEmpty(); }
@Test public void handle_sentMessageHasContent() throws Exception { //when handler.handle(message); //then Message sentMessage = kernel.getSentMessages().get(0); Assertions.assertThat(sentMessage.getContent()).isNotEmpty(); }
@Test public void handle_sentMessageHasContent() throws Exception { //when handler.handle(message); //then Message sentMessage = kernel.getSentMessages().get(0); Assertions.assertThat(sentMessage.getContent()).isNotEmpty(); }
private void verifyMap(List<Message> messages) { Message tableDisplay = SearchMessages.getListWidgetsByViewName(messages, TableDisplay.VIEW_NAME_VALUE).get(0); verifyInternalOpenCommMsg(tableDisplay, TableDisplay.MODEL_NAME_VALUE, TableDisplay.VIEW_NAME_VALUE); Message model = SearchMessages.getListByDataAttr(messages, Comm.METHOD, Comm.UPDATE).get(0); assertThat(getValueForProperty(model, "model", Map.class)).isNotEmpty(); verifyDisplayMsg(messages); }
@Test public void getValuesAsDictionaryWithoutParam_returnedMapIsNotEmpty() throws Exception { //given TableDisplay tableDisplay = new TableDisplay(getMapData()); //when Map<String, Object> dictionary = tableDisplay.getValuesAsDictionary(); //then assertThat(dictionary).isNotEmpty(); }
@Test public void commOpen_sentMessageHasData() throws NoSuchAlgorithmException { initCommData(comm); //when comm.open(); //then assertThat(kernel.getPublishedMessages()).isNotEmpty(); Message sendMessage = kernel.getPublishedMessages().get(0); assertThat((Map) sendMessage.getContent().get(Comm.DATA)).isNotEmpty(); }
@Test public void commClose_sentMessageHasData() throws NoSuchAlgorithmException { initCommData(comm); //when comm.send(COMM_MSG, Comm.Buffer.EMPTY, comm.getData()); //then assertThat(kernel.getPublishedMessages()).isNotEmpty(); Message sendMessage = kernel.getPublishedMessages().get(0); assertThat((Map) sendMessage.getContent().get(Comm.DATA)).isNotEmpty(); }
@Test public void handleInfoCommMessages_replyCommMessageHasCommsInfoContent() throws Exception { //given initKernelCommMapWithOneComm(kernel); //when commInfoHandler.handle(initInfoMessage()); //then Assertions.assertThat(kernel.getSentMessages()).isNotEmpty(); Message sendMessage = kernel.getSentMessages().get(0); Assertions.assertThat((Map) sendMessage.getContent().get(COMMS)).isNotEmpty(); }
@Test public void compare_only_right() { qProfileRules.activateAndCommit(dbSession, right, singleton(RuleActivation.create(xooRule1.getId()))); QProfileComparisonResult result = comparison.compare(dbSession, left, right); assertThat(result.left().getKee()).isEqualTo(left.getKee()); assertThat(result.right().getKee()).isEqualTo(right.getKee()); assertThat(result.same()).isEmpty(); assertThat(result.inLeft()).isEmpty(); assertThat(result.inRight()).isNotEmpty().containsOnlyKeys(xooRule1.getKey()); assertThat(result.modified()).isEmpty(); assertThat(result.collectRuleKeys()).containsOnly(xooRule1.getKey()); }
@Test public void compare_disjoint() { qProfileRules.activateAndCommit(dbSession, left, singleton(RuleActivation.create(xooRule1.getId()))); qProfileRules.activateAndCommit(dbSession, right, singleton(RuleActivation.create(xooRule2.getId()))); QProfileComparisonResult result = comparison.compare(dbSession, left, right); assertThat(result.left().getKee()).isEqualTo(left.getKee()); assertThat(result.right().getKee()).isEqualTo(right.getKee()); assertThat(result.same()).isEmpty(); assertThat(result.inLeft()).isNotEmpty().containsOnlyKeys(xooRule1.getKey()); assertThat(result.inRight()).isNotEmpty().containsOnlyKeys(xooRule2.getKey()); assertThat(result.modified()).isEmpty(); assertThat(result.collectRuleKeys()).containsOnly(xooRule1.getKey(), xooRule2.getKey()); }
@Test public void compare_same() { RuleActivation commonActivation = RuleActivation.create(xooRule1.getId(), Severity.CRITICAL, ImmutableMap.of("min", "7", "max", "42")); qProfileRules.activateAndCommit(dbSession, left, singleton(commonActivation)); qProfileRules.activateAndCommit(dbSession, right, singleton(commonActivation)); QProfileComparisonResult result = comparison.compare(dbSession, left, right); assertThat(result.left().getKee()).isEqualTo(left.getKee()); assertThat(result.right().getKee()).isEqualTo(right.getKee()); assertThat(result.same()).isNotEmpty().containsOnlyKeys(xooRule1.getKey()); assertThat(result.inLeft()).isEmpty(); assertThat(result.inRight()).isEmpty(); assertThat(result.modified()).isEmpty(); assertThat(result.collectRuleKeys()).containsOnly(xooRule1.getKey()); }
@Test public void compare_only_left() { RuleActivation activation = RuleActivation.create(xooRule1.getId()); qProfileRules.activateAndCommit(dbSession, left, singleton(activation)); QProfileComparisonResult result = comparison.compare(dbSession, left, right); assertThat(result.left().getKee()).isEqualTo(left.getKee()); assertThat(result.right().getKee()).isEqualTo(right.getKee()); assertThat(result.same()).isEmpty(); assertThat(result.inLeft()).isNotEmpty().containsOnlyKeys(xooRule1.getKey()); assertThat(result.inRight()).isEmpty(); assertThat(result.modified()).isEmpty(); assertThat(result.collectRuleKeys()).containsOnly(xooRule1.getKey()); }