< Summary

Information
Class: com/ucoruh/calculator/CalculatorApp
Assembly: calculator
File(s): src/main/java/com/ucoruh/calculator/CalculatorApp.java
Line coverage
100%
Covered lines: 17
Uncovered lines: 0
Coverable lines: 17
Total lines: 80
Line coverage: 100%
Branch coverage
66%
Covered branches: 4
Total branches: 6
Branch coverage: 66.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Line coverage
<init>()-100%
<clinit>()-100%
main(...)66.67%100%

File(s)

src/main/java/com/ucoruh/calculator/CalculatorApp.java

#LineLine coverage
 1/**
 2
 3@file CalculatorApp.java
 4@brief This file serves as the main application file for the Calculator App.
 5@details This file contains the entry point of the application, which is the main method. It initializes the necessary c
 6*/
 7/**
 8
 9@package com.ucoruh.calculator
 10@brief The com.ucoruh.calculator package contains all the classes and files related to the Calculator App.
 11*/
 12package com.ucoruh.calculator;
 13
 14import java.io.IOException;
 15
 16import org.slf4j.LoggerFactory;
 17
 18import ch.qos.logback.classic.Logger;
 19
 20/**
 21 *
 22 * @class CalculatorApp
 23 * @brief This class represents the main application class for the Calculator
 24 *        App.
 25 * @details The CalculatorApp class provides the entry point for the Calculator
 26 *          App. It initializes the necessary components, performs calculations,
 27 *          and handles exceptions.
 28 * @author ugur.coruh
 29 */
 130public class CalculatorApp {
 31  /**
 32   * @brief Logger for the CalculatorApp class.
 33   */
 134  private static final Logger logger = (Logger) LoggerFactory.getLogger(CalculatorApp.class);
 35
 36  /**
 37   * @brief The main entry point of the Calculator App.
 38   *
 39   * @details The main method is the starting point of the Calculator App. It
 40   *          initializes the logger, performs logging, displays a greeting
 41   *          message, and handles user input.
 42   *
 43   * @param args The command-line arguments passed to the application.
 44   */
 45  public static void main(String[] args) {
 46    // Logging messages for informational purposes
 147    logger.info("Logging message");
 48    // Logging an error message
 149    logger.error("Error message");
 50    // Displaying a greeting message
 151    System.out.println("Hello World!");
 52
 53    try {
 54      // Checking if command-line arguments are provided
 155      if (args != null) {
 56        // Checking if there are any arguments
 157        if (args.length > 0) {
 58          // Checking if the first argument is "1"
 159          if (args[0].equals("1")) {
 60            // Throwing a dummy IOException
 161            throw new IOException("Dummy Exception...");
 62          }
 63        }
 64      }
 65
 66      // Prompting the user to press Enter to continue
 167      System.out.println("Press Enter to Continue...");
 68      // Reading user input from the console
 169      System.in.read();
 70      // Displaying a closing message
 171      System.out.println("Thank you...");
 172    } catch (IOException e) {
 73      // Logging the exception
 174      logger.error(e.toString());
 75      // Printing the exception stack trace
 176      e.printStackTrace();
 177    }
 178  }
 79
 80}