View Javadoc
1   /*
2    * Copyright (C) 2023 Dipl.-Inform. Kai Hofmann. All rights reserved!
3    */
4   package de.powerstat.validation.values.test;
5   
6   
7   import static org.junit.jupiter.api.Assertions.assertAll;
8   import static org.junit.jupiter.api.Assertions.assertEquals;
9   import static org.junit.jupiter.api.Assertions.assertFalse;
10  import static org.junit.jupiter.api.Assertions.assertThrows;
11  import static org.junit.jupiter.api.Assertions.assertTrue;
12  
13  import java.util.NoSuchElementException;
14  
15  import org.junit.jupiter.api.Test;
16  
17  import de.powerstat.validation.values.SIPrefixes;
18  
19  
20  /**
21   * SI prefixes tests.
22   */
23  final class SIPrefixesTests
24   {
25    /**
26     * Default constructor.
27     */
28    /* default */ SIPrefixesTests()
29     {
30      super();
31     }
32  
33  
34    /**
35     * Test getBase of SIPrefixes.
36     */
37    @Test
38    /* default */ void testGetBase()
39     {
40      assertAll("constructor", //$NON-NLS-1$
41        () -> assertEquals(-30, SIPrefixes.QUECTO.getBase(), "QUECTO base not as expected"), //$NON-NLS-1$
42        () -> assertEquals(-27, SIPrefixes.RONTO.getBase(), "RONTO base not as expected"), //$NON-NLS-1$
43        () -> assertEquals(-24, SIPrefixes.YOCTO.getBase(), "YOCTO base not as expected"), //$NON-NLS-1$
44        () -> assertEquals(-21, SIPrefixes.ZEPTO.getBase(), "ZEPTO base not as expected"), //$NON-NLS-1$
45        () -> assertEquals(-18, SIPrefixes.ATTO.getBase(), "ATTO base not as expected"), //$NON-NLS-1$
46        () -> assertEquals(-15, SIPrefixes.FEMTO.getBase(), "FEMTO base not as expected"), //$NON-NLS-1$
47        () -> assertEquals(-12, SIPrefixes.PICO.getBase(), "PICO base not as expected"), //$NON-NLS-1$
48        () -> assertEquals(-9, SIPrefixes.NANO.getBase(), "NANO base not as expected"), //$NON-NLS-1$
49        () -> assertEquals(-6, SIPrefixes.MICRO.getBase(), "MICRO base not as expected"), //$NON-NLS-1$
50        () -> assertEquals(-3, SIPrefixes.MILLI.getBase(), "MILLI base not as expected"), //$NON-NLS-1$
51        () -> assertEquals(-2, SIPrefixes.CENTI.getBase(), "CENTI base not as expected"), //$NON-NLS-1$
52        () -> assertEquals(-1, SIPrefixes.DECI.getBase(), "DECI base not as expected"), //$NON-NLS-1$
53        () -> assertEquals(0, SIPrefixes.ZERO.getBase(), "ZERO base not as expected"), //$NON-NLS-1$
54        () -> assertEquals(1, SIPrefixes.DECA.getBase(), "DECA base not as expected"), //$NON-NLS-1$
55        () -> assertEquals(2, SIPrefixes.HECTO.getBase(), "HECTO base not as expected"), //$NON-NLS-1$
56        () -> assertEquals(3, SIPrefixes.KILO.getBase(), "KILO base not as expected"), //$NON-NLS-1$
57        () -> assertEquals(6, SIPrefixes.MEGA.getBase(), "MEGA base not as expected"), //$NON-NLS-1$
58        () -> assertEquals(9, SIPrefixes.GIGA.getBase(), "GIGA base not as expected"), //$NON-NLS-1$
59        () -> assertEquals(12, SIPrefixes.TERA.getBase(), "TERA base not as expected"), //$NON-NLS-1$
60        () -> assertEquals(15, SIPrefixes.PETA.getBase(), "PETA base not as expected"), //$NON-NLS-1$
61        () -> assertEquals(18, SIPrefixes.EXA.getBase(), "EXA base not as expected"), //$NON-NLS-1$
62        () -> assertEquals(21, SIPrefixes.ZETTA.getBase(), "ZETTA base not as expected"), //$NON-NLS-1$
63        () -> assertEquals(24, SIPrefixes.YOTTA.getBase(), "YOTTA base not as expected"), //$NON-NLS-1$
64        () -> assertEquals(27, SIPrefixes.RONNA.getBase(), "RONNA base not as expected"), //$NON-NLS-1$
65        () -> assertEquals(30, SIPrefixes.QUETTA.getBase(), "QUETTA base not as expected") //$NON-NLS-1$
66      );
67     }
68  
69  
70    /**
71     * Test hasNext of SIPrefixes.
72     */
73    @Test
74    /* default */ void testHasNext()
75     {
76      assertAll("hasNext", //$NON-NLS-1$
77        () -> assertTrue(SIPrefixes.QUECTO.hasNext(), "QUECTO hasNext not as expected"), //$NON-NLS-1$
78        () -> assertTrue(SIPrefixes.RONTO.hasNext(), "RONTO hasNext not as expected"), //$NON-NLS-1$
79        () -> assertTrue(SIPrefixes.YOCTO.hasNext(), "YOCTO hasNext not as expected"), //$NON-NLS-1$
80        () -> assertTrue(SIPrefixes.ZEPTO.hasNext(), "ZEPTO hasNext not as expected"), //$NON-NLS-1$
81        () -> assertTrue(SIPrefixes.ATTO.hasNext(), "ATTO hasNext not as expected"), //$NON-NLS-1$
82        () -> assertTrue(SIPrefixes.FEMTO.hasNext(), "FEMTO hasNext not as expected"), //$NON-NLS-1$
83        () -> assertTrue(SIPrefixes.PICO.hasNext(), "PICO hasNext not as expected"), //$NON-NLS-1$
84        () -> assertTrue(SIPrefixes.NANO.hasNext(), "NANO hasNext not as expected"), //$NON-NLS-1$
85        () -> assertTrue(SIPrefixes.MICRO.hasNext(), "MICRO hasNext not as expected"), //$NON-NLS-1$
86        () -> assertTrue(SIPrefixes.MILLI.hasNext(), "MILLI hasNext not as expected"), //$NON-NLS-1$
87        () -> assertTrue(SIPrefixes.CENTI.hasNext(), "CENTI hasNext not as expected"), //$NON-NLS-1$
88        () -> assertTrue(SIPrefixes.DECI.hasNext(), "DECI hasNext not as expected"), //$NON-NLS-1$
89        () -> assertTrue(SIPrefixes.ZERO.hasNext(), "ZERO hasNext not as expected"), //$NON-NLS-1$
90        () -> assertTrue(SIPrefixes.DECA.hasNext(), "DECA hasNext not as expected"), //$NON-NLS-1$
91        () -> assertTrue(SIPrefixes.HECTO.hasNext(), "HECTO hasNext not as expected"), //$NON-NLS-1$
92        () -> assertTrue(SIPrefixes.KILO.hasNext(), "KILO hasNext not as expected"), //$NON-NLS-1$
93        () -> assertTrue(SIPrefixes.MEGA.hasNext(), "MEGA hasNext not as expected"), //$NON-NLS-1$
94        () -> assertTrue(SIPrefixes.GIGA.hasNext(), "GIGA hasNext not as expected"), //$NON-NLS-1$
95        () -> assertTrue(SIPrefixes.TERA.hasNext(), "TERA hasNext not as expected"), //$NON-NLS-1$
96        () -> assertTrue(SIPrefixes.PETA.hasNext(), "PETA hasNext not as expected"), //$NON-NLS-1$
97        () -> assertTrue(SIPrefixes.EXA.hasNext(), "EXA hasNext not as expected"), //$NON-NLS-1$
98        () -> assertTrue(SIPrefixes.ZETTA.hasNext(), "ZETTA hasNext not as expected"), //$NON-NLS-1$
99        () -> assertTrue(SIPrefixes.YOTTA.hasNext(), "YOTTA hasNext not as expected"), //$NON-NLS-1$
100       () -> assertTrue(SIPrefixes.RONNA.hasNext(), "RONNA hasNext not as expected"), //$NON-NLS-1$
101       () -> assertFalse(SIPrefixes.QUETTA.hasNext(), "QUETTA hasNext not as expected") //$NON-NLS-1$
102     );
103    }
104 
105 
106   /**
107    * Test hasPrevious of SIPrefixes.
108    */
109   @Test
110   /* default */ void testHasPrevious()
111    {
112     assertAll("hasPrevious", //$NON-NLS-1$
113       () -> assertFalse(SIPrefixes.QUECTO.hasPrevious(), "QUECTO hasPrevious not as expected"), //$NON-NLS-1$
114       () -> assertTrue(SIPrefixes.RONTO.hasPrevious(), "RONTO hasPrevious not as expected"), //$NON-NLS-1$
115       () -> assertTrue(SIPrefixes.YOCTO.hasPrevious(), "YOCTO hasPrevious not as expected"), //$NON-NLS-1$
116       () -> assertTrue(SIPrefixes.ZEPTO.hasPrevious(), "ZEPTO hasPrevious not as expected"), //$NON-NLS-1$
117       () -> assertTrue(SIPrefixes.ATTO.hasPrevious(), "ATTO hasPrevious not as expected"), //$NON-NLS-1$
118       () -> assertTrue(SIPrefixes.FEMTO.hasPrevious(), "FEMTO hasPrevious not as expected"), //$NON-NLS-1$
119       () -> assertTrue(SIPrefixes.PICO.hasPrevious(), "PICO hasPrevious not as expected"), //$NON-NLS-1$
120       () -> assertTrue(SIPrefixes.NANO.hasPrevious(), "NANO hasPrevious not as expected"), //$NON-NLS-1$
121       () -> assertTrue(SIPrefixes.MICRO.hasPrevious(), "MICRO hasPrevious not as expected"), //$NON-NLS-1$
122       () -> assertTrue(SIPrefixes.MILLI.hasPrevious(), "MILLI hasPrevious not as expected"), //$NON-NLS-1$
123       () -> assertTrue(SIPrefixes.CENTI.hasPrevious(), "CENTI hasPrevious not as expected"), //$NON-NLS-1$
124       () -> assertTrue(SIPrefixes.DECI.hasPrevious(), "DECI hasPrevious not as expected"), //$NON-NLS-1$
125       () -> assertTrue(SIPrefixes.ZERO.hasPrevious(), "ZERO hasPrevious not as expected"), //$NON-NLS-1$
126       () -> assertTrue(SIPrefixes.DECA.hasPrevious(), "DECA hasPrevious not as expected"), //$NON-NLS-1$
127       () -> assertTrue(SIPrefixes.HECTO.hasPrevious(), "HECTO hasPrevious not as expected"), //$NON-NLS-1$
128       () -> assertTrue(SIPrefixes.KILO.hasPrevious(), "KILO hasPrevious not as expected"), //$NON-NLS-1$
129       () -> assertTrue(SIPrefixes.MEGA.hasPrevious(), "MEGA hasPrevious not as expected"), //$NON-NLS-1$
130       () -> assertTrue(SIPrefixes.GIGA.hasPrevious(), "GIGA hasPrevious not as expected"), //$NON-NLS-1$
131       () -> assertTrue(SIPrefixes.TERA.hasPrevious(), "TERA hasPrevious not as expected"), //$NON-NLS-1$
132       () -> assertTrue(SIPrefixes.PETA.hasPrevious(), "PETA hasPrevious not as expected"), //$NON-NLS-1$
133       () -> assertTrue(SIPrefixes.EXA.hasPrevious(), "EXA hasPrevious not as expected"), //$NON-NLS-1$
134       () -> assertTrue(SIPrefixes.ZETTA.hasPrevious(), "ZETTA hasPrevious not as expected"), //$NON-NLS-1$
135       () -> assertTrue(SIPrefixes.YOTTA.hasPrevious(), "YOTTA hasPrevious not as expected"), //$NON-NLS-1$
136       () -> assertTrue(SIPrefixes.RONNA.hasPrevious(), "RONNA hasPrevious not as expected"), //$NON-NLS-1$
137       () -> assertTrue(SIPrefixes.QUETTA.hasPrevious(), "QUETTA hasPrevious not as expected") //$NON-NLS-1$
138     );
139    }
140 
141 
142   /**
143    * Test next overrun.
144    */
145   @Test
146   /* default */ void testNextOverrun()
147    {
148     assertThrows(NoSuchElementException.class, () ->
149      {
150       SIPrefixes.QUETTA.next();
151      }, "No such element exception expected" //$NON-NLS-1$
152     );
153    }
154 
155 
156   /**
157    * Test previous underrun.
158    */
159   @Test
160   /* default */ void testPreviousUnderrun()
161    {
162     assertThrows(NoSuchElementException.class, () ->
163      {
164       SIPrefixes.QUECTO.previous();
165      }, "No such element exception expected" //$NON-NLS-1$
166     );
167    }
168 
169 
170   /**
171    * Test next of SIPrefixes.
172    */
173   @Test
174   /* default */ void testNext()
175    {
176     assertAll("next", //$NON-NLS-1$
177       () -> assertEquals(SIPrefixes.RONTO, SIPrefixes.QUECTO.next(), "QUECTO next not as expected"), //$NON-NLS-1$
178       () -> assertEquals(SIPrefixes.YOCTO, SIPrefixes.RONTO.next(), "RONTO next not as expected"), //$NON-NLS-1$
179       () -> assertEquals(SIPrefixes.ZEPTO, SIPrefixes.YOCTO.next(), "YOCTO next not as expected"), //$NON-NLS-1$
180       () -> assertEquals(SIPrefixes.ATTO, SIPrefixes.ZEPTO.next(), "ZEPTO next not as expected"), //$NON-NLS-1$
181       () -> assertEquals(SIPrefixes.FEMTO, SIPrefixes.ATTO.next(), "ATTO next not as expected"), //$NON-NLS-1$
182       () -> assertEquals(SIPrefixes.PICO, SIPrefixes.FEMTO.next(), "FEMTO next not as expected"), //$NON-NLS-1$
183       () -> assertEquals(SIPrefixes.NANO, SIPrefixes.PICO.next(), "PICO next not as expected"), //$NON-NLS-1$
184       () -> assertEquals(SIPrefixes.MICRO, SIPrefixes.NANO.next(), "NANO next not as expected"), //$NON-NLS-1$
185       () -> assertEquals(SIPrefixes.MILLI, SIPrefixes.MICRO.next(), "MICRO next not as expected"), //$NON-NLS-1$
186       () -> assertEquals(SIPrefixes.CENTI, SIPrefixes.MILLI.next(), "MILLI next not as expected"), //$NON-NLS-1$
187       () -> assertEquals(SIPrefixes.DECI, SIPrefixes.CENTI.next(), "CENTI next not as expected"), //$NON-NLS-1$
188       () -> assertEquals(SIPrefixes.ZERO, SIPrefixes.DECI.next(), "DECI next not as expected"), //$NON-NLS-1$
189       () -> assertEquals(SIPrefixes.DECA, SIPrefixes.ZERO.next(), "ZERO next not as expected"), //$NON-NLS-1$
190       () -> assertEquals(SIPrefixes.HECTO, SIPrefixes.DECA.next(), "DECA next not as expected"), //$NON-NLS-1$
191       () -> assertEquals(SIPrefixes.KILO, SIPrefixes.HECTO.next(), "HECTO next not as expected"), //$NON-NLS-1$
192       () -> assertEquals(SIPrefixes.MEGA, SIPrefixes.KILO.next(), "KILO next not as expected"), //$NON-NLS-1$
193       () -> assertEquals(SIPrefixes.GIGA, SIPrefixes.MEGA.next(), "MEGA next not as expected"), //$NON-NLS-1$
194       () -> assertEquals(SIPrefixes.TERA, SIPrefixes.GIGA.next(), "GIGA next not as expected"), //$NON-NLS-1$
195       () -> assertEquals(SIPrefixes.PETA, SIPrefixes.TERA.next(), "TERA next not as expected"), //$NON-NLS-1$
196       () -> assertEquals(SIPrefixes.EXA, SIPrefixes.PETA.next(), "PETA next not as expected"), //$NON-NLS-1$
197       () -> assertEquals(SIPrefixes.ZETTA, SIPrefixes.EXA.next(), "EXA next not as expected"), //$NON-NLS-1$
198       () -> assertEquals(SIPrefixes.YOTTA, SIPrefixes.ZETTA.next(), "ZETTA next not as expected"), //$NON-NLS-1$
199       () -> assertEquals(SIPrefixes.RONNA, SIPrefixes.YOTTA.next(), "YOTTA next not as expected"), //$NON-NLS-1$
200       () -> assertEquals(SIPrefixes.QUETTA, SIPrefixes.RONNA.next(), "RONNA next not as expected") //$NON-NLS-1$
201     );
202    }
203 
204 
205   /**
206    * Test previous of SIPrefixes.
207    */
208   @Test
209   /* default */ void testPrevious()
210    {
211     assertAll("previous", //$NON-NLS-1$
212       () -> assertEquals(SIPrefixes.QUECTO, SIPrefixes.RONTO.previous(), "RONTO previous not as expected"), //$NON-NLS-1$
213       () -> assertEquals(SIPrefixes.RONTO, SIPrefixes.YOCTO.previous(), "YOCTO previous not as expected"), //$NON-NLS-1$
214       () -> assertEquals(SIPrefixes.YOCTO, SIPrefixes.ZEPTO.previous(), "ZEPTO previous not as expected"), //$NON-NLS-1$
215       () -> assertEquals(SIPrefixes.ZEPTO, SIPrefixes.ATTO.previous(), "ATTO previous not as expected"), //$NON-NLS-1$
216       () -> assertEquals(SIPrefixes.ATTO, SIPrefixes.FEMTO.previous(), "FEMTO previous not as expected"), //$NON-NLS-1$
217       () -> assertEquals(SIPrefixes.FEMTO, SIPrefixes.PICO.previous(), "PICO previous not as expected"), //$NON-NLS-1$
218       () -> assertEquals(SIPrefixes.PICO, SIPrefixes.NANO.previous(), "NANO previous not as expected"), //$NON-NLS-1$
219       () -> assertEquals(SIPrefixes.NANO, SIPrefixes.MICRO.previous(), "MICRO previous not as expected"), //$NON-NLS-1$
220       () -> assertEquals(SIPrefixes.MICRO, SIPrefixes.MILLI.previous(), "MILLI previous not as expected"), //$NON-NLS-1$
221       () -> assertEquals(SIPrefixes.MILLI, SIPrefixes.CENTI.previous(), "CENTI previous not as expected"), //$NON-NLS-1$
222       () -> assertEquals(SIPrefixes.CENTI, SIPrefixes.DECI.previous(), "DECI previous not as expected"), //$NON-NLS-1$
223       () -> assertEquals(SIPrefixes.DECI, SIPrefixes.ZERO.previous(), "ZERO previous not as expected"), //$NON-NLS-1$
224       () -> assertEquals(SIPrefixes.ZERO, SIPrefixes.DECA.previous(), "DECA previous not as expected"), //$NON-NLS-1$
225       () -> assertEquals(SIPrefixes.DECA, SIPrefixes.HECTO.previous(), "HECTO previous not as expected"), //$NON-NLS-1$
226       () -> assertEquals(SIPrefixes.HECTO, SIPrefixes.KILO.previous(), "KILO previous not as expected"), //$NON-NLS-1$
227       () -> assertEquals(SIPrefixes.KILO, SIPrefixes.MEGA.previous(), "MEGA previous not as expected"), //$NON-NLS-1$
228       () -> assertEquals(SIPrefixes.MEGA, SIPrefixes.GIGA.previous(), "GIGA previous not as expected"), //$NON-NLS-1$
229       () -> assertEquals(SIPrefixes.GIGA, SIPrefixes.TERA.previous(), "TERA previous not as expected"), //$NON-NLS-1$
230       () -> assertEquals(SIPrefixes.TERA, SIPrefixes.PETA.previous(), "PETA previous not as expected"), //$NON-NLS-1$
231       () -> assertEquals(SIPrefixes.PETA, SIPrefixes.EXA.previous(), "EXA previous not as expected"), //$NON-NLS-1$
232       () -> assertEquals(SIPrefixes.EXA, SIPrefixes.ZETTA.previous(), "ZETTA previous not as expected"), //$NON-NLS-1$
233       () -> assertEquals(SIPrefixes.ZETTA, SIPrefixes.YOTTA.previous(), "YOTTA previous not as expected"), //$NON-NLS-1$
234       () -> assertEquals(SIPrefixes.YOTTA, SIPrefixes.RONNA.previous(), "RONNA previous not as expected"), //$NON-NLS-1$
235       () -> assertEquals(SIPrefixes.RONNA, SIPrefixes.QUETTA.previous(), "QUETTA previous not as expected") //$NON-NLS-1$
236     );
237    }
238 
239 
240   /**
241    * Test first of SIPrefixes.
242    */
243   @Test
244   /* default */ void testFirst()
245    {
246     assertEquals(SIPrefixes.QUECTO, SIPrefixes.first(), "first not as expected"); //$NON-NLS-1$
247    }
248 
249 
250   /**
251    * Test last of SIPrefixes.
252    */
253   @Test
254   /* default */ void testLast()
255    {
256     assertEquals(SIPrefixes.QUETTA, SIPrefixes.last(), "last not as expected"); //$NON-NLS-1$
257    }
258 
259 
260   /**
261    * Test base of SIPrefixes.
262    */
263   @Test
264   /* default */ void testBase()
265    {
266     assertEquals(SIPrefixes.ZERO, SIPrefixes.base(), "base not as expected"); //$NON-NLS-1$
267    }
268 
269 
270   /**
271    * Test getName of SIPrefixes.
272    */
273   @Test
274   /* default */ void testGetName()
275    {
276     assertAll("getName", //$NON-NLS-1$
277       () -> assertEquals("quecto", SIPrefixes.QUECTO.getName(), "QUECTO name not as expected"), //$NON-NLS-1$
278       () -> assertEquals("ronto", SIPrefixes.RONTO.getName(), "RONTO name not as expected"), //$NON-NLS-1$
279       () -> assertEquals("yocto", SIPrefixes.YOCTO.getName(), "YOCTO name not as expected"), //$NON-NLS-1$
280       () -> assertEquals("zepto", SIPrefixes.ZEPTO.getName(), "ZEPTO name not as expected"), //$NON-NLS-1$
281       () -> assertEquals("atto", SIPrefixes.ATTO.getName(), "ATTO name not as expected"), //$NON-NLS-1$
282       () -> assertEquals("femto", SIPrefixes.FEMTO.getName(), "FEMTO name not as expected"), //$NON-NLS-1$
283       () -> assertEquals("pico", SIPrefixes.PICO.getName(), "PICO name not as expected"), //$NON-NLS-1$
284       () -> assertEquals("nano", SIPrefixes.NANO.getName(), "NANO name not as expected"), //$NON-NLS-1$
285       () -> assertEquals("micro", SIPrefixes.MICRO.getName(), "MICRO name not as expected"), //$NON-NLS-1$
286       () -> assertEquals("milli", SIPrefixes.MILLI.getName(), "MILLI name not as expected"), //$NON-NLS-1$
287       () -> assertEquals("centi", SIPrefixes.CENTI.getName(), "CENTI name not as expected"), //$NON-NLS-1$
288       () -> assertEquals("deci", SIPrefixes.DECI.getName(), "DECI name not as expected"), //$NON-NLS-1$
289       () -> assertEquals("", SIPrefixes.ZERO.getName(), "ZERO name not as expected"), //$NON-NLS-1$
290       () -> assertEquals("deca", SIPrefixes.DECA.getName(), "DECA name not as expected"), //$NON-NLS-1$
291       () -> assertEquals("hecto", SIPrefixes.HECTO.getName(), "HECTO name not as expected"), //$NON-NLS-1$
292       () -> assertEquals("kilo", SIPrefixes.KILO.getName(), "KILO name not as expected"), //$NON-NLS-1$
293       () -> assertEquals("mega", SIPrefixes.MEGA.getName(), "MEGA name not as expected"), //$NON-NLS-1$
294       () -> assertEquals("giga", SIPrefixes.GIGA.getName(), "GIGA name not as expected"), //$NON-NLS-1$
295       () -> assertEquals("tera", SIPrefixes.TERA.getName(), "TERA name not as expected"), //$NON-NLS-1$
296       () -> assertEquals("peta", SIPrefixes.PETA.getName(), "PETA name not as expected"), //$NON-NLS-1$
297       () -> assertEquals("exa", SIPrefixes.EXA.getName(), "EXA name not as expected"), //$NON-NLS-1$
298       () -> assertEquals("zetta", SIPrefixes.ZETTA.getName(), "ZETTA name not as expected"), //$NON-NLS-1$
299       () -> assertEquals("yotta", SIPrefixes.YOTTA.getName(), "YOTTA name not as expected"), //$NON-NLS-1$
300       () -> assertEquals("ronna", SIPrefixes.RONNA.getName(), "RONNA name not as expected"), //$NON-NLS-1$
301       () -> assertEquals("quetta", SIPrefixes.QUETTA.getName(), "QUETTA name not as expected") //$NON-NLS-1$
302     );
303    }
304 
305 
306   /**
307    * Test getSymbol of SIPrefixes.
308    */
309   @Test
310   /* default */ void testGetSymbol()
311    {
312     assertAll("getSymbol", //$NON-NLS-1$
313       () -> assertEquals("q", SIPrefixes.QUECTO.getSymbol(), "QUECTO symbol not as expected"), //$NON-NLS-1$
314       () -> assertEquals("r", SIPrefixes.RONTO.getSymbol(), "RONTO symbol not as expected"), //$NON-NLS-1$
315       () -> assertEquals("y", SIPrefixes.YOCTO.getSymbol(), "YOCTO symbol not as expected"), //$NON-NLS-1$
316       () -> assertEquals("z", SIPrefixes.ZEPTO.getSymbol(), "ZEPTO symbol not as expected"), //$NON-NLS-1$
317       () -> assertEquals("a", SIPrefixes.ATTO.getSymbol(), "ATTO symbol not as expected"), //$NON-NLS-1$
318       () -> assertEquals("f", SIPrefixes.FEMTO.getSymbol(), "FEMTO symbol not as expected"), //$NON-NLS-1$
319       () -> assertEquals("p", SIPrefixes.PICO.getSymbol(), "PICO symbol not as expected"), //$NON-NLS-1$
320       () -> assertEquals("n", SIPrefixes.NANO.getSymbol(), "NANO symbol not as expected"), //$NON-NLS-1$
321       // () -> assertEquals("μ", SIPrefixes.MICRO.getSymbol(), "MICRO symbol not as expected"), //$NON-NLS-1$
322       () -> assertEquals("m", SIPrefixes.MILLI.getSymbol(), "MILLI symbol not as expected"), //$NON-NLS-1$
323       () -> assertEquals("c", SIPrefixes.CENTI.getSymbol(), "CENTI symbol not as expected"), //$NON-NLS-1$
324       () -> assertEquals("d", SIPrefixes.DECI.getSymbol(), "DECI symbol not as expected"), //$NON-NLS-1$
325       () -> assertEquals("", SIPrefixes.ZERO.getSymbol(), "ZERO symbol not as expected"), //$NON-NLS-1$
326       () -> assertEquals("da", SIPrefixes.DECA.getSymbol(), "DECA symbol not as expected"), //$NON-NLS-1$
327       () -> assertEquals("h", SIPrefixes.HECTO.getSymbol(), "HECTO symbol not as expected"), //$NON-NLS-1$
328       () -> assertEquals("k", SIPrefixes.KILO.getSymbol(), "KILO symbol not as expected"), //$NON-NLS-1$
329       () -> assertEquals("M", SIPrefixes.MEGA.getSymbol(), "MEGA symbol not as expected"), //$NON-NLS-1$
330       () -> assertEquals("G", SIPrefixes.GIGA.getSymbol(), "GIGA symbol not as expected"), //$NON-NLS-1$
331       () -> assertEquals("T", SIPrefixes.TERA.getSymbol(), "TERA symbol not as expected"), //$NON-NLS-1$
332       () -> assertEquals("P", SIPrefixes.PETA.getSymbol(), "PETA symbol not as expected"), //$NON-NLS-1$
333       () -> assertEquals("E", SIPrefixes.EXA.getSymbol(), "EXA symbol not as expected"), //$NON-NLS-1$
334       () -> assertEquals("Z", SIPrefixes.ZETTA.getSymbol(), "ZETTA symbol not as expected"), //$NON-NLS-1$
335       () -> assertEquals("Y", SIPrefixes.YOTTA.getSymbol(), "YOTTA symbol not as expected"), //$NON-NLS-1$
336       () -> assertEquals("R", SIPrefixes.RONNA.getSymbol(), "RONNA symbol not as expected"), //$NON-NLS-1$
337       () -> assertEquals("Q", SIPrefixes.QUETTA.getSymbol(), "QUETTA symbol not as expected") //$NON-NLS-1$
338     );
339    }
340 
341 
342   /**
343    * Test byBase exception.
344    */
345   @Test
346   /* default */ void testByBaseException()
347    {
348     assertThrows(NoSuchElementException.class, () ->
349      {
350       SIPrefixes.byBase(-4);
351      }, "No such element exception expected" //$NON-NLS-1$
352     );
353    }
354 
355 
356   /**
357    * Test byBase of SIPrefixes.
358    */
359   @Test
360   /* default */ void testByBase()
361    {
362     assertAll("byBase", //$NON-NLS-1$
363       () -> assertEquals(SIPrefixes.QUECTO, SIPrefixes.byBase(-30), "QUECTO base not as expected"), //$NON-NLS-1$
364       () -> assertEquals(SIPrefixes.RONTO, SIPrefixes.byBase(-27), "RONTO base not as expected"), //$NON-NLS-1$
365       () -> assertEquals(SIPrefixes.YOCTO, SIPrefixes.byBase(-24), "YOCTO base not as expected"), //$NON-NLS-1$
366       () -> assertEquals(SIPrefixes.ZEPTO, SIPrefixes.byBase(-21), "ZEPTO base not as expected"), //$NON-NLS-1$
367       () -> assertEquals(SIPrefixes.ATTO, SIPrefixes.byBase(-18), "ATTO base not as expected"), //$NON-NLS-1$
368       () -> assertEquals(SIPrefixes.FEMTO, SIPrefixes.byBase(-15), "FEMTO base not as expected"), //$NON-NLS-1$
369       () -> assertEquals(SIPrefixes.PICO, SIPrefixes.byBase(-12), "PICO base not as expected"), //$NON-NLS-1$
370       () -> assertEquals(SIPrefixes.NANO, SIPrefixes.byBase(-9), "NANO base not as expected"), //$NON-NLS-1$
371       () -> assertEquals(SIPrefixes.MICRO, SIPrefixes.byBase(-6), "MICRO base not as expected"), //$NON-NLS-1$
372       () -> assertEquals(SIPrefixes.MILLI, SIPrefixes.byBase(-3), "MILLI base not as expected"), //$NON-NLS-1$
373       () -> assertEquals(SIPrefixes.CENTI, SIPrefixes.byBase(-2), "CENTI base not as expected"), //$NON-NLS-1$
374       () -> assertEquals(SIPrefixes.DECI, SIPrefixes.byBase(-1), "DECI base not as expected"), //$NON-NLS-1$
375       () -> assertEquals(SIPrefixes.ZERO, SIPrefixes.byBase(0), "ZERO base not as expected"), //$NON-NLS-1$
376       () -> assertEquals(SIPrefixes.DECA, SIPrefixes.byBase(1), "DECA base not as expected"), //$NON-NLS-1$
377       () -> assertEquals(SIPrefixes.HECTO, SIPrefixes.byBase(2), "HECTO base not as expected"), //$NON-NLS-1$
378       () -> assertEquals(SIPrefixes.KILO, SIPrefixes.byBase(3), "KILO base not as expected"), //$NON-NLS-1$
379       () -> assertEquals(SIPrefixes.MEGA, SIPrefixes.byBase(6), "MEGA base not as expected"), //$NON-NLS-1$
380       () -> assertEquals(SIPrefixes.GIGA, SIPrefixes.byBase(9), "GIGA base not as expected"), //$NON-NLS-1$
381       () -> assertEquals(SIPrefixes.TERA, SIPrefixes.byBase(12), "TERA base not as expected"), //$NON-NLS-1$
382       () -> assertEquals(SIPrefixes.PETA, SIPrefixes.byBase(15), "PETA base not as expected"), //$NON-NLS-1$
383       () -> assertEquals(SIPrefixes.EXA, SIPrefixes.byBase(18), "EXA base not as expected"), //$NON-NLS-1$
384       () -> assertEquals(SIPrefixes.ZETTA, SIPrefixes.byBase(21), "ZETTA base not as expected"), //$NON-NLS-1$
385       () -> assertEquals(SIPrefixes.YOTTA, SIPrefixes.byBase(24), "YOTTA base not as expected"), //$NON-NLS-1$
386       () -> assertEquals(SIPrefixes.RONNA, SIPrefixes.byBase(27), "RONNA base not as expected"), //$NON-NLS-1$
387       () -> assertEquals(SIPrefixes.QUETTA, SIPrefixes.byBase(30), "QUETTA base not as expected") //$NON-NLS-1$
388     );
389    }
390 
391  }