Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ buildscript {
jcip_annotation_version = "1.0"

// Testing
junit_version = "4.12"
junit_version = "4.13.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chore: remove or provide this parameter for junit-jupiter

Copy link
Member Author

@keturn keturn Apr 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I've added a jupiter_version.

I added a new parameter instead of replacing this one because junit_version still appears in the android packages. I was afraid to mess with those. Should I convert the android packages to JUnit 5 too? Do those tests run in my normal IDE, or do I have to switch to Android Studio for that?

jupiter_version = "5.7.1"
logback_version = "1.2.3"
mockito_version = "1.10.19"
mockito_version = "3.7.7"
}
}

Expand Down
14 changes: 11 additions & 3 deletions gestalt-asset-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,25 @@ dependencies {
implementation "com.android.support:support-annotations:$android_annotation_version"
implementation "net.jcip:jcip-annotations:$jcip_annotation_version"

testImplementation "junit:junit:$junit_version"
testImplementation "ch.qos.logback:logback-classic:$logback_version"
testImplementation "org.mockito:mockito-core:$mockito_version"

testImplementation(platform("org.junit:junit-bom:$jupiter_version")) {
// junit-bom will set version numbers for the other org.junit dependencies.
}
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testImplementation("org.mockito:mockito-inline:$mockito_version")
testImplementation("org.mockito:mockito-junit-jupiter:$mockito_version")
}

description = 'Provides support for assets - binary resources that can be loaded from modules or procedurally generated at runtime.'

sourceCompatibility = 1.8
targetCompatibility = 1.8

tasks.named("test", Test) {
useJUnitPlatform()
}

/***
* Publishing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
/*
* Copyright 2019 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.gestalt.assets;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.terasology.gestalt.assets.management.AssetManager;
import org.terasology.gestalt.assets.management.AssetTypeManager;

import java.util.Optional;

import virtualModules.test.stubs.book.Book;
import virtualModules.test.stubs.book.BookData;
import virtualModules.test.stubs.book.BookFactory;
Expand All @@ -33,8 +16,10 @@
import virtualModules.test.stubs.text.TextData;
import virtualModules.test.stubs.text.TextFactory;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Optional;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
/*
* Copyright 2019 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.gestalt.assets;

import com.google.common.collect.ImmutableSet;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.terasology.gestalt.assets.management.AssetManager;
import org.terasology.gestalt.assets.management.Context;
import org.terasology.gestalt.assets.management.ContextManager;
import org.terasology.gestalt.assets.management.MapAssetTypeManager;

import java.util.Set;

import virtualModules.test.stubs.inheritance.AlternateAsset;
import virtualModules.test.stubs.inheritance.AlternateAssetData;
import virtualModules.test.stubs.inheritance.AlternateAssetFactory;
Expand All @@ -37,9 +20,11 @@
import virtualModules.test.stubs.text.TextData;
import virtualModules.test.stubs.text.TextFactory;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Set;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@
/*
* Copyright 2019 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.gestalt.assets;

import com.google.common.collect.ImmutableSet;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.terasology.gestalt.naming.Name;
import virtualModules.test.stubs.text.Text;
import virtualModules.test.stubs.text.TextData;
import virtualModules.test.stubs.text.TextFactory;

import java.io.IOException;
import java.util.Optional;
import java.util.Set;

import virtualModules.test.stubs.text.Text;
import virtualModules.test.stubs.text.TextData;
import virtualModules.test.stubs.text.TextFactory;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
/*
* Copyright 2019 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.gestalt.assets;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.terasology.gestalt.assets.exceptions.InvalidUrnException;
import org.terasology.gestalt.naming.Name;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;


/**
* @author Immortius
Expand All @@ -42,7 +30,7 @@ public class ResourceUrnTest {
@Test
public void moduleAndResourceConstructor() {
ResourceUrn urn = new ResourceUrn(TEST_MODULE, TEST_RESOURCE);
Assert.assertEquals(new Name(TEST_MODULE), urn.getModuleName());
assertEquals(new Name(TEST_MODULE), urn.getModuleName());
assertEquals(new Name(TEST_RESOURCE), urn.getResourceName());
assertTrue(urn.getFragmentName().isEmpty());
assertEquals(URN_STRING, urn.toString());
Expand All @@ -62,7 +50,7 @@ public void instanceConstructor() {
ResourceUrn urn = new ResourceUrn(TEST_MODULE, TEST_RESOURCE, true);
assertEquals(new Name(TEST_MODULE), urn.getModuleName());
assertEquals(new Name(TEST_RESOURCE), urn.getResourceName());
assertEquals(true, urn.isInstance());
assertTrue(urn.isInstance());
assertEquals(URN_INSTANCE_STRING, urn.toString());
}

Expand Down Expand Up @@ -101,13 +89,15 @@ public void fragmentInstanceConstructor() {
assertEquals(new Name(TEST_MODULE), urn.getModuleName());
assertEquals(new Name(TEST_RESOURCE), urn.getResourceName());
assertEquals(new Name(TEST_FRAGMENT), urn.getFragmentName());
assertEquals(true, urn.isInstance());
assertTrue(urn.isInstance());
assertEquals(URN_FRAGMENT_INSTANCE_STRING, urn.toString());
}

@Test(expected = InvalidUrnException.class)
@Test
public void invalidUrnStringConstructor() {
new ResourceUrn("blerg");
assertThrows(InvalidUrnException.class, () ->
new ResourceUrn("blerg")
);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
/*
* Copyright 2019 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.gestalt.assets.module;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.terasology.gestalt.assets.ResourceUrn;
import org.terasology.gestalt.assets.format.producer.AssetFileDataProducer;
import org.terasology.gestalt.module.ModuleEnvironment;
import org.terasology.gestalt.naming.Name;

import java.util.Optional;
import java.util.Set;

import virtualModules.test.stubs.text.TextData;
import virtualModules.test.stubs.text.TextDeltaFileFormat;
import virtualModules.test.stubs.text.TextFileFormat;
import virtualModules.test.stubs.text.TextMetadataFileFormat;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Optional;
import java.util.Set;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* @author Immortius
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
/*
* Copyright 2019 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.gestalt.assets.module;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.terasology.gestalt.assets.AssetData;
import org.terasology.gestalt.assets.AssetDataProducer;
import org.terasology.gestalt.assets.AssetFactory;
import org.terasology.gestalt.assets.AssetType;
import org.terasology.gestalt.assets.ResourceUrn;
import org.terasology.gestalt.assets.format.producer.AssetFileDataProducer;

import java.util.List;
import java.util.Optional;

import virtualModules.test.stubs.extensions.ExtensionAsset;
import virtualModules.test.stubs.extensions.ExtensionDataProducer;
import virtualModules.test.stubs.extensions.ExtensionDeltaFileFormat;
Expand All @@ -41,9 +24,12 @@
import virtualModules.test.stubs.text.TextData;
import virtualModules.test.stubs.text.TextFactory;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.Optional;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
/*
* Copyright 2019 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.gestalt.assets.module;

import com.google.common.collect.ImmutableSet;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.terasology.gestalt.module.ModuleEnvironment;
import org.terasology.gestalt.naming.Name;

import java.util.Collections;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* @author Immortius
Expand Down
Loading