|
From: <de...@us...> - 2012-10-15 09:39:47
|
Revision: 7742
http://fudaa.svn.sourceforge.net/fudaa/?rev=7742&view=rev
Author: deniger
Date: 2012-10-15 09:39:38 +0000 (Mon, 15 Oct 2012)
Log Message:
-----------
Ajout test unitaire pour CRUE-317
Issue #CRUE-317 - [v0.61SNAPSHOT] Les objets inactifs ne sont plus visualis?\195?\169s correctement
Added Paths:
-----------
trunk/soft/fudaa-crue/crue-server/src/test/java/org/fudaa/dodico/crue/metier/emh/CatEMHConteneurHelperTest.java
Added: trunk/soft/fudaa-crue/crue-server/src/test/java/org/fudaa/dodico/crue/metier/emh/CatEMHConteneurHelperTest.java
===================================================================
--- trunk/soft/fudaa-crue/crue-server/src/test/java/org/fudaa/dodico/crue/metier/emh/CatEMHConteneurHelperTest.java (rev 0)
+++ trunk/soft/fudaa-crue/crue-server/src/test/java/org/fudaa/dodico/crue/metier/emh/CatEMHConteneurHelperTest.java 2012-10-15 09:39:38 UTC (rev 7742)
@@ -0,0 +1,56 @@
+/*
+ GPL 2
+ */
+package org.fudaa.dodico.crue.metier.emh;
+
+import java.util.Arrays;
+import java.util.List;
+import org.fudaa.dodico.crue.metier.factory.EMHRelationFactory;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public class CatEMHConteneurHelperTest {
+
+ public CatEMHConteneurHelperTest() {
+ }
+
+ @Test
+ public void testGetSections() {
+ EMHSousModele sousModele = new EMHSousModele();
+ EMHSectionProfil sectionZ = new EMHSectionProfil("Z");
+ EMHSectionProfil sectionY = new EMHSectionProfil("Y");
+
+ EMHSectionProfil sectionA = new EMHSectionProfil("A");
+ EMHSectionProfil sectionB = new EMHSectionProfil("B");
+ CatEMHBranche br = new EMHBrancheSaintVenant("Br");
+ RelationEMHSectionDansBranche relationA = createRelationBranche(0, EnumPosSection.AMONT);
+ relationA.setEmh(sectionA);
+ RelationEMHSectionDansBranche relationB = createRelationBranche(10, EnumPosSection.AVAL);
+ relationB.setEmh(sectionB);
+ br.addListeSections(Arrays.asList(relationA, relationB));
+ //les relations inverses:
+ sectionA.addRelationEMH(new RelationEMHBrancheContientSection(br));
+ sectionB.addRelationEMH(new RelationEMHBrancheContientSection(br));
+
+ EMHRelationFactory.addRelationsContientEMH(sousModele, Arrays.asList(sectionZ, sectionY));
+ EMHRelationFactory.addRelationsContientEMH(sousModele, Arrays.asList(sectionB, sectionA, br));
+ List<CatEMHSection> sections = CatEMHConteneurHelper.getSections(sousModele);
+ assertEquals(4, sections.size());
+ assertEquals("A", sections.get(0).getId());
+ assertEquals("B", sections.get(1).getId());
+ assertEquals("Y", sections.get(2).getId());
+ assertEquals("Z", sections.get(3).getId());
+ }
+
+ private RelationEMHSectionDansBranche createRelationBranche(final double xp, final EnumPosSection position) {
+ final RelationEMHSectionDansBranche res = new RelationEMHSectionDansBranche();
+ res.setXp(xp);
+ res.setPos(position);
+ return res;
+
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|