dsajkdskadad
This commit is contained in:
parent
5c704f1804
commit
39a9bfd64c
27 changed files with 931 additions and 76 deletions
31
pom.xml
31
pom.xml
|
|
@ -23,9 +23,40 @@
|
|||
<version>5.10.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>5.11.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<version>5.11.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.11</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>report</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
|
|
|
|||
|
|
@ -7,16 +7,25 @@ import de.antco.projekt.model.WorkOrderDetails;
|
|||
import de.antco.projekt.model.WorkOrderItem;
|
||||
import de.antco.projekt.service.WorkshopService;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
public class ConsoleUi {
|
||||
|
||||
private final WorkshopService service;
|
||||
private final Scanner scanner = new Scanner(System.in);
|
||||
private final Scanner scanner;
|
||||
private final PrintStream out;
|
||||
|
||||
public ConsoleUi(WorkshopService service) {
|
||||
this(service, System.in, System.out);
|
||||
}
|
||||
|
||||
public ConsoleUi(WorkshopService service, InputStream in, PrintStream out) {
|
||||
this.service = service;
|
||||
this.scanner = new Scanner(in);
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
|
|
@ -24,6 +33,7 @@ public class ConsoleUi {
|
|||
|
||||
while (running) {
|
||||
showMenu();
|
||||
if (!scanner.hasNextLine()) break;
|
||||
String choice = scanner.nextLine().trim();
|
||||
|
||||
try {
|
||||
|
|
@ -35,78 +45,82 @@ public class ConsoleUi {
|
|||
case "5" -> createWorkOrder();
|
||||
case "6" -> showWorkOrders();
|
||||
case "0" -> running = false;
|
||||
default -> System.out.println("Ungültige Eingabe.");
|
||||
default -> out.println("Ungültige Eingabe.");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("Ein Fehler ist aufgetreten: " + e.getMessage());
|
||||
out.println("Ein Fehler ist aufgetreten: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Programm beendet.");
|
||||
out.println("Programm beendet.");
|
||||
}
|
||||
|
||||
private void showMenu() {
|
||||
System.out.println("\n=== Werkstatt Menü ===");
|
||||
System.out.println("1) Kunde anlegen");
|
||||
System.out.println("2) Kunden anzeigen");
|
||||
System.out.println("3) Fahrzeug anlegen");
|
||||
System.out.println("4) Fahrzeuge einer Person anzeigen");
|
||||
System.out.println("5) Werkstattvorgang anlegen");
|
||||
System.out.println("6) Vorgänge anzeigen");
|
||||
System.out.println("0) Beenden");
|
||||
System.out.print("Auswahl: ");
|
||||
out.println("\n=== Werkstatt Menü ===");
|
||||
out.println("1) Kunde anlegen");
|
||||
out.println("2) Kunden anzeigen");
|
||||
out.println("3) Fahrzeug anlegen");
|
||||
out.println("4) Fahrzeuge einer Person anzeigen");
|
||||
out.println("5) Werkstattvorgang anlegen");
|
||||
out.println("6) Vorgänge anzeigen");
|
||||
out.println("0) Beenden");
|
||||
out.print("Auswahl: ");
|
||||
}
|
||||
|
||||
// ---------------- Eingabe-Hilfen ----------------
|
||||
|
||||
private int readInt(String text) {
|
||||
while (true) {
|
||||
System.out.print(text);
|
||||
out.print(text);
|
||||
if (!scanner.hasNextLine()) return 0;
|
||||
String input = scanner.nextLine();
|
||||
|
||||
try {
|
||||
return Integer.parseInt(input.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
System.out.println("Bitte eine gültige Zahl eingeben.");
|
||||
out.println("Bitte eine gültige Zahl eingeben.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String readNonEmpty(String text) {
|
||||
while (true) {
|
||||
System.out.print(text);
|
||||
out.print(text);
|
||||
if (!scanner.hasNextLine()) return "";
|
||||
String value = scanner.nextLine().trim();
|
||||
|
||||
if (!value.isEmpty()) {
|
||||
return value;
|
||||
}
|
||||
|
||||
System.out.println("Eingabe darf nicht leer sein.");
|
||||
out.println("Eingabe darf nicht leer sein.");
|
||||
}
|
||||
}
|
||||
|
||||
private String readValidName(String text) {
|
||||
while (true) {
|
||||
String name = readNonEmpty(text);
|
||||
if (name.isEmpty()) return "";
|
||||
|
||||
if (name.matches("[a-zA-ZäöüÄÖÜß ]+")) {
|
||||
return name;
|
||||
}
|
||||
|
||||
System.out.println("Der Name darf nur Buchstaben enthalten.");
|
||||
out.println("Der Name darf nur Buchstaben enthalten.");
|
||||
}
|
||||
}
|
||||
|
||||
private String readPhoneNumber(String text) {
|
||||
while (true) {
|
||||
System.out.print(text);
|
||||
out.print(text);
|
||||
if (!scanner.hasNextLine()) return "";
|
||||
String phone = scanner.nextLine().trim();
|
||||
|
||||
if (phone.matches("\\d+")) {
|
||||
return phone;
|
||||
}
|
||||
|
||||
System.out.println("Telefonnummer darf nur Zahlen enthalten.");
|
||||
out.println("Telefonnummer darf nur Zahlen enthalten.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -118,30 +132,33 @@ public class ConsoleUi {
|
|||
String email = readNonEmpty("Email: ");
|
||||
String address = readNonEmpty("Adresse: ");
|
||||
|
||||
if (name.isEmpty() || phone.isEmpty() || email.isEmpty() || address.isEmpty()) return;
|
||||
|
||||
Person person = service.createPerson(name, phone, email, address);
|
||||
System.out.println("Kunde gespeichert (ID: " + person.getId() + ")");
|
||||
out.println("Kunde gespeichert (ID: " + person.getId() + ")");
|
||||
}
|
||||
|
||||
private void showPersons() throws SQLException {
|
||||
List<Person> persons = service.listPersons();
|
||||
|
||||
if (persons.isEmpty()) {
|
||||
System.out.println("Keine Kunden vorhanden.");
|
||||
out.println("Keine Kunden vorhanden.");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("\n--- Kundenliste ---");
|
||||
persons.forEach(System.out::println);
|
||||
out.println("\n--- Kundenliste ---");
|
||||
persons.forEach(p -> out.println(p));
|
||||
}
|
||||
|
||||
// ---------------- Fahrzeuge ----------------
|
||||
|
||||
private void addVehicle() throws SQLException {
|
||||
int personId = readInt("Personen-ID: ");
|
||||
if (personId == 0) return;
|
||||
Person person = service.findPerson(personId);
|
||||
|
||||
if (person == null) {
|
||||
System.out.println("Person wurde nicht gefunden.");
|
||||
out.println("Person wurde nicht gefunden.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -149,26 +166,29 @@ public class ConsoleUi {
|
|||
String model = readNonEmpty("Modell: ");
|
||||
String plate = readNonEmpty("Kennzeichen: ");
|
||||
|
||||
if (brand.isEmpty() || model.isEmpty() || plate.isEmpty()) return;
|
||||
|
||||
Vehicle vehicle = service.createVehicle(personId, brand, model, plate);
|
||||
System.out.println("Fahrzeug angelegt (ID: " + vehicle.getId() + ")");
|
||||
out.println("Fahrzeug angelegt (ID: " + vehicle.getId() + ")");
|
||||
}
|
||||
|
||||
private void showVehiclesOfPerson() throws SQLException {
|
||||
int personId = readInt("Personen-ID: ");
|
||||
if (personId == 0) return;
|
||||
Person person = service.findPerson(personId);
|
||||
|
||||
if (person == null) {
|
||||
System.out.println("Person nicht gefunden.");
|
||||
out.println("Person nicht gefunden.");
|
||||
return;
|
||||
}
|
||||
|
||||
List<Vehicle> vehicles = service.listVehicles(personId);
|
||||
|
||||
System.out.println("Fahrzeuge von " + person.getName() + ":");
|
||||
out.println("Fahrzeuge von " + person.getName() + ":");
|
||||
if (vehicles.isEmpty()) {
|
||||
System.out.println("Keine Fahrzeuge vorhanden.");
|
||||
out.println("Keine Fahrzeuge vorhanden.");
|
||||
} else {
|
||||
vehicles.forEach(System.out::println);
|
||||
vehicles.forEach(v -> out.println(v));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -176,10 +196,11 @@ public class ConsoleUi {
|
|||
|
||||
private void createWorkOrder() throws SQLException {
|
||||
int vehicleId = readInt("Fahrzeug-ID: ");
|
||||
if (vehicleId == 0) return;
|
||||
Vehicle vehicle = service.findVehicle(vehicleId);
|
||||
|
||||
if (vehicle == null) {
|
||||
System.out.println("Fahrzeug nicht gefunden.");
|
||||
out.println("Fahrzeug nicht gefunden.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -189,10 +210,11 @@ public class ConsoleUi {
|
|||
Map<Integer, Integer> selectedItems = new LinkedHashMap<>();
|
||||
|
||||
while (true) {
|
||||
System.out.println("\n--- Service-Katalog ---");
|
||||
catalog.forEach(System.out::println);
|
||||
out.println("\n--- Service-Katalog ---");
|
||||
catalog.forEach(item -> out.println(item));
|
||||
|
||||
System.out.print("Service-ID (leer = fertig): ");
|
||||
out.print("Service-ID (leer = fertig): ");
|
||||
if (!scanner.hasNextLine()) break;
|
||||
String input = scanner.nextLine().trim();
|
||||
|
||||
if (input.isEmpty()) {
|
||||
|
|
@ -203,23 +225,24 @@ public class ConsoleUi {
|
|||
try {
|
||||
serviceId = Integer.parseInt(input);
|
||||
} catch (NumberFormatException e) {
|
||||
System.out.println("Bitte eine gültige ID eingeben.");
|
||||
out.println("Bitte eine gültige ID eingeben.");
|
||||
continue;
|
||||
}
|
||||
|
||||
int finalServiceId = serviceId;
|
||||
ServiceItem item = catalog.stream()
|
||||
.filter(s -> s.getId() == serviceId)
|
||||
.filter(s -> s.getId() == finalServiceId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (item == null) {
|
||||
System.out.println("Service nicht gefunden.");
|
||||
out.println("Service nicht gefunden.");
|
||||
continue;
|
||||
}
|
||||
|
||||
int qty = readInt("Menge: ");
|
||||
if (qty <= 0) {
|
||||
System.out.println("Menge muss größer als 0 sein.");
|
||||
out.println("Menge muss größer als 0 sein.");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -227,39 +250,39 @@ public class ConsoleUi {
|
|||
}
|
||||
|
||||
if (selectedItems.isEmpty()) {
|
||||
System.out.println("Keine Positionen ausgewählt.");
|
||||
out.println("Keine Positionen ausgewählt.");
|
||||
return;
|
||||
}
|
||||
|
||||
int orderId = service.createWorkOrder(vehicleId, note, selectedItems);
|
||||
System.out.println("Vorgang wurde angelegt (ID: " + orderId + ")");
|
||||
out.println("Vorgang wurde angelegt (ID: " + orderId + ")");
|
||||
}
|
||||
|
||||
private void showWorkOrders() throws SQLException {
|
||||
List<WorkOrderDetails> orders = service.listWorkOrders();
|
||||
|
||||
if (orders.isEmpty()) {
|
||||
System.out.println("Keine Vorgänge vorhanden.");
|
||||
out.println("Keine Vorgänge vorhanden.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (WorkOrderDetails order : orders) {
|
||||
System.out.println("\n--- Vorgang " + order.getOrderId() + " ---");
|
||||
System.out.println("Kunde: " + order.getPersonName());
|
||||
System.out.println("Fahrzeug: " + order.getVehicleText());
|
||||
System.out.println("Datum: " + order.getCreatedAt());
|
||||
out.println("\n--- Vorgang " + order.getOrderId() + " ---");
|
||||
out.println("Kunde: " + order.getPersonName());
|
||||
out.println("Fahrzeug: " + order.getVehicleText());
|
||||
out.println("Datum: " + order.getCreatedAt());
|
||||
|
||||
if (order.getNote() != null && !order.getNote().isBlank()) {
|
||||
System.out.println("Notiz: " + order.getNote());
|
||||
out.println("Notiz: " + order.getNote());
|
||||
}
|
||||
|
||||
for (WorkOrderItem item : order.getItems()) {
|
||||
System.out.println(" - " + item.getServiceItem().getTitle() +
|
||||
out.println(" - " + item.getServiceItem().getTitle() +
|
||||
" x" + item.getQuantity() +
|
||||
" = " + item.getTotalPrice() + " €");
|
||||
}
|
||||
|
||||
System.out.println("Gesamtsumme: " + order.getTotal() + " €");
|
||||
out.println("Gesamtsumme: " + order.getTotal() + " €");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,20 +15,28 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
public class WorkshopService {
|
||||
private final PersonDao personDao = new PersonDao();
|
||||
private final VehicleDao vehicleDao = new VehicleDao();
|
||||
private final ServiceItemDao serviceItemDao = new ServiceItemDao();
|
||||
private final WorkOrderDao workOrderDao = new WorkOrderDao();
|
||||
private final PersonDao personDao;
|
||||
private final VehicleDao vehicleDao;
|
||||
private final ServiceItemDao serviceItemDao;
|
||||
private final WorkOrderDao workOrderDao;
|
||||
|
||||
public WorkshopService() {
|
||||
this(new PersonDao(), new VehicleDao(), new ServiceItemDao(), new WorkOrderDao());
|
||||
try {
|
||||
new SchemaCreator().ensureSchema();
|
||||
serviceItemDao.seedDefaultItems();
|
||||
this.serviceItemDao.seedDefaultItems();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Setup fehlgeschlagen: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public WorkshopService(PersonDao personDao, VehicleDao vehicleDao, ServiceItemDao serviceItemDao, WorkOrderDao workOrderDao) {
|
||||
this.personDao = personDao;
|
||||
this.vehicleDao = vehicleDao;
|
||||
this.serviceItemDao = serviceItemDao;
|
||||
this.workOrderDao = workOrderDao;
|
||||
}
|
||||
|
||||
public Person createPerson(String name, String phone, String email, String address) throws SQLException {
|
||||
return personDao.create(name, phone, email, address);
|
||||
}
|
||||
|
|
|
|||
35
src/test/java/de/antco/projekt/AppTest.java
Normal file
35
src/test/java/de/antco/projekt/AppTest.java
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package de.antco.projekt;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.MockedStatic;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Statement;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class AppTest {
|
||||
|
||||
@Test
|
||||
void testMain() throws Exception {
|
||||
try (MockedStatic<Database> db = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
Statement st = mock(Statement.class);
|
||||
|
||||
db.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.createStatement()).thenReturn(st);
|
||||
|
||||
// Mock System.in to exit immediately
|
||||
System.setIn(new ByteArrayInputStream("0\n".getBytes()));
|
||||
|
||||
// We need to ensure serviceItemDao.seedDefaultItems() doesn't fail
|
||||
// It uses Database.getConnection() too, and prepared statements.
|
||||
// It calls 'findAll' (select) and 'create' (insert).
|
||||
// This is getting complicated to mock everything for a full integration test.
|
||||
// But let's try basic mocking.
|
||||
|
||||
App.main(new String[]{});
|
||||
}
|
||||
}
|
||||
}
|
||||
183
src/test/java/de/antco/projekt/ConsoleUiTest.java
Normal file
183
src/test/java/de/antco/projekt/ConsoleUiTest.java
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
package de.antco.projekt;
|
||||
|
||||
import de.antco.projekt.model.*;
|
||||
import de.antco.projekt.service.WorkshopService;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class ConsoleUiTest {
|
||||
|
||||
@Mock
|
||||
private WorkshopService service;
|
||||
|
||||
private ByteArrayOutputStream outContent;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
outContent = new ByteArrayOutputStream();
|
||||
}
|
||||
|
||||
private ConsoleUi createUi(String input) {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8));
|
||||
return new ConsoleUi(service, in, new PrintStream(outContent));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExit() {
|
||||
ConsoleUi ui = createUi("0\n");
|
||||
ui.start();
|
||||
assertTrue(outContent.toString().contains("Programm beendet"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInvalidMenuOption() {
|
||||
ConsoleUi ui = createUi("99\n0\n");
|
||||
ui.start();
|
||||
assertTrue(outContent.toString().contains("Ungültige Eingabe"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAddPerson() throws SQLException {
|
||||
ConsoleUi ui = createUi("1\nMax\n123\nmail\naddr\n0\n");
|
||||
Person p = new Person(1, "Max", "123", "mail", "addr");
|
||||
when(service.createPerson("Max", "123", "mail", "addr")).thenReturn(p);
|
||||
ui.start();
|
||||
verify(service).createPerson("Max", "123", "mail", "addr");
|
||||
assertTrue(outContent.toString().contains("Kunde gespeichert"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testShowPersons() throws SQLException {
|
||||
ConsoleUi ui = createUi("2\n0\n");
|
||||
when(service.listPersons()).thenReturn(Collections.emptyList());
|
||||
ui.start();
|
||||
verify(service).listPersons();
|
||||
assertTrue(outContent.toString().contains("Keine Kunden vorhanden"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAddVehicle() throws SQLException {
|
||||
// 3 -> Person ID -> Brand -> Model -> Plate -> 0
|
||||
ConsoleUi ui = createUi("3\n1\nVW\nGolf\nABC\n0\n");
|
||||
Person p = new Person(1, "Max", "123", "m", "a");
|
||||
Vehicle v = new Vehicle(10, 1, "VW", "Golf", "ABC");
|
||||
|
||||
when(service.findPerson(1)).thenReturn(p);
|
||||
when(service.createVehicle(1, "VW", "Golf", "ABC")).thenReturn(v);
|
||||
|
||||
ui.start();
|
||||
assertTrue(outContent.toString().contains("Fahrzeug angelegt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAddVehiclePersonNotFound() throws SQLException {
|
||||
ConsoleUi ui = createUi("3\n99\n0\n");
|
||||
when(service.findPerson(99)).thenReturn(null);
|
||||
ui.start();
|
||||
assertTrue(outContent.toString().contains("Person wurde nicht gefunden"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testShowVehicles() throws SQLException {
|
||||
ConsoleUi ui = createUi("4\n1\n0\n");
|
||||
Person p = new Person(1, "Max", "123", "m", "a");
|
||||
when(service.findPerson(1)).thenReturn(p);
|
||||
when(service.listVehicles(1)).thenReturn(Collections.emptyList());
|
||||
|
||||
ui.start();
|
||||
assertTrue(outContent.toString().contains("Keine Fahrzeuge vorhanden"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateWorkOrder() throws SQLException {
|
||||
// 5 -> Vehicle ID -> Note -> Service ID -> Qty -> Empty (Finish) -> 0
|
||||
ConsoleUi ui = createUi("5\n10\nNote\n100\n2\n\n0\n");
|
||||
Vehicle v = new Vehicle(10, 1, "VW", "Golf", "ABC");
|
||||
ServiceItem item = new ServiceItem(100, "Oil", BigDecimal.TEN);
|
||||
|
||||
when(service.findVehicle(10)).thenReturn(v);
|
||||
when(service.listServiceItems()).thenReturn(List.of(item));
|
||||
when(service.createWorkOrder(eq(10), eq("Note"), anyMap())).thenReturn(555);
|
||||
|
||||
ui.start();
|
||||
assertTrue(outContent.toString().contains("Vorgang wurde angelegt (ID: 555)"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateWorkOrderServiceNotFoundAndInvalidQty() throws SQLException {
|
||||
// 5 -> Vehicle -> Note -> 999 (Invalid Service) -> 100 (Valid) -> -1 (Invalid Qty) -> 100 (Valid) -> 1 (Valid Qty) -> Finish -> 0
|
||||
ConsoleUi ui = createUi("5\n10\nNote\n999\n100\n-1\n100\n1\n\n0\n");
|
||||
Vehicle v = new Vehicle(10, 1, "VW", "Golf", "ABC");
|
||||
ServiceItem item = new ServiceItem(100, "Oil", BigDecimal.TEN);
|
||||
|
||||
when(service.findVehicle(10)).thenReturn(v);
|
||||
when(service.listServiceItems()).thenReturn(List.of(item));
|
||||
when(service.createWorkOrder(eq(10), eq("Note"), anyMap())).thenReturn(555);
|
||||
|
||||
ui.start();
|
||||
String output = outContent.toString();
|
||||
assertTrue(output.contains("Service nicht gefunden"));
|
||||
assertTrue(output.contains("Menge muss größer als 0 sein"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testShowWorkOrders() throws SQLException {
|
||||
ConsoleUi ui = createUi("6\n0\n");
|
||||
WorkOrderDetails wod = new WorkOrderDetails(1, "P", "V", LocalDateTime.now(), "N", Collections.emptyList(), BigDecimal.ZERO);
|
||||
when(service.listWorkOrders()).thenReturn(List.of(wod));
|
||||
|
||||
ui.start();
|
||||
assertTrue(outContent.toString().contains("Vorgang 1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSQLExceptionHandling() throws SQLException {
|
||||
ConsoleUi ui = createUi("2\n0\n");
|
||||
when(service.listPersons()).thenThrow(new SQLException("DB Error"));
|
||||
ui.start();
|
||||
assertTrue(outContent.toString().contains("Ein Fehler ist aufgetreten: DB Error"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInputValidation() throws SQLException {
|
||||
// 1 (Add Person)
|
||||
// Name: "123" (invalid) -> "Max" (valid)
|
||||
// Phone: "abc" (invalid) -> "123" (valid)
|
||||
// Email: "" (empty - loop) -> "mail"
|
||||
// Address: "addr"
|
||||
// 0 (Exit)
|
||||
|
||||
String input = "1\n123\nMax\nabc\n123\n\nmail\naddr\n0\n";
|
||||
ConsoleUi ui = createUi(input);
|
||||
|
||||
Person p = new Person(1, "Max", "123", "mail", "addr");
|
||||
when(service.createPerson("Max", "123", "mail", "addr")).thenReturn(p);
|
||||
|
||||
ui.start();
|
||||
|
||||
String output = outContent.toString();
|
||||
assertTrue(output.contains("Der Name darf nur Buchstaben enthalten"));
|
||||
assertTrue(output.contains("Telefonnummer darf nur Zahlen enthalten"));
|
||||
assertTrue(output.contains("Eingabe darf nicht leer sein"));
|
||||
assertTrue(output.contains("Kunde gespeichert"));
|
||||
}
|
||||
}
|
||||
84
src/test/java/de/antco/projekt/dao/PersonDaoTest.java
Normal file
84
src/test/java/de/antco/projekt/dao/PersonDaoTest.java
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
package de.antco.projekt.dao;
|
||||
|
||||
import de.antco.projekt.Database;
|
||||
import de.antco.projekt.model.Person;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.MockedStatic;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class PersonDaoTest {
|
||||
|
||||
@Test
|
||||
void testCreate() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
PreparedStatement ps = mock(PreparedStatement.class);
|
||||
ResultSet rs = mock(ResultSet.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.prepareStatement(anyString())).thenReturn(ps);
|
||||
when(ps.executeQuery()).thenReturn(rs);
|
||||
when(rs.next()).thenReturn(true);
|
||||
when(rs.getInt("id")).thenReturn(1);
|
||||
|
||||
PersonDao dao = new PersonDao();
|
||||
Person p = dao.create("Name", "Phone", "Email", "Addr");
|
||||
|
||||
assertNotNull(p);
|
||||
assertEquals("Name", p.getName());
|
||||
verify(ps).setString(1, "Name");
|
||||
verify(ps).setString(2, "Phone");
|
||||
verify(ps).setString(3, "Email");
|
||||
verify(ps).setString(4, "Addr");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFindAll() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
PreparedStatement ps = mock(PreparedStatement.class);
|
||||
ResultSet rs = mock(ResultSet.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.prepareStatement(anyString())).thenReturn(ps);
|
||||
when(ps.executeQuery()).thenReturn(rs);
|
||||
// Return true once, then false
|
||||
when(rs.next()).thenReturn(true).thenReturn(false);
|
||||
when(rs.getInt("id")).thenReturn(1);
|
||||
when(rs.getString("name")).thenReturn("Name");
|
||||
when(rs.getString("phone")).thenReturn("Phone");
|
||||
when(rs.getString("email")).thenReturn("Email");
|
||||
when(rs.getString("address")).thenReturn("Address");
|
||||
|
||||
PersonDao dao = new PersonDao();
|
||||
assertEquals(1, dao.findAll().size());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFindById() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
PreparedStatement ps = mock(PreparedStatement.class);
|
||||
ResultSet rs = mock(ResultSet.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.prepareStatement(anyString())).thenReturn(ps);
|
||||
when(ps.executeQuery()).thenReturn(rs);
|
||||
when(rs.next()).thenReturn(true);
|
||||
when(rs.getInt("id")).thenReturn(1);
|
||||
when(rs.getString("name")).thenReturn("Name");
|
||||
|
||||
PersonDao dao = new PersonDao();
|
||||
assertNotNull(dao.findById(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/test/java/de/antco/projekt/dao/SchemaCreatorTest.java
Normal file
29
src/test/java/de/antco/projekt/dao/SchemaCreatorTest.java
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package de.antco.projekt.dao;
|
||||
|
||||
import de.antco.projekt.Database;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.MockedStatic;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.Statement;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class SchemaCreatorTest {
|
||||
|
||||
@Test
|
||||
void testEnsureSchema() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
Statement st = mock(Statement.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.createStatement()).thenReturn(st);
|
||||
|
||||
SchemaCreator creator = new SchemaCreator();
|
||||
creator.ensureSchema();
|
||||
|
||||
verify(st, atLeastOnce()).execute(anyString());
|
||||
}
|
||||
}
|
||||
}
|
||||
96
src/test/java/de/antco/projekt/dao/ServiceItemDaoTest.java
Normal file
96
src/test/java/de/antco/projekt/dao/ServiceItemDaoTest.java
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
package de.antco.projekt.dao;
|
||||
|
||||
import de.antco.projekt.Database;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.MockedStatic;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class ServiceItemDaoTest {
|
||||
|
||||
@Test
|
||||
void testFindAll() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
PreparedStatement ps = mock(PreparedStatement.class);
|
||||
ResultSet rs = mock(ResultSet.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.prepareStatement(anyString())).thenReturn(ps);
|
||||
when(ps.executeQuery()).thenReturn(rs);
|
||||
when(rs.next()).thenReturn(false);
|
||||
|
||||
ServiceItemDao dao = new ServiceItemDao();
|
||||
assertTrue(dao.findAll().isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSeedDefaultItems() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
PreparedStatement psCount = mock(PreparedStatement.class);
|
||||
PreparedStatement psInsert = mock(PreparedStatement.class);
|
||||
ResultSet rsCount = mock(ResultSet.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.prepareStatement(contains("SELECT COUNT"))).thenReturn(psCount);
|
||||
when(conn.prepareStatement(contains("INSERT"))).thenReturn(psInsert);
|
||||
|
||||
when(psCount.executeQuery()).thenReturn(rsCount);
|
||||
when(rsCount.next()).thenReturn(true);
|
||||
when(rsCount.getInt(1)).thenReturn(0); // Count 0 -> Insert
|
||||
|
||||
ServiceItemDao dao = new ServiceItemDao();
|
||||
dao.seedDefaultItems();
|
||||
|
||||
verify(psInsert, atLeastOnce()).executeUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFindAllWithData() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
PreparedStatement ps = mock(PreparedStatement.class);
|
||||
ResultSet rs = mock(ResultSet.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.prepareStatement(anyString())).thenReturn(ps);
|
||||
when(ps.executeQuery()).thenReturn(rs);
|
||||
when(rs.next()).thenReturn(true).thenReturn(false);
|
||||
when(rs.getInt("id")).thenReturn(1);
|
||||
when(rs.getString("title")).thenReturn("T");
|
||||
when(rs.getBigDecimal("price")).thenReturn(java.math.BigDecimal.ONE);
|
||||
|
||||
ServiceItemDao dao = new ServiceItemDao();
|
||||
assertEquals(1, dao.findAll().size());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFindById() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
PreparedStatement ps = mock(PreparedStatement.class);
|
||||
ResultSet rs = mock(ResultSet.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.prepareStatement(anyString())).thenReturn(ps);
|
||||
when(ps.executeQuery()).thenReturn(rs);
|
||||
when(rs.next()).thenReturn(true);
|
||||
when(rs.getInt("id")).thenReturn(1);
|
||||
when(rs.getString("title")).thenReturn("T");
|
||||
when(rs.getBigDecimal("price")).thenReturn(java.math.BigDecimal.TEN);
|
||||
|
||||
ServiceItemDao dao = new ServiceItemDao();
|
||||
assertNotNull(dao.findById(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
64
src/test/java/de/antco/projekt/dao/VehicleDaoTest.java
Normal file
64
src/test/java/de/antco/projekt/dao/VehicleDaoTest.java
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
package de.antco.projekt.dao;
|
||||
|
||||
import de.antco.projekt.Database;
|
||||
import de.antco.projekt.model.Vehicle;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.MockedStatic;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class VehicleDaoTest {
|
||||
|
||||
@Test
|
||||
void testCreate() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
PreparedStatement ps = mock(PreparedStatement.class);
|
||||
ResultSet rs = mock(ResultSet.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.prepareStatement(anyString())).thenReturn(ps);
|
||||
when(ps.executeQuery()).thenReturn(rs);
|
||||
when(rs.next()).thenReturn(true);
|
||||
when(rs.getInt("id")).thenReturn(10);
|
||||
|
||||
VehicleDao dao = new VehicleDao();
|
||||
Vehicle v = dao.create(1, "B", "M", "P");
|
||||
|
||||
assertEquals(10, v.getId());
|
||||
verify(ps).setInt(1, 1);
|
||||
verify(ps).setString(2, "B");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFind() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
PreparedStatement ps = mock(PreparedStatement.class);
|
||||
ResultSet rs = mock(ResultSet.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.prepareStatement(anyString())).thenReturn(ps);
|
||||
when(ps.executeQuery()).thenReturn(rs);
|
||||
|
||||
// findByPerson (1 row, then end), then findById (1 row)
|
||||
when(rs.next()).thenReturn(true, false, true);
|
||||
when(rs.getInt("id")).thenReturn(10);
|
||||
when(rs.getInt("person_id")).thenReturn(1);
|
||||
when(rs.getString("brand")).thenReturn("B");
|
||||
when(rs.getString("model")).thenReturn("M");
|
||||
when(rs.getString("plate")).thenReturn("P");
|
||||
|
||||
VehicleDao dao = new VehicleDao();
|
||||
assertEquals(1, dao.findByPerson(1).size());
|
||||
assertNotNull(dao.findById(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
82
src/test/java/de/antco/projekt/dao/WorkOrderDaoTest.java
Normal file
82
src/test/java/de/antco/projekt/dao/WorkOrderDaoTest.java
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
package de.antco.projekt.dao;
|
||||
|
||||
import de.antco.projekt.Database;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.MockedStatic;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class WorkOrderDaoTest {
|
||||
|
||||
@Test
|
||||
void testCreateWorkOrder() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
PreparedStatement ps = mock(PreparedStatement.class);
|
||||
ResultSet rs = mock(ResultSet.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
when(conn.prepareStatement(anyString())).thenReturn(ps); // For INSERT work_order
|
||||
// We need to handle multiple prepareStatement calls if possible, or relax verification
|
||||
|
||||
// First PS (WorkOrder)
|
||||
when(ps.executeQuery()).thenReturn(rs);
|
||||
when(rs.next()).thenReturn(true);
|
||||
when(rs.getInt("id")).thenReturn(100); // New Order ID
|
||||
|
||||
WorkOrderDao dao = new WorkOrderDao();
|
||||
int id = dao.createWorkOrder(1, "Note", java.util.Map.of(1, 1));
|
||||
assertEquals(100, id);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateWorkOrderEmptyItems() {
|
||||
WorkOrderDao dao = new WorkOrderDao();
|
||||
assertThrows(IllegalArgumentException.class, () -> dao.createWorkOrder(1, "Note", Collections.emptyMap()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFetchAllDetails() throws Exception {
|
||||
try (MockedStatic<Database> mockedDb = mockStatic(Database.class)) {
|
||||
Connection conn = mock(Connection.class);
|
||||
PreparedStatement psItems = mock(PreparedStatement.class);
|
||||
PreparedStatement psOrders = mock(PreparedStatement.class);
|
||||
ResultSet rsItems = mock(ResultSet.class);
|
||||
ResultSet rsOrders = mock(ResultSet.class);
|
||||
|
||||
mockedDb.when(Database::getConnection).thenReturn(conn);
|
||||
|
||||
// loadItems calls prepareStatement first, then fetchAllDetails calls it.
|
||||
when(conn.prepareStatement(anyString()))
|
||||
.thenReturn(psItems)
|
||||
.thenReturn(psOrders);
|
||||
|
||||
when(psItems.executeQuery()).thenReturn(rsItems);
|
||||
when(psOrders.executeQuery()).thenReturn(rsOrders);
|
||||
|
||||
// No items
|
||||
when(rsItems.next()).thenReturn(false);
|
||||
|
||||
// One order
|
||||
when(rsOrders.next()).thenReturn(true).thenReturn(false);
|
||||
when(rsOrders.getInt("id")).thenReturn(1);
|
||||
when(rsOrders.getString("person_name")).thenReturn("P");
|
||||
when(rsOrders.getString("brand")).thenReturn("B");
|
||||
when(rsOrders.getString("model")).thenReturn("M");
|
||||
when(rsOrders.getString("plate")).thenReturn("Pl");
|
||||
when(rsOrders.getString("note")).thenReturn("N");
|
||||
when(rsOrders.getTimestamp("created_at")).thenReturn(java.sql.Timestamp.valueOf(java.time.LocalDateTime.now()));
|
||||
|
||||
WorkOrderDao dao = new WorkOrderDao();
|
||||
assertFalse(dao.fetchAllDetails().isEmpty());
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/test/java/de/antco/projekt/model/ServiceItemTest.java
Normal file
23
src/test/java/de/antco/projekt/model/ServiceItemTest.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package de.antco.projekt.model;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.math.BigDecimal;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class ServiceItemTest {
|
||||
@Test
|
||||
void testConstructorAndGetters() {
|
||||
ServiceItem item = new ServiceItem(1, "Test Service", new BigDecimal("99.99"));
|
||||
assertEquals(1, item.getId());
|
||||
assertEquals("Test Service", item.getTitle());
|
||||
assertEquals(new BigDecimal("99.99"), item.getPrice());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testToString() {
|
||||
ServiceItem item = new ServiceItem(1, "Test Service", new BigDecimal("99.99"));
|
||||
String s = item.toString();
|
||||
assertTrue(s.contains("Test Service"));
|
||||
assertTrue(s.contains("99.99"));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package de.antco.projekt.model;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class WorkOrderDetailsTest {
|
||||
@Test
|
||||
void testConstructorAndGetters() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
WorkOrderDetails details = new WorkOrderDetails(1, "Person", "Vehicle", now, "Note", Collections.emptyList(), BigDecimal.ZERO);
|
||||
|
||||
assertEquals(1, details.getOrderId());
|
||||
assertEquals("Person", details.getPersonName());
|
||||
assertEquals("Vehicle", details.getVehicleText());
|
||||
assertEquals(now, details.getCreatedAt());
|
||||
assertEquals("Note", details.getNote());
|
||||
assertTrue(details.getItems().isEmpty());
|
||||
assertEquals(BigDecimal.ZERO, details.getTotal());
|
||||
}
|
||||
}
|
||||
19
src/test/java/de/antco/projekt/model/WorkOrderItemTest.java
Normal file
19
src/test/java/de/antco/projekt/model/WorkOrderItemTest.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package de.antco.projekt.model;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.math.BigDecimal;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class WorkOrderItemTest {
|
||||
@Test
|
||||
void testConstructorAndGetters() {
|
||||
ServiceItem item = new ServiceItem(1, "Service", new BigDecimal("10.00"));
|
||||
WorkOrderItem woi = new WorkOrderItem(10, 20, item, 3);
|
||||
|
||||
assertEquals(10, woi.getId());
|
||||
assertEquals(20, woi.getWorkOrderId());
|
||||
assertEquals(item, woi.getServiceItem());
|
||||
assertEquals(3, woi.getQuantity());
|
||||
assertEquals(new BigDecimal("30.00"), woi.getTotalPrice());
|
||||
}
|
||||
}
|
||||
17
src/test/java/de/antco/projekt/model/WorkOrderTest.java
Normal file
17
src/test/java/de/antco/projekt/model/WorkOrderTest.java
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package de.antco.projekt.model;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.time.LocalDateTime;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class WorkOrderTest {
|
||||
@Test
|
||||
void testConstructorAndGetters() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
WorkOrder wo = new WorkOrder(1, 2, "Note", now);
|
||||
assertEquals(1, wo.getId());
|
||||
assertEquals(2, wo.getVehicleId());
|
||||
assertEquals("Note", wo.getNote());
|
||||
assertEquals(now, wo.getCreatedAt());
|
||||
}
|
||||
}
|
||||
116
src/test/java/de/antco/projekt/service/WorkshopServiceTest.java
Normal file
116
src/test/java/de/antco/projekt/service/WorkshopServiceTest.java
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
package de.antco.projekt.service;
|
||||
|
||||
import de.antco.projekt.dao.PersonDao;
|
||||
import de.antco.projekt.dao.ServiceItemDao;
|
||||
import de.antco.projekt.dao.VehicleDao;
|
||||
import de.antco.projekt.dao.WorkOrderDao;
|
||||
import de.antco.projekt.model.Person;
|
||||
import de.antco.projekt.model.ServiceItem;
|
||||
import de.antco.projekt.model.Vehicle;
|
||||
import de.antco.projekt.model.WorkOrderDetails;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class WorkshopServiceTest {
|
||||
|
||||
@Mock
|
||||
private PersonDao personDao;
|
||||
@Mock
|
||||
private VehicleDao vehicleDao;
|
||||
@Mock
|
||||
private ServiceItemDao serviceItemDao;
|
||||
@Mock
|
||||
private WorkOrderDao workOrderDao;
|
||||
|
||||
private WorkshopService service;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
service = new WorkshopService(personDao, vehicleDao, serviceItemDao, workOrderDao);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreatePerson() throws SQLException {
|
||||
Person expected = new Person(1, "Name", "123", "a", "b");
|
||||
when(personDao.create("Name", "123", "a", "b")).thenReturn(expected);
|
||||
|
||||
Person actual = service.createPerson("Name", "123", "a", "b");
|
||||
assertEquals(expected, actual);
|
||||
verify(personDao).create("Name", "123", "a", "b");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testListPersons() throws SQLException {
|
||||
List<Person> list = Collections.singletonList(new Person(1, "N", "P", "E", "A"));
|
||||
when(personDao.findAll()).thenReturn(list);
|
||||
|
||||
assertEquals(list, service.listPersons());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateVehicle() throws SQLException {
|
||||
Vehicle expected = new Vehicle(1, 1, "B", "M", "P");
|
||||
when(vehicleDao.create(1, "B", "M", "P")).thenReturn(expected);
|
||||
|
||||
assertEquals(expected, service.createVehicle(1, "B", "M", "P"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testListVehicles() throws SQLException {
|
||||
List<Vehicle> list = Collections.emptyList();
|
||||
when(vehicleDao.findByPerson(1)).thenReturn(list);
|
||||
|
||||
assertEquals(list, service.listVehicles(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testListServiceItems() throws SQLException {
|
||||
List<ServiceItem> list = Collections.singletonList(new ServiceItem(1, "T", BigDecimal.TEN));
|
||||
when(serviceItemDao.findAll()).thenReturn(list);
|
||||
|
||||
assertEquals(list, service.listServiceItems());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateWorkOrder() throws SQLException {
|
||||
Map<Integer, Integer> items = Map.of(1, 2);
|
||||
when(workOrderDao.createWorkOrder(10, "Note", items)).thenReturn(55);
|
||||
|
||||
assertEquals(55, service.createWorkOrder(10, "Note", items));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testListWorkOrders() throws SQLException {
|
||||
List<WorkOrderDetails> list = Collections.emptyList();
|
||||
when(workOrderDao.fetchAllDetails()).thenReturn(list);
|
||||
|
||||
assertEquals(list, service.listWorkOrders());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFindPerson() throws SQLException {
|
||||
Person p = new Person(1, "N", "P", "E", "A");
|
||||
when(personDao.findById(1)).thenReturn(p);
|
||||
assertEquals(p, service.findPerson(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFindVehicle() throws SQLException {
|
||||
Vehicle v = new Vehicle(1, 1, "B", "M", "P");
|
||||
when(vehicleDao.findById(1)).thenReturn(v);
|
||||
assertEquals(v, service.findVehicle(1));
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,5 +0,0 @@
|
|||
#Generated by Maven
|
||||
#Thu Dec 11 10:07:13 CET 2025
|
||||
artifactId=jdbc-konsolen-projekt
|
||||
groupId=de.antco
|
||||
version=1.0-SNAPSHOT
|
||||
|
|
@ -8,6 +8,7 @@ de/antco/projekt/model/WorkOrderDetails.class
|
|||
de/antco/projekt/model/WorkOrderItem.class
|
||||
de/antco/projekt/exporters/IExporter.class
|
||||
de/antco/projekt/dao/WorkOrderDao.class
|
||||
de/antco/projekt/loggers/ILogger.class
|
||||
de/antco/projekt/dao/ServiceItemDao.class
|
||||
de/antco/projekt/service/WorkshopService.class
|
||||
de/antco/projekt/dao/VehicleDao.class
|
||||
|
|
|
|||
|
|
@ -1,4 +1,16 @@
|
|||
de/antco/projekt/importers/CsvPersonImporterTest.class
|
||||
de/antco/projekt/dao/ServiceItemDaoTest.class
|
||||
de/antco/projekt/ConsoleUiTest.class
|
||||
de/antco/projekt/dao/WorkOrderDaoTest.class
|
||||
de/antco/projekt/model/WorkOrderItemTest.class
|
||||
de/antco/projekt/exporters/CsvPersonExporterTest.class
|
||||
de/antco/projekt/model/PersonTest.class
|
||||
de/antco/projekt/importers/CsvPersonImporterTest.class
|
||||
de/antco/projekt/model/WorkOrderTest.class
|
||||
de/antco/projekt/model/ServiceItemTest.class
|
||||
de/antco/projekt/model/WorkOrderDetailsTest.class
|
||||
de/antco/projekt/model/VehicleTest.class
|
||||
de/antco/projekt/AppTest.class
|
||||
de/antco/projekt/dao/VehicleDaoTest.class
|
||||
de/antco/projekt/dao/SchemaCreatorTest.class
|
||||
de/antco/projekt/service/WorkshopServiceTest.class
|
||||
de/antco/projekt/model/PersonTest.class
|
||||
de/antco/projekt/dao/PersonDaoTest.class
|
||||
|
|
|
|||
|
|
@ -1,4 +1,16 @@
|
|||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/model/VehicleTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/exporters/CsvPersonExporterTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/importers/CsvPersonImporterTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/ConsoleUiTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/dao/PersonDaoTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/dao/VehicleDaoTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/model/WorkOrderDetailsTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/model/WorkOrderTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/AppTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/service/WorkshopServiceTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/model/WorkOrderItemTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/exporters/CsvPersonExporterTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/model/PersonTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/dao/WorkOrderDaoTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/dao/ServiceItemDaoTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/dao/SchemaCreatorTest.java
|
||||
/config/workspace/SchuleB/jdbc_konsolen_projekt/src/test/java/de/antco/projekt/model/ServiceItemTest.java
|
||||
|
|
|
|||
|
|
@ -1,20 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="de.antco.projekt.exporters.CsvPersonExporterTest" time="0.313" tests="1" errors="0" skipped="0" failures="0">
|
||||
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="de.antco.projekt.exporters.CsvPersonExporterTest" time="0.108" tests="1" errors="0" skipped="0" failures="0">
|
||||
<properties>
|
||||
<property name="java.specification.version" value="21"/>
|
||||
<property name="sun.jnu.encoding" value="UTF-8"/>
|
||||
<property name="java.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/test-classes:/config/workspace/SchuleB/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:"/>
|
||||
<property name="java.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/test-classes:/config/workspace/SchuleB/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:/config/.m2/repository/org/mockito/mockito-core/5.11.0/mockito-core-5.11.0.jar:/config/.m2/repository/net/bytebuddy/byte-buddy/1.14.12/byte-buddy-1.14.12.jar:/config/.m2/repository/net/bytebuddy/byte-buddy-agent/1.14.12/byte-buddy-agent-1.14.12.jar:/config/.m2/repository/org/objenesis/objenesis/3.3/objenesis-3.3.jar:/config/.m2/repository/org/mockito/mockito-junit-jupiter/5.11.0/mockito-junit-jupiter-5.11.0.jar:"/>
|
||||
<property name="java.vm.vendor" value="Ubuntu"/>
|
||||
<property name="sun.arch.data.model" value="64"/>
|
||||
<property name="java.vendor.url" value="https://ubuntu.com/"/>
|
||||
<property name="user.timezone" value="Europe/Berlin"/>
|
||||
<property name="os.name" value="Linux"/>
|
||||
<property name="java.vm.specification.version" value="21"/>
|
||||
<property name="sun.java.launcher" value="SUN_STANDARD"/>
|
||||
<property name="user.country" value="US"/>
|
||||
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-21-openjdk-amd64/lib"/>
|
||||
<property name="sun.java.command" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211121627585_3.jar /config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire 2025-12-11T12-16-27_250-jvmRun1 surefire-20251211121627585_1tmp surefire_0-20251211121627585_2tmp"/>
|
||||
<property name="sun.java.command" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211123619406_3.jar /config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire 2025-12-11T12-36-19_171-jvmRun1 surefire-20251211123619406_1tmp surefire_0-20251211123619406_2tmp"/>
|
||||
<property name="jdk.debug" value="release"/>
|
||||
<property name="surefire.test.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/test-classes:/config/workspace/SchuleB/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:"/>
|
||||
<property name="surefire.test.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/test-classes:/config/workspace/SchuleB/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:/config/.m2/repository/org/mockito/mockito-core/5.11.0/mockito-core-5.11.0.jar:/config/.m2/repository/net/bytebuddy/byte-buddy/1.14.12/byte-buddy-1.14.12.jar:/config/.m2/repository/net/bytebuddy/byte-buddy-agent/1.14.12/byte-buddy-agent-1.14.12.jar:/config/.m2/repository/org/objenesis/objenesis/3.3/objenesis-3.3.jar:/config/.m2/repository/org/mockito/mockito-junit-jupiter/5.11.0/mockito-junit-jupiter-5.11.0.jar:"/>
|
||||
<property name="sun.cpu.endian" value="little"/>
|
||||
<property name="user.home" value="/config"/>
|
||||
<property name="user.language" value="en"/>
|
||||
|
|
@ -27,7 +28,7 @@
|
|||
<property name="line.separator" value=" "/>
|
||||
<property name="java.specification.name" value="Java Platform API Specification"/>
|
||||
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
|
||||
<property name="surefire.real.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211121627585_3.jar"/>
|
||||
<property name="surefire.real.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211123619406_3.jar"/>
|
||||
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
|
||||
<property name="java.runtime.version" value="21.0.9+10-Ubuntu-124.04"/>
|
||||
<property name="user.name" value="abc"/>
|
||||
|
|
@ -53,5 +54,5 @@
|
|||
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
|
||||
<property name="java.class.version" value="65.0"/>
|
||||
</properties>
|
||||
<testcase name="testExport" classname="de.antco.projekt.exporters.CsvPersonExporterTest" time="0.182"/>
|
||||
<testcase name="testExport" classname="de.antco.projekt.exporters.CsvPersonExporterTest" time="0.097"/>
|
||||
</testsuite>
|
||||
|
|
@ -1,20 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="de.antco.projekt.importers.CsvPersonImporterTest" time="0.032" tests="1" errors="0" skipped="0" failures="0">
|
||||
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="de.antco.projekt.importers.CsvPersonImporterTest" time="0.008" tests="1" errors="0" skipped="0" failures="0">
|
||||
<properties>
|
||||
<property name="java.specification.version" value="21"/>
|
||||
<property name="sun.jnu.encoding" value="UTF-8"/>
|
||||
<property name="java.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/test-classes:/config/workspace/SchuleB/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:"/>
|
||||
<property name="java.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/test-classes:/config/workspace/SchuleB/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:/config/.m2/repository/org/mockito/mockito-core/5.11.0/mockito-core-5.11.0.jar:/config/.m2/repository/net/bytebuddy/byte-buddy/1.14.12/byte-buddy-1.14.12.jar:/config/.m2/repository/net/bytebuddy/byte-buddy-agent/1.14.12/byte-buddy-agent-1.14.12.jar:/config/.m2/repository/org/objenesis/objenesis/3.3/objenesis-3.3.jar:/config/.m2/repository/org/mockito/mockito-junit-jupiter/5.11.0/mockito-junit-jupiter-5.11.0.jar:"/>
|
||||
<property name="java.vm.vendor" value="Ubuntu"/>
|
||||
<property name="sun.arch.data.model" value="64"/>
|
||||
<property name="java.vendor.url" value="https://ubuntu.com/"/>
|
||||
<property name="user.timezone" value="Europe/Berlin"/>
|
||||
<property name="os.name" value="Linux"/>
|
||||
<property name="java.vm.specification.version" value="21"/>
|
||||
<property name="sun.java.launcher" value="SUN_STANDARD"/>
|
||||
<property name="user.country" value="US"/>
|
||||
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-21-openjdk-amd64/lib"/>
|
||||
<property name="sun.java.command" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211121627585_3.jar /config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire 2025-12-11T12-16-27_250-jvmRun1 surefire-20251211121627585_1tmp surefire_0-20251211121627585_2tmp"/>
|
||||
<property name="sun.java.command" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211123619406_3.jar /config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire 2025-12-11T12-36-19_171-jvmRun1 surefire-20251211123619406_1tmp surefire_0-20251211123619406_2tmp"/>
|
||||
<property name="jdk.debug" value="release"/>
|
||||
<property name="surefire.test.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/test-classes:/config/workspace/SchuleB/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:"/>
|
||||
<property name="surefire.test.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/test-classes:/config/workspace/SchuleB/jdbc_konsolen_projekt/target/classes:/config/.m2/repository/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar:/config/.m2/repository/org/checkerframework/checker-qual/3.42.0/checker-qual-3.42.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/config/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/config/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar:/config/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar:/config/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:/config/.m2/repository/org/mockito/mockito-core/5.11.0/mockito-core-5.11.0.jar:/config/.m2/repository/net/bytebuddy/byte-buddy/1.14.12/byte-buddy-1.14.12.jar:/config/.m2/repository/net/bytebuddy/byte-buddy-agent/1.14.12/byte-buddy-agent-1.14.12.jar:/config/.m2/repository/org/objenesis/objenesis/3.3/objenesis-3.3.jar:/config/.m2/repository/org/mockito/mockito-junit-jupiter/5.11.0/mockito-junit-jupiter-5.11.0.jar:"/>
|
||||
<property name="sun.cpu.endian" value="little"/>
|
||||
<property name="user.home" value="/config"/>
|
||||
<property name="user.language" value="en"/>
|
||||
|
|
@ -27,7 +28,7 @@
|
|||
<property name="line.separator" value=" "/>
|
||||
<property name="java.specification.name" value="Java Platform API Specification"/>
|
||||
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
|
||||
<property name="surefire.real.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211121627585_3.jar"/>
|
||||
<property name="surefire.real.class.path" value="/config/workspace/SchuleB/jdbc_konsolen_projekt/target/surefire/surefirebooter-20251211123619406_3.jar"/>
|
||||
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
|
||||
<property name="java.runtime.version" value="21.0.9+10-Ubuntu-124.04"/>
|
||||
<property name="user.name" value="abc"/>
|
||||
|
|
@ -53,5 +54,5 @@
|
|||
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
|
||||
<property name="java.class.version" value="65.0"/>
|
||||
</properties>
|
||||
<testcase name="testImport" classname="de.antco.projekt.importers.CsvPersonImporterTest" time="0.025"/>
|
||||
<testcase name="testImport" classname="de.antco.projekt.importers.CsvPersonImporterTest" time="0.005"/>
|
||||
</testsuite>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
-------------------------------------------------------------------------------
|
||||
Test set: de.antco.projekt.exporters.CsvPersonExporterTest
|
||||
-------------------------------------------------------------------------------
|
||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.313 s -- in de.antco.projekt.exporters.CsvPersonExporterTest
|
||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.108 s -- in de.antco.projekt.exporters.CsvPersonExporterTest
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
-------------------------------------------------------------------------------
|
||||
Test set: de.antco.projekt.importers.CsvPersonImporterTest
|
||||
-------------------------------------------------------------------------------
|
||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032 s -- in de.antco.projekt.importers.CsvPersonImporterTest
|
||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 s -- in de.antco.projekt.importers.CsvPersonImporterTest
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue