@Test public void shouldCreateSentimentComposition() { SentimentComposition sentimentComposition = sentimentEvent.createSentimentComposition(queueState); sentimentComposition.setCompositionId("TEST_" + new Date()); List<SentimentSection> sentimentSections = sentimentComposition.getSentimentSections().getSentimentSectionList(); for (int i = 0; i < sentimentSections.size(); i++) { Map<String, List<String>> sentimentLabels = sentimentSections.get(i).getSentimentLabels(); switch (i) { case 0: assertThat(sentimentLabels.get("11")).hasSize(1); break; case 1: assertThat(sentimentLabels.get("31")).hasSize(1); assertThat(sentimentLabels.get("32")).hasSize(2); assertThat(sentimentLabels.get("33")).hasSize(3); break; default: fail("THERE SHOULD ONLY BE TWO SENTIMENT MAPS FOR THIS TEST!"); } } }
public SentimentComposition createSentimentComposition(QueueState queueState){ SentimentSections sentimentSections = new SentimentSections(); for (ProgressionUnit progressionUnit : queueState.getStructure()) { for(int i=0; i<progressionUnit.getProgressionUnitBars().size(); i++){ if(i % 2 == 0) { ProgressionUnitBar progressionUnitBar = progressionUnit.getProgressionUnitBars().get(i); SentimentSection sentimentSection = new SentimentSection(); sentimentSection.setSentimentLabels(progressionUnitBar.getSentimentLabels()); sentimentSections.addSentimentSection(sentimentSection); } } } SentimentComposition sentimentComposition = new SentimentComposition(); sentimentComposition.setCompositionId(queueState.getQueueItem().getQueueItemId()); sentimentComposition.setSentimentJson(sentimentSections); return sentimentComposition; }
SentimentEvent { public SentimentComposition createSentimentComposition(QueueState queueState){ SentimentSections sentimentSections = new SentimentSections(); for (ProgressionUnit progressionUnit : queueState.getStructure()) { for(int i=0; i<progressionUnit.getProgressionUnitBars().size(); i++){ if(i % 2 == 0) { ProgressionUnitBar progressionUnitBar = progressionUnit.getProgressionUnitBars().get(i); SentimentSection sentimentSection = new SentimentSection(); sentimentSection.setSentimentLabels(progressionUnitBar.getSentimentLabels()); sentimentSections.addSentimentSection(sentimentSection); } } } SentimentComposition sentimentComposition = new SentimentComposition(); sentimentComposition.setCompositionId(queueState.getQueueItem().getQueueItemId()); sentimentComposition.setSentimentJson(sentimentSections); return sentimentComposition; } }
SentimentEvent { public SentimentComposition createSentimentComposition(QueueState queueState){ SentimentSections sentimentSections = new SentimentSections(); for (ProgressionUnit progressionUnit : queueState.getStructure()) { for(int i=0; i<progressionUnit.getProgressionUnitBars().size(); i++){ if(i % 2 == 0) { ProgressionUnitBar progressionUnitBar = progressionUnit.getProgressionUnitBars().get(i); SentimentSection sentimentSection = new SentimentSection(); sentimentSection.setSentimentLabels(progressionUnitBar.getSentimentLabels()); sentimentSections.addSentimentSection(sentimentSection); } } } SentimentComposition sentimentComposition = new SentimentComposition(); sentimentComposition.setCompositionId(queueState.getQueueItem().getQueueItemId()); sentimentComposition.setSentimentJson(sentimentSections); return sentimentComposition; } @Autowired  SentimentEvent(ISentimentCompositionDal sentimentCompositionDal); }
SentimentEvent { public SentimentComposition createSentimentComposition(QueueState queueState){ SentimentSections sentimentSections = new SentimentSections(); for (ProgressionUnit progressionUnit : queueState.getStructure()) { for(int i=0; i<progressionUnit.getProgressionUnitBars().size(); i++){ if(i % 2 == 0) { ProgressionUnitBar progressionUnitBar = progressionUnit.getProgressionUnitBars().get(i); SentimentSection sentimentSection = new SentimentSection(); sentimentSection.setSentimentLabels(progressionUnitBar.getSentimentLabels()); sentimentSections.addSentimentSection(sentimentSection); } } } SentimentComposition sentimentComposition = new SentimentComposition(); sentimentComposition.setCompositionId(queueState.getQueueItem().getQueueItemId()); sentimentComposition.setSentimentJson(sentimentSections); return sentimentComposition; } @Autowired  SentimentEvent(ISentimentCompositionDal sentimentCompositionDal); void saveSenimentLabels(QueueState queueState); SentimentComposition createSentimentComposition(QueueState queueState); }
SentimentEvent { public SentimentComposition createSentimentComposition(QueueState queueState){ SentimentSections sentimentSections = new SentimentSections(); for (ProgressionUnit progressionUnit : queueState.getStructure()) { for(int i=0; i<progressionUnit.getProgressionUnitBars().size(); i++){ if(i % 2 == 0) { ProgressionUnitBar progressionUnitBar = progressionUnit.getProgressionUnitBars().get(i); SentimentSection sentimentSection = new SentimentSection(); sentimentSection.setSentimentLabels(progressionUnitBar.getSentimentLabels()); sentimentSections.addSentimentSection(sentimentSection); } } } SentimentComposition sentimentComposition = new SentimentComposition(); sentimentComposition.setCompositionId(queueState.getQueueItem().getQueueItemId()); sentimentComposition.setSentimentJson(sentimentSections); return sentimentComposition; } @Autowired  SentimentEvent(ISentimentCompositionDal sentimentCompositionDal); void saveSenimentLabels(QueueState queueState); SentimentComposition createSentimentComposition(QueueState queueState);  }