Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some typos and unit tests. #1451

Merged
merged 1 commit into from
Jul 2, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@ public class ChartServiceTest extends TestApplication {

@Test
public void testCreateWithPermission() {
try {
userLoginIdentity(false, 4L);
userLoginIdentity(true, 3L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(false, 4L);
// userLoginIdentity(true, 3L);

ChartCreateParam createParam = new ChartCreateParam();
Optional.of(createParam).ifPresent(param -> {
Expand All @@ -61,12 +57,8 @@ public void testCreateWithPermission() {

@Test
public void testUpdateWithPermission() {
try {
userLoginIdentity(false, 1L);
userLoginIdentity(true, 4L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(false, 1L);
// userLoginIdentity(true, 4L);

ChartUpdateParam chartUpdateParam = new ChartUpdateParam();
Optional.of(chartUpdateParam).ifPresent(param -> {
Expand All @@ -87,12 +79,8 @@ public void testUpdateWithPermission() {

@Test
public void testFind() {
try {
userLoginIdentity(false, 6L);
userLoginIdentity(true, 8L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(false, 6L);
// userLoginIdentity(true, 8L);

DataResult<Chart> result = chartService.find(2L);
assertNotNull(result.getData());
Expand All @@ -101,12 +89,8 @@ public void testFind() {

@Test
public void testQueryExistent() {
try {
userLoginIdentity(false, 7L);
userLoginIdentity(true, 9L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(false, 7L);
// userLoginIdentity(true, 9L);

ChartQueryParam chartQueryParam = new ChartQueryParam();
chartQueryParam.setId(1L);
Expand All @@ -121,12 +105,8 @@ public void testQueryExistent() {

@Test
public void testListQuery() {
try {
userLoginIdentity(false, 8L);
userLoginIdentity(true, 10L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(false, 8L);
// userLoginIdentity(true, 10L);

ChartListQueryParam param = new ChartListQueryParam();
param.setIdList(Arrays.asList(4L, 5L, 6L));
Expand All @@ -140,25 +120,17 @@ public void testListQuery() {

@Test
public void testQueryByIds() {
try {
userLoginIdentity(false, 9L);
userLoginIdentity(true, 11L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(false, 9L);
// userLoginIdentity(true, 11L);

ListResult<Chart> chartListResult = chartService.queryByIds(Arrays.asList(1L, 2L, 3L));
assertNotNull(chartListResult);
}

@Test
public void testDeleteWithPermission() {
try {
userLoginIdentity(false, 10L);
userLoginIdentity(true, 12L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(false, 10L);
// userLoginIdentity(true, 12L);

ActionResult actionResult = chartService.deleteWithPermission(3L);
assertNotNull(actionResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ public class ConfigServiceTest extends TestApplication {

@Test
public void testCreate() {
try {
userLoginIdentity(true, 1L);
userLoginIdentity(false, 2L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(true, 1L);
// userLoginIdentity(false, 2L);

SystemConfigParam systemConfigParam = new SystemConfigParam();
Optional.ofNullable(systemConfigParam).ifPresent(param -> {
Expand All @@ -45,12 +41,8 @@ public void testCreate() {

@Test
public void testUpdate() {
try {
userLoginIdentity(true, 4L);
userLoginIdentity(false, 5L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(true, 4L);
// userLoginIdentity(false, 5L);

SystemConfigParam systemConfigParam = new SystemConfigParam();
systemConfigParam.setCode(RandomCodeGenerator.generateRandomCode(6));
Expand All @@ -64,12 +56,9 @@ public void testUpdate() {

@Test
public void testCreateOrUpdate() {
try {
userLoginIdentity(true, 3L);
userLoginIdentity(false, 6L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(true, 3L);
// userLoginIdentity(false, 6L);


SystemConfigParam systemConfigParam = new SystemConfigParam();
systemConfigParam.setCode(RandomCodeGenerator.generateRandomCode(6));
Expand All @@ -82,25 +71,17 @@ public void testCreateOrUpdate() {

@Test
public void testFind() {
try {
userLoginIdentity(true, 9L);
userLoginIdentity(false, 4L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(true, 9L);
// userLoginIdentity(false, 4L);

DataResult<Config> configDataResult = configService.find("4TxfzW");
assertNotNull(configDataResult.getData());
}

@Test
public void testDelete() {
try {
userLoginIdentity(true, 11L);
userLoginIdentity(false, 12L);
} catch (Exception e) {
throw new RuntimeException("An unexpected exception occurred during userLoginIdentity: " + e.getMessage());
}
userLoginIdentity(true, 11L);
// userLoginIdentity(false, 12L);

ActionResult result = configService.delete("4TxfzW");
assertNotNull(result);
Expand Down