当前位置: 首页>>代码示例>>Java>>正文


Java HashMap类代码示例

本文整理汇总了Java中com.google.gwt.dev.util.collect.HashMap的典型用法代码示例。如果您正苦于以下问题:Java HashMap类的具体用法?Java HashMap怎么用?Java HashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HashMap类属于com.google.gwt.dev.util.collect包,在下文中一共展示了HashMap类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldParseStyles

import com.google.gwt.dev.util.collect.HashMap; //导入依赖的package包/类
@Test
public void shouldParseStyles() {
    //Given
    Element element = mock(Element.class);
    Map<String, String> styles = new HashMap<String, String>();
    styles.put(EmpiriaStyleNameConstants.EMPIRIA_IMG_EXPLORABLE_SCALE_INITIAL, "110%");
    styles.put(EmpiriaStyleNameConstants.EMPIRIA_IMG_EXPLORABLE_SCALE_STEP, "30%");
    styles.put(EmpiriaStyleNameConstants.EMPIRIA_IMG_EXPLORABLE_SCALE_MAX, "500%");
    styles.put(EmpiriaStyleNameConstants.EMPIRIA_IMG_EXPLORABLE_WINDOW_WIDTH, "800");
    styles.put(EmpiriaStyleNameConstants.EMPIRIA_IMG_EXPLORABLE_WINDOW_HEIGHT, "600");
    when(styleSocket.getStyles(element)).thenReturn(styles);

    //When
    ImageProperties imageProperties = testObj.parseStyles(element);

    //Then
    assertThat(imageProperties.getScale(), equalTo(1.1d));
    assertThat(imageProperties.getScaleStep(), equalTo(1.3d));
    assertThat(imageProperties.getZoomMax(), equalTo(5d));
    assertThat(imageProperties.getWindowWidth(), equalTo(800));
    assertThat(imageProperties.getWindowHeight(), equalTo(600));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:23,代码来源:StyleParserTest.java

示例2: shouldDetectChoiceMaxMatchLimits

import com.google.gwt.dev.util.collect.HashMap; //导入依赖的package包/类
@Test
public void shouldDetectChoiceMaxMatchLimits() {
    //given
    Map<String, Integer> matchMaxMap = new HashMap<String, Integer>();
    matchMaxMap.put(CONNECTION_RESPONSE_1_0, 1);
    matchMaxMap.put(CONNECTION_RESPONSE_1_1, 1);
    matchMaxMap.put(CONNECTION_RESPONSE_1_4, 2);
    matchMaxMap.put(CONNECTION_RESPONSE_1_3, 2);
    connectionModulePresenter.setBean(createBeanFromXMLString(mockStructure(null, matchMaxMap)));
    PairConnectEvent event1 = new PairConnectEvent(PairConnectEventTypes.CONNECTED, CONNECTION_RESPONSE_1_0, CONNECTION_RESPONSE_1_4, true);
    PairConnectEvent event2 = new PairConnectEvent(PairConnectEventTypes.CONNECTED, CONNECTION_RESPONSE_1_3, CONNECTION_RESPONSE_1_1, true);
    PairConnectEvent event3 = new PairConnectEvent(PairConnectEventTypes.CONNECTED, CONNECTION_RESPONSE_1_3, CONNECTION_RESPONSE_1_4, true);
    PairConnectEvent event4 = new PairConnectEvent(PairConnectEventTypes.CONNECTED, CONNECTION_RESPONSE_1_0, CONNECTION_RESPONSE_1_1, true);
    //when
    connectionModulePresenter.onConnectionEvent(event1);
    connectionModulePresenter.onConnectionEvent(event2);
    connectionModulePresenter.onConnectionEvent(event3);
    connectionModulePresenter.onConnectionEvent(event4);
    //then
    Mockito.verify(connectionModuleModel).addAnswer(concatNodes(CONNECTION_RESPONSE_1_0, CONNECTION_RESPONSE_1_4));
    Mockito.verify(connectionModuleModel).addAnswer(concatNodes(CONNECTION_RESPONSE_1_3, CONNECTION_RESPONSE_1_1));
    Mockito.verify(connectionModuleModel).addAnswer(concatNodes(CONNECTION_RESPONSE_1_3, CONNECTION_RESPONSE_1_4));
    Mockito.verify(connectionModuleModel, Mockito.never()).addAnswer(concatNodes(CONNECTION_RESPONSE_1_0, CONNECTION_RESPONSE_1_1));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:25,代码来源:ConnectionModulePresenterTest.java

示例3: testRefreshConditionsWidgetWhenConditionColumnsIsNotEmpty

import com.google.gwt.dev.util.collect.HashMap; //导入依赖的package包/类
@Test
public void testRefreshConditionsWidgetWhenConditionColumnsIsNotEmpty() {

    final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
    final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
    final Label blankSlate = mock(Label.class);
    final List<CompositeColumn<? extends BaseColumn>> conditions1 = new ArrayList<CompositeColumn<? extends BaseColumn>>() {{
        add(compositeColumn1);
    }};
    final Map<String, List<BaseColumn>> conditions2 = new HashMap<String, List<BaseColumn>>() {{
        put("title", new ArrayList<>());
    }};

    doReturn(verticalPanel).when(presenter).getConditionsWidget();
    doReturn(columnManagementView).when(presenter).getConditionsPanel();
    doReturn(blankSlate).when(presenter).blankSlate();
    doReturn(item).when(accordion).getItem(CONDITION);
    doReturn(conditions2).when(presenter).groupByTitle(conditions1);

    presenter.refreshConditionsWidget(conditions1);

    verify(item, never()).setOpen(false);
    verify(verticalPanel, never()).add(blankSlate);
    verify(verticalPanel).add(columnManagementView);
    verify(columnManagementView).renderColumns(conditions2);
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:27,代码来源:ColumnsPagePresenterTest.java

示例4: setupEnums

import com.google.gwt.dev.util.collect.HashMap; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void setupEnums( final String cellValue,
                         final String... values ) {
    final Map<String, String> enums = new HashMap<>();
    for ( String value : values ) {
        enums.put( value, value );
    }
    doAnswer( ( InvocationOnMock invocation ) -> {
        final Callback<Map<String, String>> callback = (Callback<Map<String, String>>) invocation.getArguments()[ 3 ];
        callback.callback( enums );
        return null;
    } ).when( presenter ).getEnumLookups( anyString(),
                                          anyString(),
                                          any( DependentEnumsUtilities.Context.class ),
                                          any( Callback.class ) );
    when( multiValueFactory.convert( eq( cellValue ) ) ).thenReturn( cellValue );
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:18,代码来源:BaseEnumSingleSelectUiColumnTest.java

示例5: copyOutcomesMap

import com.google.gwt.dev.util.collect.HashMap; //导入依赖的package包/类
protected Map<String, Outcome> copyOutcomesMap(Map<String, Outcome> outcomes) {
    Map<String, Outcome> copyOfMap = new HashMap<String, Outcome>();

    for (String key : outcomes.keySet()) {
        Outcome currentOutcome = outcomes.get(key);
        Outcome copyOfOutcome = copyOutcome(currentOutcome);
        copyOfMap.put(key, copyOfOutcome);
    }

    return copyOfMap;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:12,代码来源:VariableProcessorFunctionalTestBase.java

示例6: preferMp3

import com.google.gwt.dev.util.collect.HashMap; //导入依赖的package包/类
/**
 * Filter file set, preferring *.mp3 files where alternatives exist.
 */
private HashSet<Resource> preferMp3(HashSet<Resource> files) {
  HashMap<String, Resource> map = new HashMap<String, Resource>();
  for (Resource file : files) {
    String path = stripExtension(file.getPath());
    if (file.getPath().endsWith(".mp3") || !map.containsKey(path)) {
      map.put(path, file);
    }
  }
  return new HashSet<Resource>(map.values());
}
 
开发者ID:playn,项目名称:playn,代码行数:14,代码来源:AutoClientBundleGenerator.java

示例7: preferMp3

import com.google.gwt.dev.util.collect.HashMap; //导入依赖的package包/类
/**
 * Filter file set, preferring *.mp3 files where alternatives exist.
 */
private HashSet<File> preferMp3(Set<File> files) {
  HashMap<String, File> map = new HashMap<String, File>();
  for (File file : files) {
    String path = stripExtension(file.getPath());
    if (file.getName().endsWith(".mp3") || !map.containsKey(path)) {
      map.put(path, file);
    }
  }
  return new HashSet<File>(map.values());
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:14,代码来源:AutoClientBundleGenerator.java

示例8: testRefreshActionsWidgetWhenActionColumnsIsNotEmpty

import com.google.gwt.dev.util.collect.HashMap; //导入依赖的package包/类
@Test
public void testRefreshActionsWidgetWhenActionColumnsIsNotEmpty() {

    final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
    final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
    final Label blankSlate = mock(Label.class);
    final ActionCol52 actionCol52 = mock(ActionCol52.class);
    final List<ActionCol52> actionColumns1 = new ArrayList<ActionCol52>() {{
        add(actionCol52);
    }};
    final Map<String, List<BaseColumn>> actionColumns2 = new HashMap<String, List<BaseColumn>>() {{
        put("title", new ArrayList<>());
    }};

    doReturn(verticalPanel).when(presenter).getActionsWidget();
    doReturn(columnManagementView).when(presenter).getActionsPanel();
    doReturn(blankSlate).when(presenter).blankSlate();
    doReturn(item).when(accordion).getItem(ACTION);
    doReturn(actionColumns2).when(presenter).groupByTitle(actionColumns1);

    presenter.refreshActionsWidget(actionColumns1);

    verify(item, never()).setOpen(false);
    verify(verticalPanel, never()).add(blankSlate);
    verify(verticalPanel).add(columnManagementView);
    verify(columnManagementView).renderColumns(actionColumns2);
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:28,代码来源:ColumnsPagePresenterTest.java

示例9: setup

import com.google.gwt.dev.util.collect.HashMap; //导入依赖的package包/类
@Before
public void setup() {
    view = spy(new GuidedDecisionTableModellerViewImplFake(translationService));

    ApplicationPreferences.setUp(new HashMap<String, String>() {{
        put(ApplicationPreferences.DATE_FORMAT,
            "dd/mm/yy");
    }});
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:10,代码来源:GuidedDecisionTableModellerViewImplTest.java

示例10: mockAppConfigService

import com.google.gwt.dev.util.collect.HashMap; //导入依赖的package包/类
private void mockAppConfigService() {
    appConfigService = mock(AppConfigService.class);
    Map<String, String> preferencesMap = new HashMap<>();
    preferencesMap.put("key",
                       "value");
    doReturn(preferencesMap).when(appConfigService).loadPreferences();
    appConfigServiceCallerMock = new CallerMock<>(appConfigService);
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:9,代码来源:DefaultWorkbenchEntryPointTest.java

示例11: mockTextGap

import com.google.gwt.dev.util.collect.HashMap; //导入依赖的package包/类
public TextEntryGapModuleMock mockTextGap() {
    return new TextEntryGapModuleMock(new HashMap<String, String>());
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:4,代码来源:TextEntryMathGapModuleJUnitTest.java


注:本文中的com.google.gwt.dev.util.collect.HashMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。