Skip to content

Commit

Permalink
update the latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
javajigi committed Apr 7, 2022
1 parent fa46649 commit 507d3d6
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 231 deletions.
Binary file added .DS_Store
Binary file not shown.
23 changes: 17 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.DS_Store
HELP.md
.gradle
/build/
build/
!gradle/wrapper/gradle-wrapper.jar
/out/
/target/
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
Expand All @@ -12,10 +12,21 @@
.project
.settings
.springBeans
bin/
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
*.ipr
out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
25 changes: 9 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,23 @@ plugins {
}

group 'camp.nextstep.edu'
version '1.0.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8
version '1.0-SNAPSHOT'

repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}

dependencies {
testImplementation 'org.assertj:assertj-core:3.19.0'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
testImplementation 'org.mockito:mockito-inline:3.6.0'
implementation 'com.github.woowacourse-projects:mission-utils:1.0.0'
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}

test {
useJUnitPlatform()
testLogging {
afterSuite { desc, result ->
if (!desc.parent) {
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
Empty file added docs/README.md
Empty file.
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.gradle.jvmargs=-Dfile.encoding=UTF-8
org.gradle.console=plain
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'java-baseball-precourse'
2 changes: 1 addition & 1 deletion src/main/java/baseball/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

public class Application {
public static void main(String[] args) {
// TODO 숫자 야구 게임 구현
// TODO: 프로그램 구현
}
}
58 changes: 0 additions & 58 deletions src/main/java/nextstep/utils/Console.java

This file was deleted.

49 changes: 0 additions & 49 deletions src/main/java/nextstep/utils/Randoms.java

This file was deleted.

53 changes: 19 additions & 34 deletions src/test/java/baseball/ApplicationTest.java
Original file line number Diff line number Diff line change
@@ -1,46 +1,31 @@
package baseball;

import nextstep.test.NSTest;
import nextstep.utils.Randoms;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import camp.nextstep.edu.missionutils.test.NsTest;
import org.junit.jupiter.api.Test;
import org.mockito.MockedStatic;

import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mockStatic;

public class ApplicationTest extends NSTest {
@BeforeEach
void beforeEach() {
super.setUp();
}

@Test
void 낫싱() {
try (final MockedStatic<Randoms> mockRandoms = mockStatic(Randoms.class)) {
mockRandoms
.when(() -> Randoms.pickNumberInRange(anyInt(), anyInt()))
.thenReturn(1, 3, 5);
running("246");
verify("낫싱");
}
}
import static camp.nextstep.edu.missionutils.test.Assertions.assertRandomNumberInRangeTest;
import static camp.nextstep.edu.missionutils.test.Assertions.assertSimpleTest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

class ApplicationTest extends NsTest {
@Test
void 게임종료_후_재시작() {
try (final MockedStatic<Randoms> mockRandoms = mockStatic(Randoms.class)) {
mockRandoms.when(() -> Randoms.pickNumberInRange(anyInt(), anyInt()))
.thenReturn(7, 1, 3)
.thenReturn(5, 8, 9);
run("713", "1", "597", "589", "2");
verify("3스트라이크", "게임 끝", "1스트라이크 1볼");
}
assertRandomNumberInRangeTest(
() -> {
run("246", "135", "1", "597", "589", "2");
assertThat(output()).contains("낫싱", "3스트라이크", "1볼 1스트라이크", "3스트라이크", "게임 종료");
},
1, 3, 5, 5, 8, 9
);
}

@AfterEach
void tearDown() {
outputStandard();
@Test
void 예외_테스트() {
assertSimpleTest(() ->
assertThatThrownBy(() -> runException("1234"))
.isInstanceOf(IllegalArgumentException.class)
);
}

@Override
Expand Down
66 changes: 0 additions & 66 deletions src/test/java/nextstep/test/NSTest.java

This file was deleted.

0 comments on commit 507d3d6

Please sign in to comment.