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 $ivy.`com.github.julien-truffaut::monocle-core:1.4.0`, monocle.Lens | |
import $ivy.`com.github.julien-truffaut::monocle-macro:1.4.0`, monocle.macros.GenLens | |
// _.copy fine for simple cases | |
case class Address(line1: String, line2: String, postcode: String) | |
val a = Address("221B", "Baker St", "NW1 6XE") | |
println(a) | |
println(a.copy(line1 = "221A")) |
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
package com.richashworth.testingutils.mocking; | |
import java.lang.reflect.Method; | |
import java.util.Map; | |
import static org.junit.Assert.fail; | |
public class MockObjectPopulator { | |
private DefaultValues defaultValues = new DefaultValues(); |
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
$ tmux new -s dev |
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
if ( 'text-image' == $format ) | |
$link_item .= '<p> <a href="' . get_bloginfo($rss_type) . '" title="' . esc_attr( $subscribe_to ) . '"><br/>' . esc_html__('RSS - ' . $type_text, 'jetpack'). '</a></p>'; |
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
abstract sealed class Beat | |
case object Rest extends Beat | |
case object Note extends Beat | |
case class Note(pitch: Int, duration: Int) extends Beat | |
case class Pattern(beats: Seq[Beat]) | |
def formatBeat(b: Beat): String = b match { | |
case Rest => " _ " | |
case Note => " X " |
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
package com.richashworth.testingutils.mocking; | |
import org.junit.Test; | |
import java.util.HashMap; | |
import java.util.Map; | |
import static junit.framework.Assert.assertEquals; | |
public class FootballerTest2 { |
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
package com.richashworth.testingutils.mocking; | |
import org.junit.Test; | |
import static junit.framework.Assert.assertEquals; | |
public class FootballerTest { | |
@Test | |
public void testGetGameGoalsRatio() { |
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
package com.richashworth.powermockexample; | |
import java.io.File; | |
import java.io.IOException; | |
import java.nio.charset.Charset; | |
import java.util.List; | |
import static com.google.common.io.Files.readLines; | |
public final class DataProvider { |
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
package com.richashworth.testingutils.mocking; | |
import java.util.HashMap; | |
import java.util.Map; | |
public class DefaultValues { | |
private Map<String, Object> defaultValuesMap; | |
public DefaultValues() { |
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
package com.richashworth.testingutils.mocking; | |
public class Footballer { | |
private String name; | |
private int age; | |
private Double salary; | |
private Integer gamesPlayed; | |
private Integer goalsScored; | |
private Boolean isCaptain; |