Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests consistency and clean up #1085

Merged
merged 1 commit into from
Nov 7, 2024
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@
/**
* Class ArchetypeBaseTest.
*/
public class ArchetypeBaseTest {
class ArchetypeBaseTest {

static private File targetDir;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,10 +28,10 @@
/**
* Tests {@link ArchetypeCatalog}.
*/
public class ArchetypeCatalogTest {
class ArchetypeCatalogTest {

@Test
public void testUnmarshall() {
void testUnmarshall() {
InputStream is = ArchetypeCatalogTest.class.getResourceAsStream("catalog.xml");
assertThat(is, is(notNullValue()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
/**
* Tests {@link ArchetypeDescriptor}.
*/
public class ArchetypeDescriptorTest {
class ArchetypeDescriptorTest {

@Test
public void testUnmarshall() {
void testUnmarshall() {
InputStream is = getClass().getClassLoader().getResourceAsStream(ArchetypeEngine.DESCRIPTOR_RESOURCE_NAME);
assertThat(is, is(notNullValue()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
/**
* Test {@link ArchetypeEngine}.
*/
public class ArchetypeEngineTest extends ArchetypeBaseTest {
class ArchetypeEngineTest extends ArchetypeBaseTest {

@Test
public void testResolveProperties() {
void testResolveProperties() {
Map<String, String> props = Map.of("foo", "bar", "bar", "foo");
assertThat(PropertyEvaluator.evaluate("${foo}", props), is("bar"));
assertThat(PropertyEvaluator.evaluate("${xxx}", props), is(""));
Expand All @@ -67,13 +67,13 @@ public void testResolveProperties() {
}

@Test
public void testTransformedProperties() {
void testTransformedProperties() {
Map<String, String> props = Map.of("package", "com.example.myapp");
assertThat(PropertyEvaluator.evaluate("${package/\\./\\/}", props), is("com/example/myapp"));
}

@Test
public void testTransform() {
void testTransform() {
Map<String, String> props = Map.of("package", "com.example.myapp");
List<Transformation> tfs = List.of(
new Transformation("mustache", List.of(new Replacement("\\.mustache$", ""))),
Expand All @@ -84,7 +84,7 @@ public void testTransform() {
}

@Test
public void testEvaluateConditional() {
void testEvaluateConditional() {
Map<String, String> props1 = Map.of("prop1", "true");
Map<String, String> props2 = Map.of("prop1", "true", "prop2", "true");

Expand All @@ -109,7 +109,7 @@ public void testEvaluateConditional() {
}

@Test
public void testGenerate() throws IOException {
void testGenerate() throws IOException {
Map<String, String> properties = Map.of(
"groupId", "com.example",
"artifactId", "my-project",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,15 +38,15 @@
/**
* Class ArchetypeLoaderTest.
*/
public class ArchetypeLoaderTest extends ArchetypeBaseTest {
class ArchetypeLoaderTest extends ArchetypeBaseTest {

/**
* Creates simple JAR file to test archetype loader.
*
* @throws IOException If an IO error occurs.
*/
@BeforeAll
public static void createSimpleJar() throws IOException {
static void createSimpleJar() throws IOException {
Manifest manifest = new Manifest();
File file = unique(targetDir().toPath(), "test", ".jar").toFile();
JarOutputStream os = new JarOutputStream(new FileOutputStream(file), manifest);
Expand All @@ -57,7 +57,7 @@ public static void createSimpleJar() throws IOException {
}

@Test
public void testLoadFromJar() throws IOException {
void testLoadFromJar() throws IOException {
File file = new File(ArchetypeLoader.class.getResource("/test.jar").getFile());
ArchetypeLoader loader = new ArchetypeLoader(file);
try (InputStream is = loader.loadResourceAsStream("META-INF/helidon-archetype.xml")) {
Expand All @@ -74,7 +74,7 @@ public void testLoadFromJar() throws IOException {
}

@Test
public void testLoadFromDir() throws IOException {
void testLoadFromDir() throws IOException {
ArchetypeLoader loader = new ArchetypeLoader(targetDir());
try (InputStream is = loader.loadResourceAsStream("META-INF/helidon-archetype.xml")) {
StringBuilder sb = new StringBuilder();
Expand All @@ -90,7 +90,7 @@ public void testLoadFromDir() throws IOException {
}

@Test
public void testBadFile() {
void testBadFile() {
Path targetDirPath = targetDir().toPath().resolve("test.properties");
assertThrows(IOException.class, () -> new ArchetypeLoader(targetDirPath.toFile()));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates.
* Copyright (c) 2022, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,7 +33,7 @@
/**
* Tests {@link BatchInputResolver}.
*/
public class BatchInputResolverTest {
class BatchInputResolverTest {

@Test
void testInputEnumWithSingleOptionAndDefault() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2023 Oracle and/or its affiliates.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,7 +55,7 @@
/**
* Tests {@link InputResolver}.
*/
public class InputResolverTest {
class InputResolverTest {

@Test
void testEnumOption() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
* Copyright (c) 2023, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,7 +32,7 @@
/**
* Tests {@link MergedModel}.
*/
public class MergedModelTest {
class MergedModelTest {

@Test
void testResolveWithNotRootContext() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2023 Oracle and/or its affiliates.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -350,9 +350,9 @@ public String toString() {
}

private static class Container {
public final Bar bar;
final Bar bar;

public Container(final Bar bar) {
Container(final Bar bar) {
this.bar = bar;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022 Oracle and/or its affiliates.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -236,7 +236,7 @@ void testIncorrectOperator() {
}

@Test
public void simpleNotEqualStringLiterals() {
void simpleNotEqualStringLiterals() {
assertThat(parse("'foo' != 'bar'").eval(), is(true));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates.
* Copyright (c) 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,7 +40,7 @@
/**
* Tests for {@link Validation}.
*/
public class ValidationTest {
class ValidationTest {

private final String VALIDATION_ALL_IN_ONE = "validation/validations-all-in-one.xml";
private final String VALIDATION_EXEC = "validation/archetype-base.xml";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2023 Oracle and/or its affiliates.
* Copyright (c) 2022, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,7 +34,7 @@
class ContextNodeTest {

@Test
public void testParentForRootNode() {
void testParentForRootNode() {
ContextNode root = ContextNode.create();
ContextValue value = root.getValue("..foo");
assertThat(value, is(nullValue()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
* Copyright (c) 2023, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,7 +30,7 @@
class ContextSerializerTest {

@Test
public void testSerialize() {
void testSerialize() {
Map<String, String> expectedResult = Map.of(
"foo", "foo",
"foo1", "",
Expand Down
Loading
Loading