Skip to content

Commit

Permalink
Split kotlin/java examples
Browse files Browse the repository at this point in the history
  • Loading branch information
will-molloy committed Jan 3, 2025
1 parent b275251 commit ff9986b
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 27 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import org.junit.jupiter.api.Test;

/**
* Integration tests for {@link HelloJava}.
* Integration tests for {@link HelloWorld}.
*
* @author <a href=https://willmolloy.com>Will Molloy</a>
*/
class HelloJavaIntegrationTest {
class HelloWorldIntegrationTest {

@Test
void test() {
assertThat(new HelloJava().hello("world")).isEqualTo("Hello world!");
void test_hello() {
assertThat(new HelloWorld().hello("world")).isEqualTo("Hello world!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*
* @author <a href=https://willmolloy.com>Will Molloy</a>
*/
class HelloJava {
private final Logger log = LogManager.getLogger();
class HelloWorld {
private static final Logger log = LogManager.getLogger();

String hello(String text) {
log.debug("Hello {}!", text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@

<Logger name="com.willmolloy" level="debug"/>
</Loggers>
</Configuration>
</Configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import org.junit.jupiter.api.Test;

/**
* Unit tests for {@link HelloJava}.
* Unit tests for {@link HelloWorld}.
*
* @author <a href=https://willmolloy.com>Will Molloy</a>
*/
class HelloJavaTest {
class HelloWorldTest {

@Test
void test_java() {
assertThat(new HelloJava().hello("world")).isEqualTo("Hello world!");
void test_hello() {
assertThat(new HelloWorld().hello("world")).isEqualTo("Hello world!");
}
}
1 change: 1 addition & 0 deletions example-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package com.willmolloy
*
* @author <a href=https://willmolloy.com>Will Molloy</a>
*/
class HelloKotlin {
class HelloWorld {
fun hello(text: String): String {
return "Hello $text!"
}
Expand Down
14 changes: 14 additions & 0 deletions example-kotlin/src/test/kotlin/com/willmolloy/HelloWorldTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.willmolloy

import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test

/**
* Unit tests for [HelloWorld].
*/
class HelloWorldTest {
@Test
fun `test hello`() {
assertThat(HelloWorld().hello("world")).isEqualTo("Hello world!")
}
}
14 changes: 0 additions & 14 deletions hello-world/src/test/kotlin/com/willmolloy/HelloKotlinTest.kt

This file was deleted.

3 changes: 2 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
rootProject.name = "java-template"
include("hello-world")
include("example-java")
include("example-kotlin")

0 comments on commit ff9986b

Please sign in to comment.