Skip to content

Commit

Permalink
test(TasksData): Add unit tests
Browse files Browse the repository at this point in the history
Implemented unit tests for the TasksData class to ensure the correctness of the setReplaceMessage, getReplaceMessage, setReplaceCount, and getReplaceCount methods. These tests cover basic functionality to verify that the methods correctly set and retrieve replace messages and counts.

Rationale:
The TasksData class contains important functionality related to task data management in the application. To ensure the reliability and correctness of this class, unit tests have been added to validate its key methods. These tests provide confidence that the class behaves as expected and help maintain code quality by detecting potential regressions or bugs during development or refactoring.
  • Loading branch information
RalfBarkow committed Apr 30, 2024
1 parent 98f924d commit 36ad1f8
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package de.danielluedecke.zettelkasten.database;

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import java.util.LinkedList;

public class TasksDataTest {

@Test
void testSetReplaceMessageAndGetReplaceMessage() {
// Test setting and getting replace message
// Arrange
TasksData tasksData = new TasksData();
String expectedMessage = "Test message";

// Act
tasksData.setReplaceMessage(expectedMessage);
String actualMessage = tasksData.getReplaceMessage();

// Assert
assertEquals(expectedMessage, actualMessage);
}

@Test
void testSetReplaceCountAndGetReplaceCount() {
// Test setting and getting replace count
// Arrange
TasksData tasksData = new TasksData();
int expectedCount = 10;

// Act
tasksData.setReplaceCount(expectedCount);
int actualCount = tasksData.getReplaceCount();

// Assert
assertEquals(expectedCount, actualCount);
}

// Add more test methods to cover other methods in TasksData class

}

0 comments on commit 36ad1f8

Please sign in to comment.