private static Flags parse(char c) { switch (c) { case '-': return LEFT_JUSTIFY; case '#': return ALTERNATE; case '+': return PLUS; case ' ': return LEADING_SPACE; case '0': return ZERO_PAD; case ',': return GROUP; case '(': return PARENTHESES; case '<': return PREVIOUS; default: throw new UnknownFormatFlagsException(String.valueOf(c)); } }
@Override protected ISelectionGravityState retrieveGravityState(int gravityAttribute) { switch (gravityAttribute) { case HorizontalLoopBarView.SELECTION_GRAVITY_START: return new StartGravityState(); case HorizontalLoopBarView.SELECTION_GRAVITY_END: return new EndGravityState(); default: throw new UnknownFormatFlagsException("unknown gravity Attribute = " + gravityAttribute + ". Should be one of SELECTION_GRAVITY"); } }
@Override protected ISelectionGravityState retrieveGravityState(int gravityAttribute) { switch (gravityAttribute) { case HorizontalLoopBarView.SELECTION_GRAVITY_START: return new TopGravityState(); case HorizontalLoopBarView.SELECTION_GRAVITY_END: return new BottomGravityState(); default: throw new UnknownFormatFlagsException("unknown gravity Attribute = " + gravityAttribute + ". Should be one of SELECTION_GRAVITY"); } }
@Override protected ISelectionGravityState retrieveGravityState(int gravityAttribute) { switch (gravityAttribute) { case LoopBarView.SELECTION_GRAVITY_START: return new TopGravityState(); case LoopBarView.SELECTION_GRAVITY_END: return new BottomGravityState(); default: throw new UnknownFormatFlagsException("unknown gravity Attribute = " + gravityAttribute + ". Should be one of SELECTION_GRAVITY"); } }
@Override protected ISelectionGravityState retrieveGravityState(int gravityAttribute) { switch (gravityAttribute) { case LoopBarView.SELECTION_GRAVITY_START: return new StartGravityState(); case LoopBarView.SELECTION_GRAVITY_END: return new EndGravityState(); default: throw new UnknownFormatFlagsException("unknown gravity Attribute = " + gravityAttribute + ". Should be one of SELECTION_GRAVITY"); } }
/** * @tests java.util.UnknownFormatFlagsException#UnknownFormatFlagsException(String) */ public void test_unknownFormatFlagsException() { try { new UnknownFormatFlagsException(null); fail("should throw NullPointerExcepiton"); } catch (NullPointerException e) { // expected } }
/** * @tests java.util.UnknownFormatFlagsException#getFlags() */ public void test_getFlags() { String s = "MYTESTSTRING"; UnknownFormatFlagsException UnknownFormatFlagsException = new UnknownFormatFlagsException( s); assertEquals(s, UnknownFormatFlagsException.getFlags()); }
/** * @tests java.util.UnknownFormatFlagsException#getMessage() */ public void test_getMessage() { String s = "MYTESTSTRING"; UnknownFormatFlagsException UnknownFormatFlagsException = new UnknownFormatFlagsException( s); assertNotNull(UnknownFormatFlagsException.getMessage()); }
public void assertDeserialized(Serializable initial, Serializable deserialized) { SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial, deserialized); UnknownFormatFlagsException initEx = (UnknownFormatFlagsException) initial; UnknownFormatFlagsException desrEx = (UnknownFormatFlagsException) deserialized; assertEquals("Flags", initEx.getFlags(), desrEx.getFlags()); }
/** * @tests serialization/deserialization. */ public void testSerializationSelf() throws Exception { SerializationTest.verifySelf(new UnknownFormatFlagsException( "MYTESTSTRING"), exComparator); }
/** * @tests serialization/deserialization compatibility with RI. */ public void testSerializationCompatibility() throws Exception { SerializationTest.verifyGolden(this, new UnknownFormatFlagsException( "MYTESTSTRING"), exComparator); }