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
plugins { | |
id("java") | |
} | |
tasks.register("compileOn11", JavaCompile::class.java) { | |
javaCompiler = javaToolchains.compilerFor { | |
languageVersion = JavaLanguageVersion.of(11) | |
} | |
source = sourceSets["main"].allSource.asFileTree | |
classpath = sourceSets["main"].compileClasspath |
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
plugins { | |
id("org.jetbrains.kotlin.jvm") version "1.9.10" | |
} | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1") |
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
plugins { | |
id("org.jetbrains.kotlin.jvm") version "1.9.10" | |
} | |
repositories { | |
mavenCentral() | |
} |
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 StandardType : ItemType { | |
override fun update(item: Item, on: LocalDate): Item { | |
val degredation = when { | |
on.isAfter(item.sellByDate) -> 2 | |
else -> 1 | |
} | |
return item.withQuality(item.quality - degredation) | |
} |
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
private final InputStream systemIn = System.in; | |
private final PrintStream systemOut = System.out; | |
private ByteArrayInputStream testIn; | |
private ByteArrayOutputStream testOut; | |
@BeforeEach | |
public void setUpOutput() { | |
testOut = new ByteArrayOutputStream(); | |
System.setOut(new PrintStream(testOut)); |
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
# | |
# Reset Mac default Path variable | |
# | |
PATH=/usr/bin:/bin:/usr/sbin:/sbin | |
export PATH | |
# | |
# Add custom, local installations to PATH | |
# |
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
fun main(args: Array<String>) { | |
errorHandled { | |
inCase(args.isEmpty(), | |
onEmpty = { | |
val peers = sortedPeers() | |
show(peers) | |
}, | |
onNonEmpty = { | |
updatePeer(args) | |
val peers = sortedPeers() |
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
package wordcount.io; | |
import wordcount.domain.Stopwords; | |
import java.io.File; | |
import java.io.IOException; | |
import java.net.URL; | |
import java.nio.file.Files; | |
import java.util.Collection; |
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
package test.wordcount.fakes; | |
import java.io.File; | |
import java.io.IOException; | |
import java.net.URL; | |
import java.nio.file.Files; | |
import java.nio.file.StandardOpenOption; | |
import static java.lang.String.join; | |
import static java.lang.System.lineSeparator; |
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
public class FileSystemStopwordsTest { | |
private static final String STOPWORDS_FILE_PATH = "stopwords.txt"; | |
private TestFileSystemStopwords stopwordsFile = new TestFileSystemStopwords(STOPWORDS_FILE_PATH); | |
private Stopwords fileSystemStopwords = new FileSystemStopwords(STOPWORDS_FILE_PATH); | |
@Test | |
public void stopwordsReturnsStopwordsFromFile() { | |
stopwordsFile.addStopword("stopword"); | |
Collection<String> words = fileSystemStopwords.stopwords(); |
NewerOlder