This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCleared() { | |
Log.i("TimeViewModel", "TimerViewModel destroyed!") | |
super.onCleared() | |
timer?.cancel() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return const MaterialApp( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Lifecycle Methods **/ | |
override fun onStart() { | |
super.onStart() | |
Timber.i("onStart Called") | |
} | |
override fun onResume() { | |
super.onResume() | |
Timber.i("onResume Called") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import junit.framework.Assert.assertEquals | |
import org.junit.Before | |
import org.junit.Test | |
class CalculatorTest { | |
private lateinit var calculator: Calculator | |
@Before |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import junit.framework.Assert.assertEquals | |
import org.junit.Before | |
import org.junit.Test | |
class CalculatorTest { | |
private lateinit var calculator: Calculator | |
@Before | |
fun setUp() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Calculator { | |
fun sum(firstNumber: Double, secondNumber: Double): Double { | |
return 0.0 | |
} | |
fun subtract(firstNumber: Double, secondNumber: Double): Double { | |
return firstNumber - secondNumber | |
} | |
fun divide(firstNumber: Double, secondNumber: Double): Double { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExampleUnitTest { | |
@Test | |
fun addition_isCorrect() { | |
assertEquals(4, 2 + 2) | |
assertEquals(3, 1 + 1) // fail | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExampleUnitTest { | |
// Her test @Test ile belirtilir (bu bir Junit açıklamasıdır) | |
@Test | |
fun addition_isCorrect() { | |
//Burada 4'ün 2+2 ile aynı olduğunu kontrol ediliyor | |
assertEquals(4, 2 + 2) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun foo() { | |
val x = 2 | |
class Local { | |
val y = x | |
} | |
Local().y // 2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.* | |
fun main(args: Array<String>) { | |
println("Hello, ${args[0]}!") | |
feedTheFish() | |
eagerExample() | |
} | |
fun shouldChangeWater( | |
day: String, |
NewerOlder