Skip to content

Commit

Permalink
6th init
Browse files Browse the repository at this point in the history
  • Loading branch information
boorownie committed Dec 26, 2022
1 parent 37f79e0 commit 3244b9d
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 37 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'org.springframework.boot' version '2.6.3'
id 'org.springframework.boot' version '2.7.1'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
Expand All @@ -21,7 +21,7 @@ dependencies {
implementation 'net.rakugakibox.spring.boot:logback-access-spring-boot-starter:2.7.1'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.rest-assured:rest-assured:4.2.0'
testImplementation 'io.rest-assured:rest-assured:4.5.1'

runtimeOnly 'com.h2database:h2'
}
Expand Down
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-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package nextstep.subway.domain;
package subway;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.*;

@Entity
public class Station {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(length = 20, nullable = false)
private String name;

public Station() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package nextstep.subway.ui;
package subway;

import nextstep.subway.applicaion.StationService;
import nextstep.subway.applicaion.dto.StationRequest;
import nextstep.subway.applicaion.dto.StationResponse;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

Expand All @@ -24,7 +20,7 @@ public ResponseEntity<StationResponse> createStation(@RequestBody StationRequest
return ResponseEntity.created(URI.create("/stations/" + station.getId())).body(station);
}

@GetMapping(value = "/stations", produces = MediaType.APPLICATION_JSON_VALUE)
@GetMapping(value = "/stations")
public ResponseEntity<List<StationResponse>> showStations() {
return ResponseEntity.ok().body(stationService.findAllStations());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package nextstep.subway.domain;
package subway;

import org.springframework.data.jpa.repository.JpaRepository;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package nextstep.subway.applicaion.dto;
package subway;

public class StationRequest {
private String name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package nextstep.subway.applicaion.dto;
package subway;

public class StationResponse {
private Long id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package nextstep.subway.applicaion;
package subway;

import nextstep.subway.applicaion.dto.StationRequest;
import nextstep.subway.applicaion.dto.StationResponse;
import nextstep.subway.domain.Station;
import nextstep.subway.domain.StationRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package nextstep.subway;
package subway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/logback-access.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
<pattern>%fullRequest%n%n%fullResponse</pattern>
</encoder>
</appender>

<appender-ref ref="STDOUT"/>
</configuration>
23 changes: 23 additions & 0 deletions src/test/java/subway/RestAssuredTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package subway;

import io.restassured.response.ExtractableResponse;
import io.restassured.response.Response;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpStatus;

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

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class RestAssuredTest {

@DisplayName("구글 페이지 접근 테스트")
@Test
void accessGoogle() {
// TODO: 구글 페이지 요청 구현
ExtractableResponse<Response> response = null;

assertThat(response.statusCode()).isEqualTo(HttpStatus.OK.value());
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package nextstep.subway.acceptance;
package subway;

import io.restassured.RestAssured;
import io.restassured.response.ExtractableResponse;
import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;

Expand All @@ -18,16 +16,8 @@
import static org.assertj.core.api.Assertions.assertThat;

@DisplayName("지하철역 관련 기능")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class StationAcceptanceTest {
@LocalServerPort
int port;

@BeforeEach
public void setUp() {
RestAssured.port = port;
}

/**
* When 지하철역을 생성하면
* Then 지하철역이 생성된다
Expand Down

0 comments on commit 3244b9d

Please sign in to comment.