diff --git a/src/main/java/com/totopia/server/modules/user/entity/BankAccountEntity.java b/src/main/java/com/totopia/server/modules/user/entity/BankAccountEntity.java deleted file mode 100644 index 0153cf7..0000000 --- a/src/main/java/com/totopia/server/modules/user/entity/BankAccountEntity.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.totopia.server.modules.user.entity; - -import com.totopia.server.commons.data.entity.UserDateAuditEntity; -import lombok.experimental.SuperBuilder; - -import javax.persistence.*; - -@Entity(name = "bank_account") -@SuperBuilder -public class BankAccountEntity extends UserDateAuditEntity { - - private static final long serialVersionUID = -8628291684559836128L; - - @Id - @GeneratedValue(generator = "bank_account_generator") - @SequenceGenerator(name = "bank_account_generator", sequenceName = "bank_account_sequence", initialValue = 1) - private Long id; - - @Basic - @Column(name = "name", nullable = false, length = 100) - private String name; - - @Basic - @Column(name = "number", nullable = false, length = 100) - private String number; - - @Basic - @Column(name = "holder", nullable = false, length = 100) - private String holder; - - @Basic - @Column(name = "userId", nullable = false) - private Long userId; - - public BankAccountEntity(Long id, String name, String number, String holder, Long userId) { - this.id = id; - this.name = name; - this.number = number; - this.holder = holder; - this.userId = userId; - } - - public BankAccountEntity() { - } - - public Long getId() { - return this.id; - } - - public String getName() { - return this.name; - } - - public String getNumber() { - return this.number; - } - - public String getHolder() { - return this.holder; - } - - public void setId(Long id) { - this.id = id; - } - - public void setName(String name) { - this.name = name; - } - - public void setNumber(String number) { - this.number = number; - } - - public void setHolder(String holder) { - this.holder = holder; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public String toString() { - return "BankAccountEntity(id=" + this.getId() + ", name=" + this.getName() + ", number=" + this.getNumber() + ", holder=" + this.getHolder() + ", username=" + this.getUserId() + ")"; - } - - public boolean equals(final Object o) { - if (o == this) return true; - if (!(o instanceof BankAccountEntity)) return false; - final BankAccountEntity other = (BankAccountEntity) o; - if (!other.canEqual((Object) this)) return false; - final Object this$id = this.getId(); - final Object other$id = other.getId(); - if (this$id == null ? other$id != null : !this$id.equals(other$id)) return false; - final Object this$name = this.getName(); - final Object other$name = other.getName(); - if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false; - final Object this$number = this.getNumber(); - final Object other$number = other.getNumber(); - if (this$number == null ? other$number != null : !this$number.equals(other$number)) return false; - final Object this$holder = this.getHolder(); - final Object other$holder = other.getHolder(); - if (this$holder == null ? other$holder != null : !this$holder.equals(other$holder)) return false; - final Object this$userId = this.getUserId(); - final Object other$userId = other.getUserId(); - if (this$userId == null ? other$userId != null : !this$userId.equals(other$userId)) return false; - return true; - } - - protected boolean canEqual(final Object other) { - return other instanceof BankAccountEntity; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $id = this.getId(); - result = result * PRIME + ($id == null ? 43 : $id.hashCode()); - final Object $name = this.getName(); - result = result * PRIME + ($name == null ? 43 : $name.hashCode()); - final Object $number = this.getNumber(); - result = result * PRIME + ($number == null ? 43 : $number.hashCode()); - final Object $holder = this.getHolder(); - result = result * PRIME + ($holder == null ? 43 : $holder.hashCode()); - final Object $username = this.getUserId(); - result = result * PRIME + ($username == null ? 43 : $username.hashCode()); - return result; - } -} diff --git a/src/main/java/com/totopia/server/modules/user/entity/BankEntity.java b/src/main/java/com/totopia/server/modules/user/entity/BankEntity.java new file mode 100644 index 0000000..0b324b7 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/user/entity/BankEntity.java @@ -0,0 +1,56 @@ +package com.totopia.server.modules.user.entity; + +import com.totopia.server.commons.data.entity.UserDateAuditEntity; +import com.totopia.server.modules.user.type.StatusName; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import javax.persistence.*; + +@Entity(name = "bank") +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +@Builder +public class BankEntity extends UserDateAuditEntity { + + private static final long serialVersionUID = -8628291684559836128L; + + @Id + @GeneratedValue(generator = "bank_generator") + @SequenceGenerator(name = "bank_generator", sequenceName = "bank_sequence", initialValue = 1) + private Long id; + + @Basic + @Column(name = "userId", nullable = false) + private Long userId; + + @Basic + @Column(name = "bank_account_id", nullable = false) + private Long bankAccountId; + + @Basic + @Column(name = "name", nullable = false, length = 100) + private String name; + + @Basic + @Column(name = "number", nullable = false, length = 100) + private String number; + + @Basic + @Column(name = "holder", nullable = false, length = 100) + private String holder; + + @Basic + @Column(name = "password", nullable = false, length = 100) + private String password; + + @Basic + @Column(name = "status", nullable = false, length = 100) + private StatusName status; + + + +} diff --git a/src/main/java/com/totopia/server/modules/user/entity/ConnectHistoryEntity.java b/src/main/java/com/totopia/server/modules/user/entity/ConnectHistoryEntity.java index 213a222..6e98b89 100644 --- a/src/main/java/com/totopia/server/modules/user/entity/ConnectHistoryEntity.java +++ b/src/main/java/com/totopia/server/modules/user/entity/ConnectHistoryEntity.java @@ -7,7 +7,7 @@ import lombok.experimental.SuperBuilder; import javax.persistence.*; import java.io.Serializable; -@Entity(name = "deposit") +@Entity(name = "connection_history") @SuperBuilder @NoArgsConstructor @AllArgsConstructor diff --git a/src/main/java/com/totopia/server/modules/user/entity/DepositEntity.java b/src/main/java/com/totopia/server/modules/user/entity/DepositEntity.java index b5a5e36..f004b72 100644 --- a/src/main/java/com/totopia/server/modules/user/entity/DepositEntity.java +++ b/src/main/java/com/totopia/server/modules/user/entity/DepositEntity.java @@ -1,13 +1,12 @@ package com.totopia.server.modules.user.entity; -import com.totopia.server.commons.data.entity.UserDateAuditEntity; -import com.totopia.server.modules.user.type.ProcessingStatus; +import com.totopia.server.commons.data.entity.DateAuditEntity; +import com.totopia.server.modules.user.type.BankingName; import lombok.*; import lombok.experimental.SuperBuilder; import javax.persistence.*; import java.io.Serializable; -import java.util.Objects; @Entity(name = "deposit") @SuperBuilder @@ -17,27 +16,28 @@ import java.util.Objects; @Setter @ToString @Data -public class DepositEntity extends UserDateAuditEntity implements Serializable { +@Builder +public class DepositEntity extends DateAuditEntity implements Serializable { @Id @GeneratedValue(generator = "deposit_generator") @SequenceGenerator(name = "deposit_generator", sequenceName = "deposit_sequence", initialValue = 1) private Long id; - @Column(name = "amount_of_money", nullable = false) - private Integer amountOfMoney; + @Column(name = "price", nullable = false) + private Integer price; - @Column(name = "deposit_user", nullable = false) - private Long depositUser; + @Column(name = "approve_id", nullable = false) + private Long approve; - @Column(name = "confirm_user", nullable = false) - private Long confirmUser; + @Column(name = "bank_id", nullable = false) + private Long bank; @Column(name = "bank_account", nullable = false) - private Long bankAccount; + private Short bankAccount; @Enumerated(EnumType.STRING) @Column(name = "status", length = 60) - private ProcessingStatus status; + private BankingName status; } diff --git a/src/main/java/com/totopia/server/modules/user/entity/UserEntity.java b/src/main/java/com/totopia/server/modules/user/entity/UserEntity.java index dfba7f7..6514e79 100644 --- a/src/main/java/com/totopia/server/modules/user/entity/UserEntity.java +++ b/src/main/java/com/totopia/server/modules/user/entity/UserEntity.java @@ -2,6 +2,8 @@ package com.totopia.server.modules.user.entity; import com.fasterxml.jackson.annotation.JsonIgnore; import com.totopia.server.commons.data.entity.DateAuditEntity; +import com.totopia.server.modules.user.type.LevelName; +import com.totopia.server.modules.user.type.StatusName; import lombok.*; import lombok.experimental.SuperBuilder; @@ -46,12 +48,16 @@ public class UserEntity extends DateAuditEntity { private Boolean block = false; @Basic - @Column(name = "send_email", nullable = false) - private Boolean sendEmail = true; + @Column(name = "ref_enable", nullable = false) + private Boolean refEnable = false; @Basic - @Column(name = "activation", nullable = true, length = 100) - private String activation; + @Column(name = "ref_id", nullable = false) + private Long ref; + + @Basic + @Column(name = "send_email", nullable = false) + private Boolean sendEmail = true; @Basic @Temporal(TemporalType.TIMESTAMP) @@ -75,10 +81,6 @@ public class UserEntity extends DateAuditEntity { @Column(name = "otep", nullable = true, length = 1000) private String otep; - @Basic - @Column(name = "require_reset", nullable = true) - private Boolean requireReset = false; - @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "user_roles", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id")) private Set roles; @@ -88,8 +90,8 @@ public class UserEntity extends DateAuditEntity { private Set connectHistoryEntities; @Basic - @Column(name = "grade", nullable = true) - private Short grade; + @Column(name = "grade_id", nullable = true) + private GradeEntity grade; @Basic @Column(name = "phone", nullable = true) @@ -98,6 +100,15 @@ public class UserEntity extends DateAuditEntity { @Basic @Column(name = "descriptions", nullable = true, length = 1000) private String descriptions; + + @Enumerated(EnumType.STRING) + @Column(name = "status_name", length = 60) + private StatusName statusName; + + @Enumerated(EnumType.STRING) + @Column(name = "level_name", length = 60) + private LevelName levelName; + } // 아이디 diff --git a/src/main/java/com/totopia/server/modules/user/entity/WithdrawEntity.java b/src/main/java/com/totopia/server/modules/user/entity/WithdrawEntity.java new file mode 100644 index 0000000..67f8847 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/user/entity/WithdrawEntity.java @@ -0,0 +1,41 @@ +package com.totopia.server.modules.user.entity; + +import com.totopia.server.commons.data.entity.DateAuditEntity; +import com.totopia.server.modules.user.type.BankingName; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import javax.persistence.*; +import java.io.Serializable; + +@Entity(name = "withdrawal") +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +@ToString +@Data +@Builder +public class WithdrawEntity extends DateAuditEntity implements Serializable { + @Id + @GeneratedValue(generator = "withdraw_generator") + @SequenceGenerator(name = "withdraw_generator", sequenceName = "withdraw_sequence", initialValue = 1) + private Long id; + + @Column(name = "price", nullable = false) + private Integer price; + + @Column(name = "approve_id", nullable = false) + private Long approve; + + @Column(name = "bank_id", nullable = false) + private Long bank; + + @Column(name = "bank_account", nullable = false) + private Short bankAccount; + + @Enumerated(EnumType.STRING) + @Column(name = "status", length = 60) + private BankingName status; +} diff --git a/src/main/java/com/totopia/server/modules/user/entity/WithdrawalEntity.java b/src/main/java/com/totopia/server/modules/user/entity/WithdrawalEntity.java deleted file mode 100644 index 892fe3a..0000000 --- a/src/main/java/com/totopia/server/modules/user/entity/WithdrawalEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.totopia.server.modules.user.entity; - -import com.totopia.server.commons.data.entity.UserDateAuditEntity; -import com.totopia.server.modules.user.type.ProcessingStatus; -import lombok.*; -import lombok.experimental.SuperBuilder; - -import javax.persistence.*; -import java.io.Serializable; - -@Entity(name = "withdrawal") -@SuperBuilder -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@ToString -@Data -public class WithdrawalEntity extends UserDateAuditEntity implements Serializable { - @Id - @GeneratedValue(generator = "withdrawal_generator") - @SequenceGenerator(name = "withdrawal_generator", sequenceName = "withdrawal_sequence", initialValue = 1) - private Long id; - - @Column(name = "amount_of_money", nullable = false) - private Integer amountOfMoney; - - @Column(name = "deposit_user", nullable = false) - private Long withdrawalUser; - - @Column(name = "confirm_user", nullable = false) - private Long confirmUser; - - @Column(name = "bank_account", nullable = false) - private Long bankAccount; - - @Enumerated(EnumType.STRING) - @Column(name = "status", length = 60) - private ProcessingStatus status; -} diff --git a/src/main/java/com/totopia/server/modules/user/repository/BankAccountRepository.java b/src/main/java/com/totopia/server/modules/user/repository/BankAccountRepository.java deleted file mode 100644 index ce25b7d..0000000 --- a/src/main/java/com/totopia/server/modules/user/repository/BankAccountRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.totopia.server.modules.user.repository; - -import com.totopia.server.modules.user.entity.BankAccountEntity; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface BankAccountRepository extends JpaRepository { - -} diff --git a/src/main/java/com/totopia/server/modules/user/repository/BankRepository.java b/src/main/java/com/totopia/server/modules/user/repository/BankRepository.java new file mode 100644 index 0000000..7f8eaab --- /dev/null +++ b/src/main/java/com/totopia/server/modules/user/repository/BankRepository.java @@ -0,0 +1,8 @@ +package com.totopia.server.modules.user.repository; + +import com.totopia.server.modules.user.entity.BankEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface BankRepository extends JpaRepository { + +} diff --git a/src/main/java/com/totopia/server/modules/user/repository/WithdrawRepository.java b/src/main/java/com/totopia/server/modules/user/repository/WithdrawRepository.java new file mode 100644 index 0000000..a901f30 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/user/repository/WithdrawRepository.java @@ -0,0 +1,7 @@ +package com.totopia.server.modules.user.repository; + +import com.totopia.server.modules.user.entity.WithdrawEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface WithdrawRepository extends JpaRepository { +} diff --git a/src/main/java/com/totopia/server/modules/user/repository/WithdrawalRepository.java b/src/main/java/com/totopia/server/modules/user/repository/WithdrawalRepository.java deleted file mode 100644 index abd38cd..0000000 --- a/src/main/java/com/totopia/server/modules/user/repository/WithdrawalRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.totopia.server.modules.user.repository; - -import com.totopia.server.modules.user.entity.WithdrawalEntity; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface WithdrawalRepository extends JpaRepository { -} diff --git a/src/main/java/com/totopia/server/modules/user/type/BankingName.java b/src/main/java/com/totopia/server/modules/user/type/BankingName.java new file mode 100644 index 0000000..059c7b6 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/user/type/BankingName.java @@ -0,0 +1,5 @@ +package com.totopia.server.modules.user.type; + +public enum BankingName { + BANKING_WAITING, BANKING_HOLD, BANKING_COMPLETE +} diff --git a/src/main/java/com/totopia/server/modules/user/type/LevelName.java b/src/main/java/com/totopia/server/modules/user/type/LevelName.java new file mode 100644 index 0000000..62cabd8 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/user/type/LevelName.java @@ -0,0 +1,9 @@ +package com.totopia.server.modules.user.type; + +public enum LevelName { + LEVEL_1, + LEVEL_2, + LEVEL_3, + LEVEL_4, + LEVEL_5 +} diff --git a/src/main/java/com/totopia/server/modules/user/type/ProcessingStatus.java b/src/main/java/com/totopia/server/modules/user/type/ProcessingStatus.java deleted file mode 100644 index b4ca1ab..0000000 --- a/src/main/java/com/totopia/server/modules/user/type/ProcessingStatus.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.totopia.server.modules.user.type; - -public enum ProcessingStatus { - PROCESSING_WAITING, PROCESSING_HOLD, PROCESSING_COMPLETE -} diff --git a/src/main/java/com/totopia/server/modules/user/type/StatusName.java b/src/main/java/com/totopia/server/modules/user/type/StatusName.java new file mode 100644 index 0000000..d44e997 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/user/type/StatusName.java @@ -0,0 +1,7 @@ +package com.totopia.server.modules.user.type; + +public enum StatusName { + USER_BLOCK, // 정지 + USER_NORMAL, // 정상 + USER_WITHDRAW // 탈퇴 +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 9c7211f..33515e7 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -26,7 +26,7 @@ spring: initialization-mode: never jpa: hibernate: - ddl-auto: update + ddl-auto: create-drop database: postgresql show-sql: true database-platform: org.hibernate.dialect.PostgreSQLDialect diff --git a/src/test/java/com/totopia/server/modules/user/repository/BankAccountRepositoryTest.java b/src/test/java/com/totopia/server/modules/user/repository/BankRepositoryTest.java similarity index 81% rename from src/test/java/com/totopia/server/modules/user/repository/BankAccountRepositoryTest.java rename to src/test/java/com/totopia/server/modules/user/repository/BankRepositoryTest.java index 25efe54..81718b9 100644 --- a/src/test/java/com/totopia/server/modules/user/repository/BankAccountRepositoryTest.java +++ b/src/test/java/com/totopia/server/modules/user/repository/BankRepositoryTest.java @@ -1,6 +1,6 @@ package com.totopia.server.modules.user.repository; -import com.totopia.server.modules.user.entity.BankAccountEntity; +import com.totopia.server.modules.user.entity.BankEntity; import com.totopia.server.modules.user.entity.UserEntity; import org.junit.Before; import org.junit.Ignore; @@ -14,19 +14,19 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -//@Ignore +@Ignore @RunWith(SpringRunner.class) @SpringBootTest -public class BankAccountRepositoryTest { +public class BankRepositoryTest { @Autowired private UserRepository userRepository; @Autowired - private BankAccountRepository bankAccountRepository; + private BankRepository bankRepository; List users; - List accounts = new ArrayList<>(); + List accounts = new ArrayList<>(); @Before public void setUp() throws Exception { @@ -40,11 +40,11 @@ public class BankAccountRepositoryTest { @Test public void testInsert() { - BankAccountEntity bankAccount = null; + BankEntity bankAccount = null; int idx = 0; for (UserEntity user : users) { - bankAccount = new BankAccountEntity(); + bankAccount = new BankEntity(); switch (idx) { case 0: @@ -66,16 +66,16 @@ public class BankAccountRepositoryTest { idx++; bankAccount.setUserId(user.getId()); bankAccount.setUpdatedAt(new Date()); - this.bankAccountRepository.save(bankAccount); + this.bankRepository.save(bankAccount); } } @Test public void testUpdate() { - List bankAccounts = this.bankAccountRepository.findAll(); + List bankAccounts = this.bankRepository.findAll(); int idx = 0; - for (BankAccountEntity account : bankAccounts) { + for (BankEntity account : bankAccounts) { switch (idx) { case 0: @@ -97,7 +97,7 @@ public class BankAccountRepositoryTest { idx++; account.setUserId(account.getId()); - this.bankAccountRepository.save(account); + this.bankRepository.save(account); } } } \ No newline at end of file diff --git a/src/test/java/com/totopia/server/modules/user/repository/DepositRepositoryTest.java b/src/test/java/com/totopia/server/modules/user/repository/DepositRepositoryTest.java index 2211d92..8fbd561 100644 --- a/src/test/java/com/totopia/server/modules/user/repository/DepositRepositoryTest.java +++ b/src/test/java/com/totopia/server/modules/user/repository/DepositRepositoryTest.java @@ -1,9 +1,9 @@ package com.totopia.server.modules.user.repository; -import com.totopia.server.modules.user.entity.BankAccountEntity; +import com.totopia.server.modules.user.entity.BankEntity; import com.totopia.server.modules.user.entity.DepositEntity; import com.totopia.server.modules.user.entity.UserEntity; -import com.totopia.server.modules.user.type.ProcessingStatus; +import com.totopia.server.modules.user.type.BankingName; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -12,11 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import java.util.ArrayList; import java.util.List; -import static org.junit.Assert.*; - @Ignore @RunWith(SpringRunner.class) @SpringBootTest @@ -25,28 +22,29 @@ public class DepositRepositoryTest { @Autowired private UserRepository userRepository; @Autowired - private BankAccountRepository bankAccountRepository; + private BankRepository bankRepository; @Autowired private DepositRepository depositRepository; List users; - List accounts; + List accounts; @Before public void setUp() throws Exception { users = this.userRepository.findAll(); - accounts = this.bankAccountRepository.findAll(); + accounts = this.bankRepository.findAll(); } @Test public void insertTest() throws Exception { DepositEntity en = DepositEntity.builder() - .amountOfMoney(10000) - .bankAccount(accounts.get(2).getId()) - .confirmUser(accounts.get(0).getId()) - .depositUser(accounts.get(2).getId()) - .status(ProcessingStatus.PROCESSING_HOLD) + .price(10000) + .bankAccount((short) 1) + .approve(accounts.get(0).getId()) + .bank(accounts.get(2).getId()) + .status(BankingName.BANKING_WAITING) + .build(); // DepositEntity entity = new DepositEntity(); @@ -65,8 +63,8 @@ public class DepositRepositoryTest { @Test public void updateTest() throws Exception { DepositEntity entity = this.depositRepository.findById(1L).orElse(null); - entity.setStatus(ProcessingStatus.PROCESSING_COMPLETE); + entity.setStatus(BankingName.BANKING_COMPLETE); this.depositRepository.save(entity); - assertEquals(entity.getDepositUser().longValue(), 2L); +// assertEquals(entity.getDepositUser().longValue(), 2L); } } \ No newline at end of file diff --git a/src/test/java/com/totopia/server/modules/user/repository/UserRepositoryTest.java b/src/test/java/com/totopia/server/modules/user/repository/UserRepositoryTest.java index c35d933..3eeea7c 100644 --- a/src/test/java/com/totopia/server/modules/user/repository/UserRepositoryTest.java +++ b/src/test/java/com/totopia/server/modules/user/repository/UserRepositoryTest.java @@ -17,7 +17,7 @@ import java.util.Optional; import static org.junit.Assert.assertEquals; -//@Ignore +@Ignore @RunWith(SpringRunner.class) @SpringBootTest public class UserRepositoryTest { diff --git a/src/test/java/com/totopia/server/modules/user/repository/WithdrawRepositoryTest.java b/src/test/java/com/totopia/server/modules/user/repository/WithdrawRepositoryTest.java new file mode 100644 index 0000000..23fd828 --- /dev/null +++ b/src/test/java/com/totopia/server/modules/user/repository/WithdrawRepositoryTest.java @@ -0,0 +1,48 @@ +package com.totopia.server.modules.user.repository; + +import com.totopia.server.modules.user.entity.BankEntity; +import com.totopia.server.modules.user.entity.UserEntity; +import com.totopia.server.modules.user.entity.WithdrawEntity; +import com.totopia.server.modules.user.type.BankingName; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.List; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class WithdrawRepositoryTest { + + @Autowired + private UserRepository userRepository; + @Autowired + private BankRepository bankRepository; + @Autowired + private WithdrawRepository withdrawRepository; + + List users; + List accounts; + + @Before + public void setUp() throws Exception { + users = this.userRepository.findAll(); + accounts = this.bankRepository.findAll(); + } + + @Test + public void insertTest() throws Exception { + WithdrawEntity en = WithdrawEntity.builder() + .price(10000) + .bankAccount((short) 2) + .approve(accounts.get(0).getId()) + .bank(accounts.get(2).getId()) + .status(BankingName.BANKING_WAITING) + .build(); + + this.withdrawRepository.save(en); + } +} \ No newline at end of file diff --git a/src/test/java/com/totopia/server/modules/user/repository/WithdrawalRepositoryTest.java b/src/test/java/com/totopia/server/modules/user/repository/WithdrawalRepositoryTest.java deleted file mode 100644 index 97d6e8f..0000000 --- a/src/test/java/com/totopia/server/modules/user/repository/WithdrawalRepositoryTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.totopia.server.modules.user.repository; - -import com.totopia.server.modules.user.entity.BankAccountEntity; -import com.totopia.server.modules.user.entity.UserEntity; -import com.totopia.server.modules.user.entity.WithdrawalEntity; -import com.totopia.server.modules.user.type.ProcessingStatus; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.List; - -import static org.junit.Assert.*; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class WithdrawalRepositoryTest { - - @Autowired - private UserRepository userRepository; - @Autowired - private BankAccountRepository bankAccountRepository; - @Autowired - private WithdrawalRepository withdrawalRepository; - - List users; - List accounts; - - @Before - public void setUp() throws Exception { - users = this.userRepository.findAll(); - accounts = this.bankAccountRepository.findAll(); - } - - @Test - public void insertTest() throws Exception { - WithdrawalEntity en = WithdrawalEntity.builder() - .amountOfMoney(10000) - .bankAccount(accounts.get(2).getId()) - .confirmUser(accounts.get(0).getId()) - .withdrawalUser(accounts.get(2).getId()) - .status(ProcessingStatus.PROCESSING_WAITING) - .build(); - - this.withdrawalRepository.save(en); - } -} \ No newline at end of file