Skip to content

Commit

Permalink
#500 migrate tests to integration to allow regular tests to run
Browse files Browse the repository at this point in the history
  • Loading branch information
davetcc committed Sep 7, 2024
1 parent 9e8a64b commit 63e6066
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.thecoderscorner.menu.editorui.project;
package com.thecoderscorner.menu.uitests;

import com.thecoderscorner.menu.editorui.project.TccProjectWatcher;
import com.thecoderscorner.menu.editorui.project.TccProjectWatcherImpl;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -14,19 +16,19 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import static com.thecoderscorner.menu.editorui.project.TccProjectWatcherImplTest.TestProjectWatchListener.TestProjectWatchType.*;
import static com.thecoderscorner.menu.uitests.TccProjectWatcherImplTest.TestProjectWatchListener.TestProjectWatchType.*;
import static org.junit.jupiter.api.Assertions.assertEquals;

@ExtendWith(ApplicationExtension.class)
class TccProjectWatcherImplTest {
public class TccProjectWatcherImplTest {
private TccProjectWatcherImpl fileWatcher;
private TestProjectWatchListener listener;
private Path rootDir;
private Path emfFile;
private Path propFile1, propFile2;

@BeforeEach
void setUp() throws IOException {
public void setUp() throws IOException {
rootDir = Files.createTempDirectory("tcmenutest");
Files.createDirectories(rootDir);
Path i18nDir = rootDir.resolve("i18n");
Expand All @@ -46,7 +48,7 @@ void setUp() throws IOException {
}

@AfterEach
void tearDown() throws IOException {
public void tearDown() throws IOException {
Files.walk(rootDir)
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
Expand All @@ -55,21 +57,21 @@ void tearDown() throws IOException {
}

@Test
void testEmfFileWatching() throws Exception {
public void testEmfFileWatching() throws Exception {
listener.reset();
Files.writeString(emfFile, "File has changed");
assertEquals(EMF_FILE_NOTIFIED, listener.waitForEvent());
}

@Test
void testI18nFileWatching() throws Exception {
public void testI18nFileWatching() throws Exception {
listener.reset();
Files.writeString(propFile1, "propery.1=abcdefghi");
assertEquals(I18N_NOTIFIED, listener.waitForEvent());
}

@Test
void testWhereThereIsNoChange() throws Exception {
public void testWhereThereIsNoChange() throws Exception {
fileWatcher.fileWasSaved(propFile2.getFileName(), "property.1=bonjour");
listener.reset();
Files.writeString(propFile2, "property.1=bonjour");
Expand Down

0 comments on commit 63e6066

Please sign in to comment.