Java 类java.util.DuplicateFormatFlagsException 实例源码

项目:form-follows-function    文件:F3Formatter.java   
public static Flags parse(String s) {
    char[] ca = s.toCharArray();
    Flags f = new Flags(0);
    for (int i = 0; i < ca.length; i++) {
        Flags v = parse(ca[i]);
        if (f.contains(v))
            throw new DuplicateFormatFlagsException(v.toString());
        f.add(v);
    }
    return f;
}
项目:In-the-Box-Fork    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#DuplicateFormatFlagsException(String)
 */
public void test_duplicateFormatFlagsException() {
    try {
        new DuplicateFormatFlagsException(null);
        fail("should throw NullPointerException.");
    } catch (NullPointerException e) {
        // desired
    }
}
项目:In-the-Box-Fork    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#getFlags()
 */
public void test_getFlags() {
    String strFlags = "MYTESTFLAGS";
    DuplicateFormatFlagsException duplicateFormatException = new DuplicateFormatFlagsException(
            strFlags);
    assertEquals(strFlags, duplicateFormatException.getFlags());
}
项目:In-the-Box-Fork    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#getMessage()
 */
public void test_getMessage() {
    String strFlags = "MYTESTFLAGS";
    DuplicateFormatFlagsException duplicateFormatException = new DuplicateFormatFlagsException(
            strFlags);
    assertTrue(null != duplicateFormatException.getFlags());

}
项目:In-the-Box-Fork    文件:DuplicateFormatFlagsExceptionTest.java   
public void assertDeserialized(Serializable initial,
        Serializable deserialized) {

    SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
            deserialized);

    DuplicateFormatFlagsException initEx = (DuplicateFormatFlagsException) initial;
    DuplicateFormatFlagsException desrEx = (DuplicateFormatFlagsException) deserialized;

    assertEquals("Flags", initEx.getFlags(), desrEx.getFlags());
}
项目:cn1    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#DuplicateFormatFlagsException(String)
 */
public void test_duplicateFormatFlagsException() {
    try {
        new DuplicateFormatFlagsException(null);
        fail("should throw NullPointerException.");
    } catch (NullPointerException e) {
        // desired
    }
}
项目:cn1    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#getFlags()
 */
public void test_getFlags() {
    String strFlags = "MYTESTFLAGS";
    DuplicateFormatFlagsException duplicateFormatException = new DuplicateFormatFlagsException(
            strFlags);
    assertEquals(strFlags, duplicateFormatException.getFlags());
}
项目:cn1    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#getMessage()
 */
public void test_getMessage() {
    String strFlags = "MYTESTFLAGS";
    DuplicateFormatFlagsException duplicateFormatException = new DuplicateFormatFlagsException(
            strFlags);
    assertTrue(null != duplicateFormatException.getFlags());

}
项目:cn1    文件:DuplicateFormatFlagsExceptionTest.java   
public void assertDeserialized(Serializable initial,
        Serializable deserialized) {

    SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
            deserialized);

    DuplicateFormatFlagsException initEx = (DuplicateFormatFlagsException) initial;
    DuplicateFormatFlagsException desrEx = (DuplicateFormatFlagsException) deserialized;

    assertEquals("Flags", initEx.getFlags(), desrEx.getFlags());
}
项目:bazel    文件:Flags.java   
public static Flags parse(String s) {
    char[] ca = s.toCharArray();
    Flags f = new Flags(0);
    for (int i = 0; i < ca.length; i++) {
        Flags v = parse(ca[i]);
        if (f.contains(v))
            throw new DuplicateFormatFlagsException(v.toString());
        f.add(v);
    }
    return f;
}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#DuplicateFormatFlagsException(String)
 */
public void test_duplicateFormatFlagsException() {
    try {
        new DuplicateFormatFlagsException(null);
        fail("should throw NullPointerException.");
    } catch (NullPointerException e) {
        // desired
    }
}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#getFlags()
 */
public void test_getFlags() {
    String strFlags = "MYTESTFLAGS";
    DuplicateFormatFlagsException duplicateFormatException = new DuplicateFormatFlagsException(
            strFlags);
    assertEquals(strFlags, duplicateFormatException.getFlags());
}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#getMessage()
 */
public void test_getMessage() {
    String strFlags = "MYTESTFLAGS";
    DuplicateFormatFlagsException duplicateFormatException = new DuplicateFormatFlagsException(
            strFlags);
    assertTrue(null != duplicateFormatException.getFlags());

}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
public void assertDeserialized(Serializable initial,
        Serializable deserialized) {

    SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
            deserialized);

    DuplicateFormatFlagsException initEx = (DuplicateFormatFlagsException) initial;
    DuplicateFormatFlagsException desrEx = (DuplicateFormatFlagsException) deserialized;

    assertEquals("Flags", initEx.getFlags(), desrEx.getFlags());
}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#DuplicateFormatFlagsException(String)
 */
