Пример #1
0
 @Test(expected = TranslatorException.class)
 public void shouldNotTranslateEmptyOrderforStructure() throws Exception {
   Structure struct = getStructure();
   struct.setOrder(null);
   Set<ScorisQig> scorisQigs = getScorisQigs(struct);
   translator.translate(scorisQigs);
 }
Пример #2
0
 @Test(expected = TranslatorException.class)
 public void shouldNotTranslateEmptyIDforParentStructure() throws Exception {
   Structure struct1 = getStructure();
   Structure struct = getStructure();
   struct.setId(null);
   struct.setParentStructure(struct1);
   Set<ScorisQig> scorisQigs = getScorisQigs(struct, struct1);
   translator.translate(scorisQigs);
 }
Пример #3
0
 @Test
 public void shouldTranslateParentMarkingClusterWithoutQuestions() throws Exception {
   Structure struct = getStructure();
   Structure struct1 = getStructure();
   struct1.setId(2l);
   struct1.setParentStructure(struct);
   Set<ScorisQig> scorisQigs = getScorisQigs(struct, struct1);
   ArrayOfMarkingCluster arrayOfMarkingCluster = translator.translate(scorisQigs);
   List<MarkingCluster> clusters = arrayOfMarkingCluster.getMarkingCluster();
   assertEquals(new Integer(2), new Integer(clusters.size()));
   for (MarkingCluster cluster : clusters) {
     assertEquals("Name", cluster.getName());
   }
 }
Пример #4
0
 private Structure getStructure() {
   Structure struct = new Structure();
   struct.setId(1l);
   struct.setMandatoryQuestions(5);
   struct.setName("Name");
   struct.setMandatoryQuestions(5);
   struct.setOrder(1);
   struct.setParentStructure(null);
   return struct;
 }
Пример #5
0
 @Test
 public void shouldTranslateMultipleParentMarkingClusterWithoutQuestions() throws Exception {
   Structure struct = getStructure();
   struct.setName("Name1");
   Structure struct2 = getStructure();
   struct2.setId(3l);
   struct2.setName("Name3");
   struct2.setOrder(3);
   struct.setParentStructure(struct2);
   Structure struct1 = getStructure();
   struct1.setId(2l);
   struct1.setName("Name2");
   struct1.setOrder(2);
   struct1.setParentStructure(struct);
   Set<ScorisQig> scorisQigs = getScorisQigs(struct, struct1, struct2);
   ArrayOfMarkingCluster arrayOfMarkingCluster = translator.translate(scorisQigs);
   List<MarkingCluster> clusters = arrayOfMarkingCluster.getMarkingCluster();
   assertEquals(new Integer(3), new Integer(clusters.size()));
   int sequence = 1;
   for (MarkingCluster cluster : clusters) {
     assertEquals("Name" + sequence, cluster.getName());
     assertEquals(sequence++, cluster.getSequence());
   }
 }