• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

abdulkader138 / personal-expense-tracker / #55

02 Jan 2026 10:58PM UTC coverage: 99.281% (-0.2%) from 99.481%
#55

push

abdulkader138
Working on code coverage

8 of 13 new or added lines in 2 files covered. (61.54%)

1 existing line in 1 file now uncovered.

966 of 973 relevant lines covered (99.28%)

0.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.32
/src/main/java/com/mycompany/pet/ui/ExpenseTrackerApp.java
1
package com.mycompany.pet.ui;
2

3
import java.awt.GraphicsEnvironment;
4
import java.util.logging.Level;
5
import java.util.logging.Logger;
6

7
import javax.swing.JOptionPane;
8
import javax.swing.SwingUtilities;
9

10
import com.google.inject.Guice;
11
import com.google.inject.Injector;
12
import com.mycompany.pet.di.ExpenseTrackerModule;
13

14
/**
15
 * Main application entry point for the Expense Tracker.
16
 * 
17
 * This application uses Google Guice for Dependency Injection, following the pattern
18
 * from "Test-Driven Development, Build Automation, Continuous Integration" book.
19
 */
20
public class ExpenseTrackerApp {
×
21
    private static final Logger LOGGER = Logger.getLogger(ExpenseTrackerApp.class.getName());
1✔
22
    
23
    public static void main(String[] args) {
24
        if (GraphicsEnvironment.isHeadless()) {
1✔
25
            LOGGER.severe("ERROR: This application requires a graphical display.");
1✔
26
            LOGGER.severe("Please run this application in an environment with X11 display support.");
1✔
27
            LOGGER.severe("\nFor WSL, you can:");
1✔
28
            LOGGER.severe("1. Install an X server (e.g., VcXsrv, Xming) on Windows");
1✔
29
            LOGGER.severe("2. Set DISPLAY variable: export DISPLAY=:0.0");
1✔
30
            LOGGER.severe("3. Or run from Eclipse IDE which handles the display automatically");
1✔
31
            int exitCode = 1; // Ensure line is recorded by JaCoCo
1✔
NEW
32
            System.exit(exitCode);
×
33
        }
34

35
        SwingUtilities.invokeLater(() -> {
1✔
36
            try {
37
                // Create Guice injector with ExpenseTrackerModule
38
                // All components will be automatically wired together by Guice
39
                Injector injector = Guice.createInjector(
1✔
40
                    new ExpenseTrackerModule()
41
                        .mongoHost("localhost")
1✔
42
                        .mongoPort(27017)
1✔
43
                        .databaseName("expense_tracker")
1✔
44
                );
45

46
                MainWindow mainWindow = injector.getInstance(MainWindow.class);
1✔
47
                mainWindow.setVisible(true);
1✔
48
            } catch (Exception e) {
1✔
49
                String errorMsg = "Failed to initialize MongoDB database: " + e.getMessage();
1✔
50
                LOGGER.log(Level.SEVERE, errorMsg, e);
1✔
51
                LOGGER.severe("\nPlease ensure:");
1✔
52
                LOGGER.severe("1. MongoDB is running (default: mongodb://localhost:27017)");
1✔
53
                LOGGER.severe("2. The 'expense_tracker' database is accessible");
1✔
54
                
55
                if (!GraphicsEnvironment.isHeadless()) {
1✔
56
                    JOptionPane.showMessageDialog(null,
1✔
57
                        errorMsg + "\n\nCheck console for setup instructions.",
58
                        "Database Error",
59
                        JOptionPane.ERROR_MESSAGE);
60
                }
61
                int exitCode = 1; // Ensure line is recorded by JaCoCo
1✔
NEW
62
                System.exit(exitCode);
×
63
            }
1✔
64
        });
1✔
65
    }
1✔
66
}
67

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc