1 | /* |
2 | * jDTAUS Core Test Suite |
3 | * Copyright (C) 2005 Christian Schulte |
4 | * <cs@schulte.it> |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2.1 of the License, or any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Lesser General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Lesser General Public |
17 | * License along with this library; if not, write to the Free Software |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
19 | * |
20 | */ |
21 | package org.jdtaus.core.lang.it; |
22 | |
23 | import junit.framework.Assert; |
24 | import junit.framework.TestCase; |
25 | import org.jdtaus.core.lang.Runtime; |
26 | |
27 | /** |
28 | * Testcase for {@code Runtime} implementations. |
29 | * |
30 | * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> |
31 | * @version $JDTAUS: RuntimeTest.java 8692 2012-10-01 14:16:57Z schulte $ |
32 | */ |
33 | public class RuntimeTest extends TestCase |
34 | { |
35 | //--RuntimeTest------------------------------------------------------------- |
36 | |
37 | /** Implementation to test. */ |
38 | private Runtime runtime; |
39 | |
40 | /** |
41 | * Gets the {@code Runtime} implementation tests are performed with. |
42 | * |
43 | * @return the {@code Runtime} implementation tests are performed with. |
44 | */ |
45 | public Runtime getRuntime() |
46 | { |
47 | return this.runtime; |
48 | } |
49 | |
50 | /** |
51 | * Sets the {@code Runtime} implementation tests are performed with. |
52 | * |
53 | * @param value the {@code Runtime} implementation to perform tests with. |
54 | */ |
55 | public final void setRuntime( final Runtime value ) |
56 | { |
57 | this.runtime = value; |
58 | } |
59 | |
60 | //-------------------------------------------------------------RuntimeTest-- |
61 | //--Tests------------------------------------------------------------------- |
62 | |
63 | /** |
64 | * Tests the {@link Runtime#getAllocatedPercent()} method to return sane |
65 | * values. |
66 | */ |
67 | public void testGetAllocatedPercent() throws Exception |
68 | { |
69 | assert this.getRuntime() != null; |
70 | |
71 | final long allocatedPercent = this.getRuntime().getAllocatedPercent(); |
72 | Assert.assertTrue( allocatedPercent >= 0 && allocatedPercent <= 100 ); |
73 | } |
74 | |
75 | //-------------------------------------------------------------------Tests-- |
76 | } |