Skip to content
Snippets Groups Projects
Commit 6a6f8428 authored by Yulong Wang's avatar Yulong Wang
Browse files

Delete HospitalServiceTest.java

parent a5614197
No related branches found
No related tags found
No related merge requests found
package com.cardiff.client_project;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.JdbcTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import java.util.Arrays;
import java.util.List;
import static org.mockito.Mockito.*;
import static org.junit.jupiter.api.Assertions.*;
@SpringBootTest
class HospitalServiceTest {
@Autowired
private JdbcTemplate jdbcTemplate;
@Test
void testQueryAdmins() {
String sql = "SELECT * FROM common_admin ORDER BY status DESC";
List<AdminVO> result = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(AdminVO.class));
assertThat(result).hasSize(3); // back 3 data
assertThat(result.get(0).getName()).isEqualTo("justnoww");
assertThat(result.get(1).getName()).isEqualTo("BAa");
assertThat(result.get(2).getName()).isEqualTo("cmy");
}
public static class AdminVO {
private int id;
private String name;
private int status;
// Getters and Setters
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment