From 66ad048053eb4e971d84f844f5a8a52efd8f6dc2 Mon Sep 17 00:00:00 2001 From: huangyuhui Date: Thu, 10 Aug 2017 19:08:05 +0800 Subject: [PATCH] Remove tests --- .../test/java/org/jackhuang/hmcl/GsonTest.kt | 60 ------------------- .../src/test/java/org/jackhuang/hmcl/Test.kt | 5 -- 2 files changed, 65 deletions(-) delete mode 100644 HMCLCore/src/test/java/org/jackhuang/hmcl/GsonTest.kt diff --git a/HMCLCore/src/test/java/org/jackhuang/hmcl/GsonTest.kt b/HMCLCore/src/test/java/org/jackhuang/hmcl/GsonTest.kt deleted file mode 100644 index dc0ef498c..000000000 --- a/HMCLCore/src/test/java/org/jackhuang/hmcl/GsonTest.kt +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui - * - * This program 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 3 of the License, or - * (at your option) any later version. - * - * This program 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 this program. If not, see {http://www.gnu.org/licenses/}. - */ -package org.jackhuang.hmcl - -import com.google.gson.GsonBuilder -import com.google.gson.JsonSyntaxException -import org.jackhuang.hmcl.util.ValidationTypeAdapterFactory -import org.jackhuang.hmcl.util.Validation -import org.junit.Before -import org.junit.Test -import java.io.IOException - -class GsonTest { - - class JsonTest(val required: Int = 0, val optional: Int = 0) - : Validation { - - override fun validate() { - if (required == 0) - throw IllegalStateException("Required field missing") - } - } - - val JSON_WITH_REQUIRED_FIELDS = "{\"required\": 123, \"optional\": 234}" - val JSON_WITHOUT_REQUIRED_FIELDS = "{\"optional\": 234}" - val GSON = GsonBuilder().registerTypeAdapterFactory(ValidationTypeAdapterFactory) - .create() - - @Before - fun setup() { - } - - @Test - fun test() { - GSON.fromJson(JSON_WITH_REQUIRED_FIELDS, JsonTest::class.java) - try { - GSON.fromJson(JSON_WITHOUT_REQUIRED_FIELDS, JsonTest::class.java) - throw AssertionError("Failed json test") - } catch(e: JsonSyntaxException) { - // nothing - } catch (e: Exception) { - throw AssertionError("Failed json test") - } - } -} \ No newline at end of file diff --git a/HMCLCore/src/test/java/org/jackhuang/hmcl/Test.kt b/HMCLCore/src/test/java/org/jackhuang/hmcl/Test.kt index eb31eb6a9..ebb7f2e7a 100644 --- a/HMCLCore/src/test/java/org/jackhuang/hmcl/Test.kt +++ b/HMCLCore/src/test/java/org/jackhuang/hmcl/Test.kt @@ -47,7 +47,6 @@ class Test { repository.refreshVersions() } - @Test fun launch() { val launcher = DefaultLauncher( repository = repository, @@ -79,7 +78,6 @@ class Test { } } - @Test fun downloadNewVersion() { val thread = Thread.currentThread() dependency.gameBuilder() @@ -98,7 +96,6 @@ class Test { } } - @Test fun completeGame() { val thread = Thread.currentThread() val version = repository.getVersion("test").resolve(repository) @@ -112,7 +109,6 @@ class Test { } } - @Test fun installForge() { val thread = Thread.currentThread() val version = repository.getVersion("test").resolve(repository) @@ -130,7 +126,6 @@ class Test { } } - @Test fun refreshAsync() { val thread = Thread.currentThread() LiteLoaderVersionList.refreshAsync(BMCLAPIDownloadProvider).executor().apply {