Skip to content

Instantly share code, notes, and snippets.

View aysesenses's full-sized avatar
🎯
Focusing

Ayşe ŞENSES aysesenses

🎯
Focusing
  • Turkey
View GitHub Profile
override fun onCleared() {
Log.i("TimeViewModel", "TimerViewModel destroyed!")
super.onCleared()
timer?.cancel()
}
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const MaterialApp(
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)
}
}
/** Lifecycle Methods **/
override fun onStart() {
super.onStart()
Timber.i("onStart Called")
}
override fun onResume() {
super.onResume()
Timber.i("onResume Called")
}
import junit.framework.Assert.assertEquals
import org.junit.Before
import org.junit.Test
class CalculatorTest {
private lateinit var calculator: Calculator
@Before
import junit.framework.Assert.assertEquals
import org.junit.Before
import org.junit.Test
class CalculatorTest {
private lateinit var calculator: Calculator
@Before
fun setUp() {
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 {
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
assertEquals(3, 1 + 1) // fail
}
}
fun foo() {
val x = 2
class Local {
val y = x
}
Local().y // 2
}
import java.util.*
fun main(args: Array<String>) {
println("Hello, ${args[0]}!")
feedTheFish()
eagerExample()
}
fun shouldChangeWater(
day: String,