1 /* Copyright (c) 2009 Peter Troshin
\r
3 * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0
\r
5 * This library is free software; you can redistribute it and/or modify it under the terms of the
\r
6 * Apache License version 2 as published by the Apache Software Foundation
\r
8 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
\r
9 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache
\r
10 * License for more details.
\r
12 * A copy of the license is in apache_license.txt. It is also available here:
\r
13 * @see: http://www.apache.org/licenses/LICENSE-2.0.txt
\r
15 * Any republication or derived work distributed in source code form
\r
16 * must include this copyright and license notice.
\r
19 package compbio.engine.cluster.drmaa;
\r
21 import static org.testng.AssertJUnit.assertEquals;
\r
22 import static org.testng.AssertJUnit.assertNotNull;
\r
23 import static org.testng.AssertJUnit.fail;
\r
25 import java.text.ParseException;
\r
27 import org.testng.annotations.Test;
\r
29 import compbio.engine.cluster.drmaa.ClusterUtil;
\r
31 public class UtilTester {
\r
34 public void testParser() {
\r
36 Number n = ClusterUtil.CLUSTER_STAT_IN_SEC.parse("11.0000");
\r
38 int t = n.intValue();
\r
39 assertEquals(11, t);
\r
40 n = ClusterUtil.CLUSTER_STAT_IN_SEC.parse("11.2300");
\r
43 assertEquals(11, t);
\r
44 float f = n.floatValue();
\r
45 assertEquals(11.23f, f);
\r
46 n = ClusterUtil.CLUSTER_STAT_IN_SEC.parse("0.0310");
\r
49 assertEquals(0.031f, f);
\r
50 } catch (ParseException e) {
\r
51 e.printStackTrace();
\r
52 fail("Parsing failed: " + e.getMessage());
\r