Fix reserved word columns and update field names

This commit is contained in:
Tim
2025-07-05 18:11:40 +08:00
parent cb5a4a6bfb
commit f7caebe467
13 changed files with 54 additions and 54 deletions

View File

@@ -35,7 +35,7 @@ class CategoryControllerTest {
Category c = new Category();
c.setId(1L);
c.setName("tech");
c.setDescribe("d");
c.setDescription("d");
c.setIcon("i");
c.setSmallIcon("s1");
Mockito.when(categoryService.createCategory(eq("tech"), eq("d"), eq("i"), eq("s1"))).thenReturn(c);
@@ -43,10 +43,10 @@ class CategoryControllerTest {
mockMvc.perform(post("/api/categories")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"name\":\"tech\",\"describe\":\"d\",\"icon\":\"i\",\"smallIcon\":\"s1\"}"))
.content("{\"name\":\"tech\",\"description\":\"d\",\"icon\":\"i\",\"smallIcon\":\"s1\"}"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.name").value("tech"))
.andExpect(jsonPath("$.describe").value("d"))
.andExpect(jsonPath("$.description").value("d"))
.andExpect(jsonPath("$.icon").value("i"))
.andExpect(jsonPath("$.smallIcon").value("s1"));
@@ -60,7 +60,7 @@ class CategoryControllerTest {
Category c = new Category();
c.setId(2L);
c.setName("life");
c.setDescribe("d2");
c.setDescription("d2");
c.setIcon("i2");
c.setSmallIcon("s2");
Mockito.when(categoryService.listCategories()).thenReturn(List.of(c));
@@ -68,7 +68,7 @@ class CategoryControllerTest {
mockMvc.perform(get("/api/categories"))
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].name").value("life"))
.andExpect(jsonPath("$[0].describe").value("d2"))
.andExpect(jsonPath("$[0].description").value("d2"))
.andExpect(jsonPath("$[0].icon").value("i2"))
.andExpect(jsonPath("$[0].smallIcon").value("s2"));
}
@@ -78,18 +78,18 @@ class CategoryControllerTest {
Category c = new Category();
c.setId(3L);
c.setName("tech");
c.setDescribe("d3");
c.setDescription("d3");
c.setIcon("i3");
c.setSmallIcon("s3");
Mockito.when(categoryService.updateCategory(eq(3L), eq("tech"), eq("d3"), eq("i3"), eq("s3"))).thenReturn(c);
mockMvc.perform(put("/api/categories/3")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"name\":\"tech\",\"describe\":\"d3\",\"icon\":\"i3\",\"smallIcon\":\"s3\"}"))
.content("{\"name\":\"tech\",\"description\":\"d3\",\"icon\":\"i3\",\"smallIcon\":\"s3\"}"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(3))
.andExpect(jsonPath("$.name").value("tech"))
.andExpect(jsonPath("$.describe").value("d3"))
.andExpect(jsonPath("$.description").value("d3"))
.andExpect(jsonPath("$.icon").value("i3"))
.andExpect(jsonPath("$.smallIcon").value("s3"));
}

View File

@@ -54,12 +54,12 @@ class PostControllerTest {
Category cat = new Category();
cat.setId(1L);
cat.setName("tech");
cat.setDescribe("d");
cat.setDescription("d");
cat.setIcon("i");
Tag tag = new Tag();
tag.setId(1L);
tag.setName("java");
tag.setDescribe("td");
tag.setDescription("td");
tag.setIcon("ti");
Post post = new Post();
post.setId(1L);
@@ -91,12 +91,12 @@ class PostControllerTest {
Category cat = new Category();
cat.setId(1L);
cat.setName("tech");
cat.setDescribe("d");
cat.setDescription("d");
cat.setIcon("i");
Tag tag = new Tag();
tag.setId(1L);
tag.setName("java");
tag.setDescribe("td");
tag.setDescription("td");
tag.setIcon("ti");
Post post = new Post();
post.setId(2L);

View File

@@ -35,7 +35,7 @@ class TagControllerTest {
Tag t = new Tag();
t.setId(1L);
t.setName("java");
t.setDescribe("d");
t.setDescription("d");
t.setIcon("i");
t.setSmallIcon("s1");
Mockito.when(tagService.createTag(eq("java"), eq("d"), eq("i"), eq("s1"))).thenReturn(t);
@@ -43,10 +43,10 @@ class TagControllerTest {
mockMvc.perform(post("/api/tags")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"name\":\"java\",\"describe\":\"d\",\"icon\":\"i\",\"smallIcon\":\"s1\"}"))
.content("{\"name\":\"java\",\"description\":\"d\",\"icon\":\"i\",\"smallIcon\":\"s1\"}"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.name").value("java"))
.andExpect(jsonPath("$.describe").value("d"))
.andExpect(jsonPath("$.description").value("d"))
.andExpect(jsonPath("$.icon").value("i"))
.andExpect(jsonPath("$.smallIcon").value("s1"));
@@ -60,7 +60,7 @@ class TagControllerTest {
Tag t = new Tag();
t.setId(2L);
t.setName("spring");
t.setDescribe("d2");
t.setDescription("d2");
t.setIcon("i2");
t.setSmallIcon("s2");
Mockito.when(tagService.listTags()).thenReturn(List.of(t));
@@ -69,7 +69,7 @@ class TagControllerTest {
.andExpect(status().isOk())
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].name").value("spring"))
.andExpect(jsonPath("$[0].describe").value("d2"))
.andExpect(jsonPath("$[0].description").value("d2"))
.andExpect(jsonPath("$[0].icon").value("i2"))
.andExpect(jsonPath("$[0].smallIcon").value("s2"));
}
@@ -79,18 +79,18 @@ class TagControllerTest {
Tag t = new Tag();
t.setId(3L);
t.setName("java");
t.setDescribe("d3");
t.setDescription("d3");
t.setIcon("i3");
t.setSmallIcon("s3");
Mockito.when(tagService.updateTag(eq(3L), eq("java"), eq("d3"), eq("i3"), eq("s3"))).thenReturn(t);
mockMvc.perform(put("/api/tags/3")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"name\":\"java\",\"describe\":\"d3\",\"icon\":\"i3\",\"smallIcon\":\"s3\"}"))
.content("{\"name\":\"java\",\"description\":\"d3\",\"icon\":\"i3\",\"smallIcon\":\"s3\"}"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(3))
.andExpect(jsonPath("$.name").value("java"))
.andExpect(jsonPath("$.describe").value("d3"))
.andExpect(jsonPath("$.description").value("d3"))
.andExpect(jsonPath("$.icon").value("i3"))
.andExpect(jsonPath("$.smallIcon").value("s3"));
}