Package com.luxoft.dnepr.courses.regular.unit3.errors

Examples of com.luxoft.dnepr.courses.regular.unit3.errors.IllegalJavaVersionError


     * @throws IllegalJavaVersionError if current JVM version not equal to excepted
     */
    public Bank(String expectedJavaVersion) {
        String actualJavaVersion = System.getProperty(JAVA_VERSION_KEY);
        if (!actualJavaVersion.equals(expectedJavaVersion)) {
            throw new IllegalJavaVersionError(actualJavaVersion, expectedJavaVersion,
                    String.format(ILLEGAL_JAVA_VERSION_MESSAGE, actualJavaVersion, expectedJavaVersion)
            );
        }
    }
View Full Code Here


    public Bank(String expectedJavaVersion) {

        String actualJavaVersion = System.getProperty("java.version");
        if (!actualJavaVersion.equals(expectedJavaVersion)) {
            throw new IllegalJavaVersionError(actualJavaVersion, expectedJavaVersion,
                    "Java version is incorrect (" + actualJavaVersion + " != " + expectedJavaVersion + ").");
        }
    }
View Full Code Here

    public void checkWithdrawal(BigDecimal amountToWithdraw) throws WalletIsBlockedException, InsufficientWalletAmountException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, WALLET_IS_BLOCKED_MESSAGE);
        }
        if (amountToWithdraw.compareTo(amount) > 0) {
            throw new InsufficientWalletAmountException(id, amountToWithdraw, amount,
                    INSUFFICIENT_WALLET_AMOUNT_MESSAGE
            );
        }
    }
View Full Code Here

    public void checkWithdrawal(BigDecimal amountToWithdraw) throws WalletIsBlockedException, InsufficientWalletAmountException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, "Wallet " + id + " is blocked.");
        }
        if (amount.compareTo(amountToWithdraw) < 0) {
            throw new InsufficientWalletAmountException(id, amountToWithdraw, amount, "Insufficient funds (" +
                    MoneyFormatter.format(amount) + " < " + MoneyFormatter.format(amountToWithdraw) + ")");
        }
    }
View Full Code Here

    public void checkTransfer(BigDecimal amountToTransfer) throws WalletIsBlockedException, LimitExceededException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, WALLET_IS_BLOCKED_MESSAGE);
        }
        if (amount.add(amountToTransfer).compareTo(maxAmount) > 1) {
            throw new LimitExceededException(id, amountToTransfer, amount, LIMIT_EXCEEDED_MESSAGE);
        }
    }
View Full Code Here

    public void checkTransfer(BigDecimal amountToTransfer) throws WalletIsBlockedException, LimitExceededException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, "Wallet " + id + " is blocked.");
        }
        if (maxAmount.compareTo(amount.add(amountToTransfer)) < 0) {
            throw new LimitExceededException(id, amountToTransfer, amount, "Limit exceeded (" +
                    MoneyFormatter.format(amount) + " + " + MoneyFormatter.format(amountToTransfer) +
                    " > " + MoneyFormatter.format(maxAmount) + ")");
        }
    }
View Full Code Here

    }

    @Override
    public void checkWithdrawal(BigDecimal amountToWithdraw) throws WalletIsBlockedException, InsufficientWalletAmountException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, WALLET_IS_BLOCKED_MESSAGE);
        }
        if (amountToWithdraw.compareTo(amount) > 0) {
            throw new InsufficientWalletAmountException(id, amountToWithdraw, amount,
                    INSUFFICIENT_WALLET_AMOUNT_MESSAGE
            );
View Full Code Here

    }

    @Override
    public void checkTransfer(BigDecimal amountToTransfer) throws WalletIsBlockedException, LimitExceededException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, WALLET_IS_BLOCKED_MESSAGE);
        }
        if (amount.add(amountToTransfer).compareTo(maxAmount) > 1) {
            throw new LimitExceededException(id, amountToTransfer, amount, LIMIT_EXCEEDED_MESSAGE);
        }
    }
View Full Code Here

    }

    @Override
    public void checkWithdrawal(BigDecimal amountToWithdraw) throws WalletIsBlockedException, InsufficientWalletAmountException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, "Wallet " + id + " is blocked.");
        }
        if (amount.compareTo(amountToWithdraw) < 0) {
            throw new InsufficientWalletAmountException(id, amountToWithdraw, amount, "Insufficient funds (" +
                    MoneyFormatter.format(amount) + " < " + MoneyFormatter.format(amountToWithdraw) + ")");
        }
View Full Code Here

    }

    @Override
    public void checkTransfer(BigDecimal amountToTransfer) throws WalletIsBlockedException, LimitExceededException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, "Wallet " + id + " is blocked.");
        }
        if (maxAmount.compareTo(amount.add(amountToTransfer)) < 0) {
            throw new LimitExceededException(id, amountToTransfer, amount, "Limit exceeded (" +
                    MoneyFormatter.format(amount) + " + " + MoneyFormatter.format(amountToTransfer) +
                    " > " + MoneyFormatter.format(maxAmount) + ")");
View Full Code Here

TOP

Related Classes of com.luxoft.dnepr.courses.regular.unit3.errors.IllegalJavaVersionError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.