From fc48aa17e9cb7373d977d4456be8967d9c5f15f6 Mon Sep 17 00:00:00 2001 From: Peter Dell Date: Tue, 27 Dec 2022 00:38:05 +0100 Subject: [PATCH] Add walking skelton for GraphicsPluginTest and Assertions --- .../com/wudsn/ide/base/common/Assertions.java | 36 +++ .../src/com/wudsn/ide/base/common/Test.java | 13 + com.wudsn.ide.gfx/META-INF/MANIFEST.MF | 4 +- .../WUDSN-IDE - Graphics Plugin Tests.launch | 46 ---- .../com/wudsn/ide/gfx/GraphicsPluginTest.java | 8 +- .../launch/WUDSN-IDE UnitTests.launch | 223 ++++++++++++++++++ 6 files changed, 277 insertions(+), 53 deletions(-) create mode 100644 com.wudsn.ide.base/src/com/wudsn/ide/base/common/Assertions.java create mode 100644 com.wudsn.ide.base/src/com/wudsn/ide/base/common/Test.java delete mode 100644 com.wudsn.ide.gfx/launch/WUDSN-IDE - Graphics Plugin Tests.launch create mode 100644 com.wudsn.ide.lng/launch/WUDSN-IDE UnitTests.launch diff --git a/com.wudsn.ide.base/src/com/wudsn/ide/base/common/Assertions.java b/com.wudsn.ide.base/src/com/wudsn/ide/base/common/Assertions.java new file mode 100644 index 00000000..e49b637b --- /dev/null +++ b/com.wudsn.ide.base/src/com/wudsn/ide/base/common/Assertions.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2009 - 2021 Peter Dell + * + * This file is part of WUDSN IDE. + * + * WUDSN IDE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * WUDSN IDE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WUDSN IDE. If not, see . + */ + +package com.wudsn.ide.base.common; + +public class Assertions { + + public static void assertFalse(boolean actual) { + throw new RuntimeException("Actual values is not false"); + } + + public static void fail(String message) { + throw new RuntimeException(message); + } + + public static void fail(Throwable throwable) { + throw new RuntimeException(throwable); + } + +} diff --git a/com.wudsn.ide.base/src/com/wudsn/ide/base/common/Test.java b/com.wudsn.ide.base/src/com/wudsn/ide/base/common/Test.java new file mode 100644 index 00000000..6df74a66 --- /dev/null +++ b/com.wudsn.ide.base/src/com/wudsn/ide/base/common/Test.java @@ -0,0 +1,13 @@ +package com.wudsn.ide.base.common; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +@Retention(RUNTIME) +@Target(METHOD) +public @interface Test { + +} diff --git a/com.wudsn.ide.gfx/META-INF/MANIFEST.MF b/com.wudsn.ide.gfx/META-INF/MANIFEST.MF index 7dc93754..43b3d479 100644 --- a/com.wudsn.ide.gfx/META-INF/MANIFEST.MF +++ b/com.wudsn.ide.gfx/META-INF/MANIFEST.MF @@ -12,9 +12,7 @@ Require-Bundle: com.wudsn.ide.base, org.eclipse.ui.editors, org.eclipse.ui.ide, org.eclipse.ui.console, - org.eclipse.ui.views, - org.junit, - org.junit.jupiter.api + org.eclipse.ui.views Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: com.wudsn.ide.gfx.editor diff --git a/com.wudsn.ide.gfx/launch/WUDSN-IDE - Graphics Plugin Tests.launch b/com.wudsn.ide.gfx/launch/WUDSN-IDE - Graphics Plugin Tests.launch deleted file mode 100644 index d2b97cd4..00000000 --- a/com.wudsn.ide.gfx/launch/WUDSN-IDE - Graphics Plugin Tests.launch +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/com.wudsn.ide.gfx/src/com/wudsn/ide/gfx/GraphicsPluginTest.java b/com.wudsn.ide.gfx/src/com/wudsn/ide/gfx/GraphicsPluginTest.java index 9f2fa4f0..9e140be0 100644 --- a/com.wudsn.ide.gfx/src/com/wudsn/ide/gfx/GraphicsPluginTest.java +++ b/com.wudsn.ide.gfx/src/com/wudsn/ide/gfx/GraphicsPluginTest.java @@ -1,7 +1,7 @@ package com.wudsn.ide.gfx; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.fail; +import static com.wudsn.ide.base.common.Assertions.assertFalse; +import static com.wudsn.ide.base.common.Assertions.fail; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IWorkspace; @@ -9,15 +9,15 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; -import org.junit.jupiter.api.Test; import com.wudsn.ide.base.common.MessageQueue; import com.wudsn.ide.base.common.MessageQueue.Entry; +import com.wudsn.ide.base.common.Test; import com.wudsn.ide.gfx.converter.ConverterData; import com.wudsn.ide.gfx.converter.ConverterDataLogic; import com.wudsn.ide.gfx.model.ConverterMode; -// TODO Implement unit tests / run as plugin test? +// TODO Implement unit tests / hwo to run run as plugin test? class GraphicsPluginTest { private static void assertContainsNoErrorMessage(MessageQueue messageQueue) { if (messageQueue.containsError()) { diff --git a/com.wudsn.ide.lng/launch/WUDSN-IDE UnitTests.launch b/com.wudsn.ide.lng/launch/WUDSN-IDE UnitTests.launch new file mode 100644 index 00000000..5eede706 --- /dev/null +++ b/com.wudsn.ide.lng/launch/WUDSN-IDE UnitTests.launch @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +