Skip to content

Commit

Permalink
Kotlin migration
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorch committed Oct 23, 2023
1 parent 249cafc commit a088710
Show file tree
Hide file tree
Showing 67 changed files with 7,630 additions and 7,596 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ android {
compileSdk 34
minSdk 26
targetSdk 34
versionCode 84
versionName "14.7.0"
versionCode 85
versionName "15.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
package de.bahnhoefe.deutschlands.bahnhofsfotos;
package de.bahnhoefe.deutschlands.bahnhofsfotos

import static org.assertj.core.api.Assertions.assertThat;

import androidx.test.platform.app.InstrumentationRegistry;

import org.junit.jupiter.api.Test;
import androidx.test.platform.app.InstrumentationRegistry
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
* @see [Testing documentation](http://d.android.com/tools/testing)
*/
public class ExampleInstrumentationTest {

class ExampleInstrumentationTest {
@Test
public void useAppContext() {
fun useAppContext() {
// Context of the app under test.
var appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();

assertThat(appContext.getPackageName()).isEqualTo("de.bahnhoefe.deutschlands.bahnhofsfotos.debug");
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertThat(appContext.packageName)
.isEqualTo("de.bahnhoefe.deutschlands.bahnhofsfotos.debug")
}
}
Original file line number Diff line number Diff line change
@@ -1,44 +1,47 @@
package de.bahnhoefe.deutschlands.bahnhofsfotos.util;
package de.bahnhoefe.deutschlands.bahnhofsfotos.util

import static org.assertj.core.api.Assertions.assertThat;
import de.bahnhoefe.deutschlands.bahnhofsfotos.model.Country
import de.bahnhoefe.deutschlands.bahnhofsfotos.model.Station
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import de.bahnhoefe.deutschlands.bahnhofsfotos.model.Country;
import de.bahnhoefe.deutschlands.bahnhofsfotos.model.Station;

public class TimetableTest {

private Station station;
class TimetableTest {
private var station: Station? = null

@BeforeEach
public void setUp() {
station = new Station(
"de",
"4711",
"Some Famous Station",
0.0,
0.0,
"LOL");
fun setUp() {
station = Station(
"de",
"4711",
"Some Famous Station",
0.0,
0.0,
"LOL"
)
}

@Test
public void createTimetableIntentWithId() {
var country = new Country("de", "Deutschland", null, "https://example.com/{id}/blah");
assertThat(new Timetable().createTimetableIntent(country, station).getData().toString()).isEqualTo("https://example.com/4711/blah");
fun createTimetableIntentWithId() {
val country = Country("de", "Deutschland", null, "https://example.com/{id}/blah")
assertThat(
Timetable().createTimetableIntent(country, station)!!.data.toString()
).isEqualTo("https://example.com/4711/blah")
}

@Test
public void createTimetableIntentWithTitle() {
var country = new Country("de", "Deutschland", null, "https://example.com/{title}/blah");
assertThat(new Timetable().createTimetableIntent(country, station).getData().toString()).isEqualTo("https://example.com/Some Famous Station/blah");
fun createTimetableIntentWithTitle() {
val country = Country("de", "Deutschland", null, "https://example.com/{title}/blah")
assertThat(
Timetable().createTimetableIntent(country, station)!!.data.toString()
).isEqualTo("https://example.com/Some Famous Station/blah")
}

@Test
public void createTimetableIntentWithDS100() {
var country = new Country("de", "Deutschland", null, "https://example.com/{DS100}/blah");
assertThat(new Timetable().createTimetableIntent(country, station).getData().toString()).isEqualTo("https://example.com/LOL/blah");
fun createTimetableIntentWithDS100() {
val country = Country("de", "Deutschland", null, "https://example.com/{DS100}/blah")
assertThat(
Timetable().createTimetableIntent(country, station)!!.data.toString()
).isEqualTo("https://example.com/LOL/blah")
}

}
Loading

0 comments on commit a088710

Please sign in to comment.