Java 类org.bouncycastle.asn1.isismtt.x509.MonetaryLimit 实例源码

项目:gwt-crypto    文件:MonetaryLimitUnitTest.java   
private void checkConstruction(
    MonetaryLimit limit,
    String currency,
    int    amount,
    int    exponent)
    throws IOException
{
    checkValues(limit, currency, amount, exponent);

    limit = MonetaryLimit.getInstance(limit);

    checkValues(limit, currency, amount, exponent);

    ASN1InputStream aIn = new ASN1InputStream(limit.toASN1Primitive().getEncoded());

    ASN1Sequence seq = (ASN1Sequence)aIn.readObject();

    limit = MonetaryLimit.getInstance(seq);

    checkValues(limit, currency, amount, exponent);
}
项目:irma_future_id    文件:MonetaryLimitUnitTest.java   
private void checkConstruction(
    MonetaryLimit limit,
    String currency,
    int    amount,
    int    exponent)
    throws IOException
{
    checkValues(limit, currency, amount, exponent);

    limit = MonetaryLimit.getInstance(limit);

    checkValues(limit, currency, amount, exponent);

    ASN1InputStream aIn = new ASN1InputStream(limit.toASN1Object().getEncoded());

    ASN1Sequence seq = (ASN1Sequence)aIn.readObject();

    limit = MonetaryLimit.getInstance(seq);

    checkValues(limit, currency, amount, exponent);
}
项目:bc-java    文件:MonetaryLimitUnitTest.java   
private void checkConstruction(
    MonetaryLimit limit,
    String currency,
    int    amount,
    int    exponent)
    throws IOException
{
    checkValues(limit, currency, amount, exponent);

    limit = MonetaryLimit.getInstance(limit);

    checkValues(limit, currency, amount, exponent);

    ASN1InputStream aIn = new ASN1InputStream(limit.toASN1Object().getEncoded());

    ASN1Sequence seq = (ASN1Sequence)aIn.readObject();

    limit = MonetaryLimit.getInstance(seq);

    checkValues(limit, currency, amount, exponent);
}
项目:gwt-crypto    文件:MonetaryLimitUnitTest.java   
public void performTest()
    throws Exception
{
    String currency = "AUD";
    int    amount = 1;
    int    exponent = 2;

    MonetaryLimit limit = new MonetaryLimit(currency, amount, exponent);

    checkConstruction(limit, currency, amount, exponent);

    limit = MonetaryLimit.getInstance(null);

    if (limit != null)
    {
        fail("null getInstance() failed.");
    }

    try
    {
        MonetaryLimit.getInstance(new Object());

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
项目:gwt-crypto    文件:MonetaryLimitUnitTest.java   
private void checkValues(
    MonetaryLimit limit,
    String currency,
    int    amount,
    int    exponent)
{
    checkMandatoryField("currency", currency, limit.getCurrency());
    checkMandatoryField("amount", amount, limit.getAmount().intValue());
    checkMandatoryField("exponent", exponent, limit.getExponent().intValue());
}
项目:keystore-explorer    文件:X509Ext.java   
private String getMonetaryLimitStringValue(byte[] octets) {

        // @formatter:off

        /*
            MonetaryLimitSyntax ::= SEQUENCE
            {
                currency PrintableString (SIZE(3)),
                amount INTEGER,
                exponent INTEGER
            }
         */

        // @formatter:on

        StringBuilder sb = new StringBuilder();

        MonetaryLimit monetaryLimit = MonetaryLimit.getInstance(octets);
        String currency = monetaryLimit.getCurrency();
        BigInteger amount = monetaryLimit.getAmount();
        BigInteger exponent = monetaryLimit.getExponent();

        if (currency != null) {
            sb.append(MessageFormat.format(res.getString("MonetaryLimit.Currency"), currency));
            sb.append(NEWLINE);
        }

        if (amount != null) {
            sb.append(MessageFormat.format(res.getString("MonetaryLimit.Amount"), amount.toString()));
            sb.append(NEWLINE);
        }

        if (exponent != null) {
            sb.append(MessageFormat.format(res.getString("MonetaryLimit.Exponent"), exponent.toString()));
            sb.append(NEWLINE);
        }

        return sb.toString();
    }
项目:irma_future_id    文件:MonetaryLimitUnitTest.java   
public void performTest()
    throws Exception
{
    String currency = "AUD";
    int    amount = 1;
    int    exponent = 2;

    MonetaryLimit limit = new MonetaryLimit(currency, amount, exponent);

    checkConstruction(limit, currency, amount, exponent);

    limit = MonetaryLimit.getInstance(null);

    if (limit != null)
    {
        fail("null getInstance() failed.");
    }

    try
    {
        MonetaryLimit.getInstance(new Object());

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
项目:irma_future_id    文件:MonetaryLimitUnitTest.java   
private void checkValues(
    MonetaryLimit limit,
    String currency,
    int    amount,
    int    exponent)
{
    checkMandatoryField("currency", currency, limit.getCurrency());
    checkMandatoryField("amount", amount, limit.getAmount().intValue());
    checkMandatoryField("exponent", exponent, limit.getExponent().intValue());
}
项目:bc-java    文件:MonetaryLimitUnitTest.java   
public void performTest()
    throws Exception
{
    String currency = "AUD";
    int    amount = 1;
    int    exponent = 2;

    MonetaryLimit limit = new MonetaryLimit(currency, amount, exponent);

    checkConstruction(limit, currency, amount, exponent);

    limit = MonetaryLimit.getInstance(null);

    if (limit != null)
    {
        fail("null getInstance() failed.");
    }

    try
    {
        MonetaryLimit.getInstance(new Object());

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
项目:bc-java    文件:MonetaryLimitUnitTest.java   
private void checkValues(
    MonetaryLimit limit,
    String currency,
    int    amount,
    int    exponent)
{
    checkMandatoryField("currency", currency, limit.getCurrency());
    checkMandatoryField("amount", amount, limit.getAmount().intValue());
    checkMandatoryField("exponent", exponent, limit.getExponent().intValue());
}