Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .idea/aws.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 14 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
apply plugin: 'java'
apply plugin: 'eclipse'

version = '1.0.0'
sourceCompatibility = 1.8
sourceCompatibility = 11

repositories {
mavenCentral()
}

dependencies {
compile('com.sparkjava:spark-core:2.6.0')
compile('com.sparkjava:spark-template-handlebars:2.5.5')
compile('com.google.guava:guava:23.0')
compile('ch.qos.logback:logback-classic:1.2.3')
testCompile('junit:junit:4.12')
testCompile('org.assertj:assertj-core:3.9.0')
}
implementation('com.sparkjava:spark-core:2.6.0')
implementation('com.sparkjava:spark-template-handlebars:2.5.5')
implementation('com.google.guava:guava:23.0')
implementation('ch.qos.logback:logback-classic:1.2.3')

//add junit jupiter
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.9.3'
testImplementation 'org.assertj:assertj-core:3.11.1'
testImplementation 'org.testng:testng:7.1.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}

targetCompatibility = 11
27 changes: 17 additions & 10 deletions src/test/java/next/exception/PositionTest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package next.exception;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class PositionTest {
@Test
Expand All @@ -19,29 +20,35 @@ public void create_77() {
assertThat(p.getY()).isEqualTo(7);
}

@Test (expected = InValidPositionException.class)
@Test
public void 길이가_2가_아닌_경우() {
new Position("a");
assertThatThrownBy(() -> new Position("a"))
.isInstanceOf(InValidPositionException.class);
}

@Test (expected = InValidPositionException.class)
@Test
public void notValid_0보다_작은_X() {
new Position("Z1");
assertThatThrownBy(() -> new Position("Z1"))
.isInstanceOf(InValidPositionException.class);
}

@Test (expected = InValidPositionException.class)
@Test
public void notValid_7보다_큰_X() {
new Position("i1");
assertThatThrownBy(() -> new Position("i1"))
.isInstanceOf(InValidPositionException.class);
}

@Test (expected = InValidPositionException.class)
@Test
public void notValid_0보다_작은_Y() {
new Position("a0");
assertThatThrownBy(() -> new Position("a0"))
.isInstanceOf(InValidPositionException.class);
}

@Test (expected = InValidPositionException.class)
@Test
public void notValid_7보다_큰_Y() {
new Position("a9");
assertThatThrownBy(() -> new Position("a9"))
.isInstanceOf(InValidPositionException.class);
}

}
3 changes: 2 additions & 1 deletion src/test/java/next/fp/CarTest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package next.fp;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;

public class CarTest {
@Test
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/next/fp/LambdaTest.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package next.fp;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.Arrays;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

public class LambdaTest {
private List<Integer> numbers;

@Before
@BeforeEach
public void setup() {
numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
}
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/next/fp/StreamStudyTest.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package next.fp;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.Arrays;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

public class StreamStudyTest {
private List<Integer> numbers;

@Before
@BeforeEach
public void setup() {
numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
}
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/next/optional/ComputerStoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;

import next.optional.Computer.Soundcard;
import next.optional.Computer.USB;
import org.junit.jupiter.api.Test;

public class ComputerStoreTest {
@Test
Expand Down
8 changes: 5 additions & 3 deletions src/test/java/next/optional/ExpressionTest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package next.optional;

import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.*;

import org.junit.Test;


public class ExpressionTest {
Expand All @@ -11,8 +12,9 @@ public void of() {
assertThat(Expression.PLUS == Expression.of("+")).isTrue();
}

@Test (expected = IllegalArgumentException.class)
@Test
public void notValidExpression() {
Expression.of("&");
assertThatThrownBy(() -> Expression.of("&")).isInstanceOf(IllegalArgumentException.class);
}
}
5 changes: 3 additions & 2 deletions src/test/java/next/optional/UserTest.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package next.optional;


import org.junit.jupiter.api.Test;

import static next.optional.User.*;
import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;

public class UserTest {
@Test
public void whenFiltersWithoutOptional_thenCorrect() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/next/optional/UsersTest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package next.optional;

import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;

import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;

public class UsersTest {

Expand Down
11 changes: 11 additions & 0 deletions src/test/java/next/reflection/Junit3Runner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package next.reflection;

import org.junit.jupiter.api.Test;

public class Junit3Runner {
@Test
public void runner() throws Exception {
Class clazz = Junit3Test.class;

}
}
6 changes: 3 additions & 3 deletions src/test/java/next/reflection/Junit3Test.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package next.reflection;

public class Junit3Test {
public void test1() throws Exception {
public void test1() {
System.out.println("Running Test1");
}

public void test2() throws Exception {
public void test2() {
System.out.println("Running Test2");
}

public void three() throws Exception {
public void three() {
System.out.println("Running Test3");
}
}
11 changes: 0 additions & 11 deletions src/test/java/next/reflection/Junit3TestRunner.java

This file was deleted.

13 changes: 13 additions & 0 deletions src/test/java/next/reflection/Junit4Runner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package next.reflection;

import org.junit.jupiter.api.Test;

public class Junit4Runner {
@Test
public void run() throws Exception {
Class clazz = Junit4Test.class;

}
}


11 changes: 0 additions & 11 deletions src/test/java/next/reflection/Junit4TestRunner.java

This file was deleted.

10 changes: 7 additions & 3 deletions src/test/java/next/reflection/ReflectionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@

import java.lang.reflect.Constructor;

import org.junit.Test;
import org.assertj.core.api.SoftAssertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.assertj.core.api.Assertions.*;

public class ReflectionTest {
private static final Logger logger = LoggerFactory.getLogger(ReflectionTest.class);

@Test
@DisplayName("테스트1: 리플렉션을 이용해서 클래스와 메소드의 정보를 정확하게 출력해야 한다.")
public void showClass() {
SoftAssertions s = new SoftAssertions();
Class<Question> clazz = Question.class;
logger.debug(clazz.getName());
logger.debug("Classs Name {}", clazz.getName());
}

@Test
@SuppressWarnings("rawtypes")
public void constructor() throws Exception {
Class<Question> clazz = Question.class;
Constructor[] constructors = clazz.getConstructors();
Expand Down