Journey Stage | Events in the movie |
---|---|
Ordinary world | Luke's life on the moisture farm |
Call to adventure | Kenobi invites Luke to accompany him to Alderaan |
Refusal of the call | Luke says he needs to return home |
Meeting with the mentor | Kenobi gives Anakin's lightsaber to Luke |
Crossing the first threshold | Luke agrees to accompany Kenobi after his uncles are massacred |
Tests, allies and enemies | Luke meets Solo, Chewbacca and Jabba. He is attacked in the bar and trains with the lightsaber |
Approaching the hidden cave | Luke finds the wreckage of Alderaan and everyone is captured by the Death Star |
Ordeal | Kenobi's death shakes Luke |
Clojure: (every? #(= % (first cpf)) cpf)
Elixir: String.graphemes(cpf) |> Enum.all?(&(&1 == String.first(cpf)))
F#: cpf |> Seq.forall (fun c -> c = cpf.[0])
Haskell: all (== head cpf) cpf
Java: cpf.chars().allMatch(ch -> ch == cpf.charAt(0));
Etapa da Jornada | Eventos no filme |
---|---|
Mundo comum | A vida de Luke na fazenda de humidade |
Chamado à aventura | Kenobi convida Luke a acompanhá-lo à Alderaan |
Recusa do chamado | Luke diz que precisa voltar para casa |
Encontro com o mentor | Kenobi entrega o sabre de luz de Anakin para Luke |
Travessia do primeiro limiar | Luke concorda em acompanhar Kenobi depois que seus tios são massacrados |
Testes, aliados e inimigos | Luke conhece Solo, Chewbacca e Jabba. É agredido no bar e treina com o sabre de luz |
Aproximação da caverna oculta | Luke encontra os destroços de Alderaan e todos são capturados pela Estrela da Morte |
Provação | A morte de Kenobi abala Luke |
This file contains hidden or 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
@Test | |
fun test() { | |
arrange { | |
mockSomething() | |
mockSomethingElse() | |
} | |
act { | |
doSomething() | |
doSomethingElse() | |
} |
This file contains hidden or 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
@Test | |
fun performChainedCalculationsCorrectly() { | |
arrange { | |
enterFormula("((515 + 87 x 311) - 302) ÷ 27") | |
} | |
act { | |
performCalculation() | |
} | |
assert { | |
resultIs("1010.0") |
This file contains hidden or 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
@Test | |
fun shouldCalculateExpressionsCorrectly() { | |
arrange { | |
enterFormula("((515 + 87 x 311) - 302) ÷ 27") | |
} | |
act { | |
performCalculation() | |
} | |
assert { | |
assertResultIs("1010.0") |
This file contains hidden or 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 CalculatorScreenTest { | |
@get:Rule | |
val composeRule = createAndroidComposeRule(MainActivity::class.java) | |
private val robot = CalculatorScreenRobot(composeRule) | |
private fun arrange(block: CalculatorScreenRobot.Arrange.() -> Unit) = | |
robot.Arrange().apply(block) | |
This file contains hidden or 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 CalculatorScreenTest { | |
@get:Rule | |
val composeRule = createAndroidComposeRule(MainActivity::class.java) | |
@Test | |
fun shouldCalculateExpressionsCorrectly() { | |
// arrange | |
enterFormula("((515 + 87 x 311) - 302) ÷ 27") |
This file contains hidden or 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 CalculatorScreenRobot( | |
private val composeRule: AndroidComposeTestRule<ActivityScenarioRule<MainActivity>, MainActivity> | |
) { | |
inner class Arrange { | |
fun enterFormula(formula: String) { | |
formula.forEach { character -> | |
if (!character.isWhitespace()) { | |
val buttonLabel = when (character) { | |
'(', ')' -> "()" |
This file contains hidden or 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 CalculatorScreenRobot { | |
class Arrange {} | |
class Act {} | |
class Assert {} | |
} |
NewerOlder