Пример #1
0
 @Test
 public void testValid() {
   CssDimension dim23 = CssDimension.valueOf("23");
   assertEquals(23, dim23.value);
   CssDimension dim23px = CssDimension.valueOf("23px");
   assertEquals(23, dim23px.value);
   CssDimension negative = CssDimension.valueOf("-1");
   assertEquals(-1, negative.value);
 }
Пример #2
0
 @Test
 public void testDefaultString() {
   assertEquals("0px", CssDimension.ZERO.toDefaultString());
   assertEquals("23px", CssDimension.valueOf("23").toDefaultString());
 }
Пример #3
0
 @Test
 public void testZero() {
   assertSame(CssDimension.ZERO, CssDimension.valueOf("0"));
   assertSame(CssDimension.ZERO, CssDimension.valueOf("0px"));
   assertEquals(0, CssDimension.ZERO.value);
 }
Пример #4
0
 @Test(expected = IllegalArgumentException.class)
 public void testValueOf_unsupportedUnit() {
   CssDimension.valueOf("23em");
 }
Пример #5
0
 @Test(expected = IllegalArgumentException.class)
 public void testValueOf_startWithSpace() {
   CssDimension.valueOf(" 23px");
 }
Пример #6
0
 @Test(expected = IllegalArgumentException.class)
 public void testValueOf_emptyString() {
   CssDimension.valueOf("");
 }
Пример #7
0
 @Test(expected = NullPointerException.class)
 public void testValueOf_nullArgument() {
   CssDimension.valueOf(null);
 }