• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Lists类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: shouldReturnPresentInstance_whenWordsAreNotEmpty

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void shouldReturnPresentInstance_whenWordsAreNotEmpty() {
    // given
    List<String> wordsByLetterK = Lists.newArrayList("ka", "kb");
    wordsByLetter.put("k", wordsByLetterK);
    baseIndexes.put("k", 0);
    List<String> wordsByLetterO = Lists.newArrayList("on", "oz");
    wordsByLetter.put("o", wordsByLetterO);
    baseIndexes.put("o", 1);

    Words words = new Words(wordsByLetter, baseIndexes);

    // when
    Optional<WordsResult> result = testObj.find(words);


    // then
    assertThat(result.isPresent()).isTrue();
    WordsResult wordResult = result.get();
    assertThat(wordResult.getList()).isEqualTo(wordsByLetterK);
    assertThat(wordResult.getIndex()).isEqualTo(0);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:23,代码来源:FirstWordFinderTest.java


示例2: shouldReturnFirstIndex_whenBaseIndexesIsNotEmpty

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void shouldReturnFirstIndex_whenBaseIndexesIsNotEmpty() {
    // given
    List<String> wordsByLetterK = Lists.newArrayList("ka", "kb");
    wordsByLetter.put("k", wordsByLetterK);
    baseIndexes.put("k", 0);
    List<String> wordsByLetterO = Lists.newArrayList("on", "oz");
    wordsByLetter.put("o", wordsByLetterO);
    baseIndexes.put("o", 1);

    testObj = new Words(wordsByLetter, baseIndexes);

    // when
    Optional<String> result = testObj.getFirstIndex();

    // than
    assertEquals(result.get(), "k");
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:WordsTest.java


示例3: shouldInitSounds

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void shouldInitSounds() {
    // given
    SlideBean slide = mock(SlideBean.class);
    SoundBean soundBean = mock(SoundBean.class);
    List<SlideBean> slides = Lists.newArrayList();
    slides.add(slide);

    String audiopath = "test.mp3";
    when(slide.getSound()).thenReturn(soundBean);
    when(slide.hasSound()).thenReturn(true);
    when(soundBean.getSrc()).thenReturn(audiopath);

    // when
    testObj.init(slides, inlineBodyGeneratorSocket);

    // then
    verify(slideshowSoundController).initSound(audiopath);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:20,代码来源:SlideshowControllerTest.java


示例4: shouldResetSlide_whenCantSwitchToNextSlide

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void shouldResetSlide_whenCantSwitchToNextSlide() {
    // given
    List<SlideBean> slides = Lists.newArrayList();
    testObj.init(slides, inlineBodyGeneratorSocket);
    verify(slidesSwitcher).setSlideEnd(slideEndCaptor.capture());
    SlideEndHandler value = slideEndCaptor.getValue();

    when(slidesSwitcher.canSwitchToNextSlide()).thenReturn(false);

    // when
    value.onEnd();

    // then
    verify(slidesSwitcher, times(2)).reset();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:17,代码来源:SlideshowControllerTest.java


示例5: shouldContinuePlayingSlideshow_whenCanSwitchToNextSlide

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void shouldContinuePlayingSlideshow_whenCanSwitchToNextSlide() {
    // given
    List<SlideBean> slides = Lists.newArrayList();
    testObj.init(slides, inlineBodyGeneratorSocket);
    verify(slidesSwitcher).setSlideEnd(slideEndCaptor.capture());
    SlideEndHandler value = slideEndCaptor.getValue();

    when(slidesSwitcher.canSwitchToNextSlide()).thenReturn(true);

    // when
    value.onEnd();

    // then
    verify(slidesSwitcher).showNextSlide();
    verify(slidesSwitcher).stopAndPlaySlide();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:SlideshowControllerTest.java


示例6: shouldStopSlideshow_whenCanNotSwitchToNextSlide

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void shouldStopSlideshow_whenCanNotSwitchToNextSlide() {
    // given
    List<SlideBean> slides = Lists.newArrayList();
    testObj.init(slides, inlineBodyGeneratorSocket);
    verify(slidesSwitcher).setSlideEnd(slideEndCaptor.capture());
    SlideEndHandler value = slideEndCaptor.getValue();

    when(slidesSwitcher.canSwitchToNextSlide()).thenReturn(false);

    // when
    value.onEnd();

    // then
    verify(slidesSwitcher, times(2)).reset();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:17,代码来源:SlideshowControllerTest.java


示例7: shouldRestoreView

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void shouldRestoreView() {
    // given
    String firstId = "firstId";
    String secondId = "secondId";
    when(firstPresenter.getIdentifier()).thenReturn(firstId);
    when(secondPresenter.getIdentifier()).thenReturn(secondId);

    List<String> selectedChoices = Lists.newArrayList();
    selectedChoices.add(firstId);

    // when
    testObj.restoreView(selectedChoices);

    // then
    verify(firstPresenter).setSelected(true);
    verify(secondPresenter).setSelected(false);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:IdentificationChoicesManagerTest.java


示例8: testFindAnswersObjectsOfGivenType_findCorrectAnswers

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void testFindAnswersObjectsOfGivenType_findCorrectAnswers() {
    TestIdentifiableObject correctObject = createObject("correct");
    TestIdentifiableObject notCorrectObject = createObject("notCorrect");

    List<TestIdentifiableObject> identifiableObjects = Lists.newArrayList(correctObject, notCorrectObject);

    when(responseModel.isCorrectAnswer("correct")).thenReturn(true);

    when(responseModel.isCorrectAnswer("notCorrect")).thenReturn(false);

    // then
    List<TestIdentifiableObject> resultObjects = answersByTypeFinder.findAnswersObjectsOfGivenType(MarkAnswersType.CORRECT, identifiableObjects,
            responseModel);

    assertEquals(1, resultObjects.size());
    assertEquals(correctObject, resultObjects.get(0));
    verify(responseModel).isCorrectAnswer("correct");
    verify(responseModel).isCorrectAnswer("notCorrect");
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:21,代码来源:IdentifiableAnswersByTypeFinderJUnitTest.java


示例9: testFindAnswersObjectsOfGivenType_findWrongAnswers

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void testFindAnswersObjectsOfGivenType_findWrongAnswers() {
    TestIdentifiableObject correctObject = createObject("correct");
    TestIdentifiableObject notCorrectObject = createObject("notCorrect");

    List<TestIdentifiableObject> identifiableObjects = Lists.newArrayList(correctObject, notCorrectObject);

    when(responseModel.isCorrectAnswer("correct")).thenReturn(true);

    when(responseModel.isCorrectAnswer("notCorrect")).thenReturn(false);

    // then
    List<TestIdentifiableObject> resultObjects = answersByTypeFinder.findAnswersObjectsOfGivenType(MarkAnswersType.WRONG, identifiableObjects,
            responseModel);

    assertEquals(1, resultObjects.size());
    assertEquals(notCorrectObject, resultObjects.get(0));
    verify(responseModel).isCorrectAnswer("correct");
    verify(responseModel).isCorrectAnswer("notCorrect");
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:21,代码来源:IdentifiableAnswersByTypeFinderJUnitTest.java


示例10: testFillFirstColumnWithItems

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void testFillFirstColumnWithItems() {
    SelectionItemBean itemBean = new SelectionItemBean();
    XMLContent xmlContent = mock(XMLContent.class);

    itemBean.setXmlContent(xmlContent);
    List<SelectionItemBean> items = Lists.newArrayList(itemBean);

    SelectionGridElementPosition updatedElementPositon = new SelectionGridElementPosition(0, 0);
    when(positionGenerator.getItemLabelElementPosition(0)).thenReturn(updatedElementPositon);

    // then
    viewBuilder.fillFirstColumnWithItems(items);

    SelectionGridElementPosition position = new SelectionGridElementPosition(0, items.indexOf(itemBean));
    verify(selectionModuleView).setItemDisplayedName(itemBean.getXmlContent(), position);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:SelectionViewBuilderJUnitTest.java


示例11: testFillFirstRowWithChoices

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void testFillFirstRowWithChoices() {
    SelectionSimpleChoiceBean choiceBean = new SelectionSimpleChoiceBean();
    XMLContent xmlContent = mock(XMLContent.class);

    choiceBean.setXmlContent(xmlContent);
    List<SelectionSimpleChoiceBean> simpleChoices = Lists.newArrayList(choiceBean);
    ;

    SelectionGridElementPosition updatedElementPositon = new SelectionGridElementPosition(0, 0);
    when(positionGenerator.getChoiceLabelElementPosition(0)).thenReturn(updatedElementPositon);

    // then
    viewBuilder.fillFirstRowWithChoices(simpleChoices);

    SelectionGridElementPosition position = new SelectionGridElementPosition(simpleChoices.indexOf(choiceBean), 0);
    verify(selectionModuleView).setChoiceOptionDisplayedName(choiceBean.getXmlContent(), position);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:SelectionViewBuilderJUnitTest.java


示例12: testGetSelectedAnswers

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void testGetSelectedAnswers() throws Exception {
    // given
    SelectionAnswerDto selectedAnswer1 = new SelectionAnswerDto();
    List<SelectionAnswerDto> selectedAnswers1 = Lists.newArrayList(selectedAnswer1);

    SelectionAnswerDto selectedAnswer2 = new SelectionAnswerDto();
    List<SelectionAnswerDto> selectedAnswers2 = Lists.newArrayList(selectedAnswer2);

    // when
    when(groupController1.getSelectedAnswers()).thenReturn(selectedAnswers1);

    when(groupController2.getSelectedAnswers()).thenReturn(selectedAnswers2);

    List<SelectionAnswerDto> allSelectedAnswers = groupAnswersControllerModel.getSelectedAnswers();

    // then
    assertEquals(2, allSelectedAnswers.size());
    assertEquals(selectedAnswer1, allSelectedAnswers.get(0));
    assertEquals(selectedAnswer2, allSelectedAnswers.get(1));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:22,代码来源:GroupAnswersControllerModelTest.java


示例13: testGetNotSelectedAnswers

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void testGetNotSelectedAnswers() throws Exception {
    // given
    SelectionAnswerDto notSelectedAnswer1 = new SelectionAnswerDto();
    List<SelectionAnswerDto> notSelectedAnswers1 = Lists.newArrayList(notSelectedAnswer1);

    SelectionAnswerDto notSelectedAnswer2 = new SelectionAnswerDto();
    List<SelectionAnswerDto> notSelectedAnswers2 = Lists.newArrayList(notSelectedAnswer2);

    // when
    when(groupController1.getNotSelectedAnswers()).thenReturn(notSelectedAnswers1);

    when(groupController2.getNotSelectedAnswers()).thenReturn(notSelectedAnswers2);

    List<SelectionAnswerDto> notSelectedAnswers = groupAnswersControllerModel.getNotSelectedAnswers();

    // then
    assertEquals(2, notSelectedAnswers.size());
    assertEquals(notSelectedAnswer1, notSelectedAnswers.get(0));
    assertEquals(notSelectedAnswer2, notSelectedAnswers.get(1));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:22,代码来源:GroupAnswersControllerModelTest.java


示例14: testGetButtonsToMarkForType

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void testGetButtonsToMarkForType() throws Exception {
    // given
    SelectionAnswerDto selectedAnswer1 = new SelectionAnswerDto();
    List<SelectionAnswerDto> selectedAnswers1 = Lists.newArrayList(selectedAnswer1);

    MarkAnswersType type = MarkAnswersType.CORRECT;

    // when
    when(groupController1.getSelectedAnswers()).thenReturn(selectedAnswers1);

    groupAnswersControllerModel.getButtonsToMarkForType(type);

    // then
    verify(identifiableAnswersByTypeFinder).findAnswersObjectsOfGivenType(type, groupAnswersControllerModel.getSelectedAnswers(), model);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:17,代码来源:GroupAnswersControllerModelTest.java


示例15: testReset

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void testReset() {
    // given
    GroupAnswersController groupController1 = mock(GroupAnswersController.class);
    GroupAnswersController groupController2 = mock(GroupAnswersController.class);

    List<GroupAnswersController> groupControllers = Lists.newArrayList(groupController1, groupController2);

    // when
    when(answersControllerModel.getGroupChoicesControllers()).thenReturn(groupControllers);

    // then
    presenter.reset();

    verify(groupController1).reset();
    verify(groupController2).reset();

    Mockito.verifyNoMoreInteractions(groupController1, groupController2);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:20,代码来源:SelectionModulePresenterImplJUnitTest.java


示例16: shouldBuildView

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void shouldBuildView() throws Exception {
    // given
    SimpleOrderChoiceBean choiceBean = getChoiceBean("a");
    SimpleOrderChoiceBean secondChoiceBean = getChoiceBean("b");
    List<SimpleOrderChoiceBean> choiceBeans = Lists.newArrayList(choiceBean, secondChoiceBean);
    bean.setChoiceBeans(choiceBeans);

    // when
    orderingViewBuilder.buildView(bean, bodyGeneratorSocket);

    // then
    verifyThatItemWasAddedToDaoWithCorrectValues(choiceBean, "0");
    verifyThatItemWasAddedToDaoWithCorrectValues(secondChoiceBean, "1");
    verify(orderingItemsDao).createInitialItemsOrder();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:17,代码来源:OrderingViewBuilderJUnitTest.java


示例17: shouldShowCorrectAnswers

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void shouldShowCorrectAnswers() throws Exception {
    // given
    ShowAnswersType mode = ShowAnswersType.CORRECT;

    List<String> correctAnswers = Lists.newArrayList("correctAnswers");
    when(model.getCorrectAnswers()).thenReturn(correctAnswers);

    List<String> newAnswersOrder = Lists.newArrayList("newAnswersOrder");
    when(itemsResponseOrderController.getCorrectItemsOrderByAnswers(correctAnswers)).thenReturn(newAnswersOrder);

    // when
    List<String> result = controller.findNewAnswersOrderToShow(mode);

    // then
    assertEquals(newAnswersOrder, result);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:OrderingShowingAnswersControllerJUnitTest.java


示例18: shouldShowAnswersSpecyfiedByCurrentAnswers

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void shouldShowAnswersSpecyfiedByCurrentAnswers() throws Exception {
    // given
    ShowAnswersType mode = ShowAnswersType.USER;

    List<String> currentAnswers = Lists.newArrayList("correctAnswers");
    when(model.getCurrentAnswers()).thenReturn(currentAnswers);

    List<String> newAnswersOrder = Lists.newArrayList("newAnswersOrder");
    when(itemsResponseOrderController.getCorrectItemsOrderByAnswers(currentAnswers)).thenReturn(newAnswersOrder);

    // when
    List<String> result = controller.findNewAnswersOrderToShow(mode);

    // then
    assertEquals(newAnswersOrder, result);
    verify(orderingItemsDao).setItemsOrder(newAnswersOrder);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:OrderingShowingAnswersControllerJUnitTest.java


示例19: shouldResetAnswersToNewRandomOnes

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Test
public void shouldResetAnswersToNewRandomOnes() throws Exception {
    List<String> currentAnswers = Lists.newArrayList("currAnswers");
    when(model.getCurrentAnswers()).thenReturn(currentAnswers);

    List<String> correctAnswers = Lists.newArrayList("correctAnswers");
    when(model.getCorrectAnswers()).thenReturn(correctAnswers);

    List<String> newAnswersOrder = Lists.newArrayList("new Answers Order");
    when(orderingAnswersShuffler.shuffleAnswers(currentAnswers, correctAnswers)).thenReturn(newAnswersOrder);

    List<String> newItemsOrder = Lists.newArrayList("newItemsOrder");
    when(itemsResponseOrderController.getCorrectItemsOrderByAnswers(newAnswersOrder)).thenReturn(newItemsOrder);

    controller.reset();

    InOrder inOrder = Mockito.inOrder(orderingItemsDao, itemsResponseOrderController, orderingAnswersShuffler);
    inOrder.verify(orderingAnswersShuffler).shuffleAnswers(currentAnswers, correctAnswers);
    inOrder.verify(itemsResponseOrderController).getCorrectItemsOrderByAnswers(newAnswersOrder);
    inOrder.verify(orderingItemsDao).setItemsOrder(newItemsOrder);
    inOrder.verify(itemsResponseOrderController).updateResponseWithNewOrder(newItemsOrder);

    Mockito.verifyNoMoreInteractions(orderingAnswersShuffler, orderingItemsDao, itemsResponseOrderController);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:25,代码来源:OrderingResetControllerJUnitTest.java


示例20: setUp

import com.google.gwt.thirdparty.guava.common.collect.Lists; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    orderingItemsDao = new OrderingItemsDao();
    itemsMarkingController = new ItemsMarkingController(responseOrderController, responseSocket, model, orderingItemsDao);

    correctItem1 = createItem("correctItem1");
    wrongItem = createItem("wrongItem");
    correctItem2 = createItem("correctItem2");

    Response response = Mockito.mock(Response.class);
    when(model.getResponse()).thenReturn(response);

    when(responseSocket.evaluateResponse(response)).thenReturn(answersEvaluation);

    List<String> currentItemsOrder = Lists.newArrayList("correctItem1", "wrongItem", "correctItem2");
    when(responseOrderController.getCurrentItemsOrderByAnswers()).thenReturn(currentItemsOrder);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:ItemsMarkingControllerJUnitTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BaseRepository类代码示例发布时间:2022-05-23
下一篇:
Java Localizable类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap