Author: chatellier Date: 2009-02-03 16:38:30 +0000 (Tue, 03 Feb 2009) New Revision: 1780 Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java Log: Ajout d'un catch sur HeadlessException dans le cas ou les test ne passent pas s'il n'y a pas de X11 Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java 2009-02-03 16:14:50 UTC (rev 1779) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java 2009-02-03 16:38:30 UTC (rev 1780) @@ -17,46 +17,47 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -/* * - * PopulationSeasonInfoTest.java - * - * Created: 29 juin 2006 20:19:32 - * - * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ + package fr.ifremer.isisfish.entity; import static org.codelutin.i18n.I18n._; +import java.awt.HeadlessException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.awt.event.WindowEvent; import javax.swing.Box; +import javax.swing.JDialog; import javax.swing.JOptionPane; -import javax.swing.JDialog; import javax.swing.SwingUtilities; -import junit.framework.TestCase; - +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.codelutin.math.matrix.MatrixFactory; import org.codelutin.math.matrix.MatrixIterator; import org.codelutin.math.matrix.MatrixND; import org.codelutin.math.matrix.gui.MatrixPanelEditor; +import org.junit.Test; - /** + * PopulationSeasonInfoTest. + * + * Created: 29 juin 2006 20:19:32 + * * @author poussin + * @version $Revision$ * + * Last update: $Date$ + * by : $Author$ */ - -public class PopulationSeasonInfoTest extends TestCase { +public class PopulationSeasonInfoTest{ + + /** Logger for this class */ + private static final Log log = LogFactory.getLog(PopulationSeasonInfoTest.class); + + @Test public void testToString() { String [] s = new String[]{"toto", "titi", "tutu"}; System.out.println(Arrays.toString(s)); @@ -65,6 +66,7 @@ /* * Test method for 'fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl.getGroupChangeMatrix(Month)' */ + @Test public void testGetGroupChangeMatrix() throws InterruptedException { System.out.println("begin"); int nbrAge = 3; @@ -105,8 +107,13 @@ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - JOptionPane.showMessageDialog(dialog, panel,_("Spacialized visualisation"), JOptionPane.INFORMATION_MESSAGE); - + try { + JOptionPane.showMessageDialog(dialog, panel,_("Spacialized visualisation"), JOptionPane.INFORMATION_MESSAGE); + } catch (HeadlessException he) { + if(log.isErrorEnabled()) { + log.error("No X11 display available", he); + } + } } }); Thread t = new Thread(new Runnable() { @@ -133,6 +140,7 @@ /** * Converte no spacialized matrix to spacialized matrix */ + @Test public void testSpacializeLengthChangeMatrix() throws InterruptedException { @@ -176,7 +184,13 @@ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - JOptionPane.showMessageDialog(dialog, box, _("Spacialized visualisation"), JOptionPane.INFORMATION_MESSAGE); + try { + JOptionPane.showMessageDialog(dialog, box, _("Spacialized visualisation"), JOptionPane.INFORMATION_MESSAGE); + } catch (HeadlessException he) { + if(log.isErrorEnabled()) { + log.error("No X11 display available", he); + } + } } });