public void test_duplicateFormatFlagsException() {
    try {
        new DuplicateFormatFlagsException(null);
        fail("should throw NullPointerException.");
    } catch (NullPointerException e) {
        // desired
    }
}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#getFlags()
 */
public void test_getFlags() {
    String strFlags = "MYTESTFLAGS";
    DuplicateFormatFlagsException duplicateFormatException = new DuplicateFormatFlagsException(
            strFlags);
    assertEquals(strFlags, duplicateFormatException.getFlags());
}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests java.util.DuplicateFormatFlagsException#getMessage()
 */
public void test_getMessage() {
    String strFlags = "MYTESTFLAGS";
    DuplicateFormatFlagsException duplicateFormatException = new DuplicateFormatFlagsException(
            strFlags);
    assertTrue(null != duplicateFormatException.getFlags());

}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
public void assertDeserialized(Serializable initial,
        Serializable deserialized) {

    SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
            deserialized);

    DuplicateFormatFlagsException initEx = (DuplicateFormatFlagsException) initial;
    DuplicateFormatFlagsException desrEx = (DuplicateFormatFlagsException) deserialized;

    assertEquals("Flags", initEx.getFlags(), desrEx.getFlags());
}
项目:teavm    文件:TFormatter.java   
private void parseFlags() {
    while (index < format.length()) {
        char c = format.charAt(index);
        int flag;
        switch (c) {
            case '-':
                flag = TFormattableFlags.LEFT_JUSTIFY;
                break;
            case '#':
                flag = TFormattableFlags.ALTERNATE;
                break;
            case '+':
                flag = TFormattableFlags.SIGNED;
                break;
            case ' ':
                flag = TFormattableFlags.LEADING_SPACE;
                break;
            case '0':
                flag = TFormattableFlags.ZERO_PADDED;
                break;
            case ',':
                flag = TFormattableFlags.GROUPING_SEPARATOR;
                break;
            case '(':
                flag = TFormattableFlags.PARENTHESIZED_NEGATIVE;
                break;
            case '<':
                flag = TFormattableFlags.PREVIOUS_ARGUMENT;
                break;
            default:
                return;
        }
        if ((flags & flag) != 0) {
            throw new DuplicateFormatFlagsException(String.valueOf(c));
        }
        flags |= flag;
        index++;
    }
}
项目:In-the-Box-Fork    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests serialization/deserialization.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new DuplicateFormatFlagsException(
            "TESTDESC"), exComparator);
}
项目:In-the-Box-Fork    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new DuplicateFormatFlagsException(
            "TESTDESC"), exComparator);
}
项目:cn1    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests serialization/deserialization.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new DuplicateFormatFlagsException(
            "TESTDESC"), exComparator);
}
项目:cn1    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new DuplicateFormatFlagsException(
            "TESTDESC"), exComparator);
}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests serialization/deserialization.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new DuplicateFormatFlagsException(
            "TESTDESC"), exComparator);
}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new DuplicateFormatFlagsException(
            "TESTDESC"), exComparator);
}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests serialization/deserialization.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new DuplicateFormatFlagsException(
            "TESTDESC"), exComparator);
}
项目:freeVM    文件:DuplicateFormatFlagsExceptionTest.java   
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new DuplicateFormatFlagsException(
            "TESTDESC"), exComparator);
}
项目:HoloIRC    文件:Formatter.java   
boolean setFlag(int ch) {
    boolean dupe;
    switch (ch) {
        case ',':
            dupe = flagComma;
            flagComma = true;
            break;
        case '-':
            dupe = flagMinus;
            flagMinus = true;
            break;
        case '(':
            dupe = flagParenthesis;
            flagParenthesis = true;
            break;
        case '+':
            dupe = flagPlus;
            flagPlus = true;
            break;
        case '#':
            dupe = flagSharp;
            flagSharp = true;
            break;
        case ' ':
            dupe = flagSpace;
            flagSpace = true;
            break;
        case '0':
            dupe = flagZero;
            flagZero = true;
            break;
        default:
            return false;
    }
    if (dupe) {
        // The RI documentation implies we're supposed to report all the flags, not just
        // the first duplicate, but the RI behaves the same as we do.
        throw new DuplicateFormatFlagsException(String.valueOf(ch));
    }
    if (strFlags == null) {
        strFlags = new StringBuilder(7); // There are seven possible flags.
    }
    strFlags.append((char) ch);
    return true;
}
项目:teavm    文件:FormatterTest.java   
@Test(expected = DuplicateFormatFlagsException.class)
public void duplicateFlag() {
    new Formatter().format("%--s", "q");
}