This is an automated email from the ASF dual-hosted git repository.

hefengen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 648c415cb3 [type:test][ISSUE #4540] add plugin test cases for admin 
(#5231)
648c415cb3 is described below

commit 648c415cb3f28cb1243f75a93716c258ab88a49c
Author: whenelse <[email protected]>
AuthorDate: Tue Oct 24 15:06:18 2023 +0800

    [type:test][ISSUE #4540] add plugin test cases for admin (#5231)
    
    * [type:test][ISSUE #4540] add plugin test cases for admin
    
    * [type:test][ISSUE #4540] add Apache License for plugin test cases for 
admin
    
    * [type:test][ISSUE #4540] add CheckStyle for plugin test cases for admin
    
    * [type:test][ISSUE #4540] add batch plugin test cases for admin
    
    * [type:test][ISSUE #4540] add plugin handle test cases for admin
    
    ---------
    
    Co-authored-by: Shibo Xia <[email protected]>
    Co-authored-by: moremind <[email protected]>
---
 .../handle/BatchPluginHandleChangedEventTest.java  |  67 ++++++++++++
 .../event/handle/PluginHandleChangedEventTest.java | 115 +++++++++++++++++++++
 .../event/plugin/BatchPluginChangedEventTest.java  |  72 +++++++++++++
 .../event/plugin/BatchPluginDeletedEventTest.java  |  71 +++++++++++++
 .../model/event/plugin/PluginChangedEventTest.java | 106 +++++++++++++++++++
 .../model/event/plugin/PluginCreatedEventTest.java |  61 +++++++++++
 6 files changed, 492 insertions(+)

diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/handle/BatchPluginHandleChangedEventTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/handle/BatchPluginHandleChangedEventTest.java
new file mode 100644
index 0000000000..02cac49cee
--- /dev/null
+++ 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/handle/BatchPluginHandleChangedEventTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.model.event.handle;
+
+import java.util.Arrays;
+import org.apache.shenyu.admin.model.entity.PluginHandleDO;
+import org.apache.shenyu.admin.model.enums.EventTypeEnum;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * test case for {@link BatchPluginHandleChangedEvent}.
+ */
+public class BatchPluginHandleChangedEventTest {
+
+    private PluginHandleDO one;
+
+    private PluginHandleDO two;
+
+    @BeforeEach
+    public void setUp() {
+        one = PluginHandleDO.builder()
+                .id("1")
+                .pluginId("1")
+                .field("testFieldOne")
+                .label("testLabelOne")
+                .dataType(1)
+                .type(1)
+                .sort(1)
+                .build();
+        two = PluginHandleDO.builder()
+                .id("2")
+                .pluginId("2")
+                .field("testFieldTwo")
+                .label("testLabelTwo")
+                .dataType(2)
+                .type(2)
+                .sort(2)
+                .build();
+    }
+
+    @Test
+    public void batchChangePluginHandleContextTest() {
+        BatchPluginHandleChangedEvent batchPluginHandleChangedEvent =
+                new BatchPluginHandleChangedEvent(Arrays.asList(one, two), 
null, EventTypeEnum.PLUGIN_HANDLE_DELETE, "test-operator");
+        String context =
+                String.format("the plugin handle[%s] is %s", 
"testFieldOne,testFieldTwo", 
EventTypeEnum.PLUGIN_HANDLE_DELETE.getType().toString().toLowerCase());
+        assertEquals(context, batchPluginHandleChangedEvent.buildContext());
+    }
+}
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/handle/PluginHandleChangedEventTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/handle/PluginHandleChangedEventTest.java
new file mode 100644
index 0000000000..cd9fb0cd5b
--- /dev/null
+++ 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/handle/PluginHandleChangedEventTest.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.model.event.handle;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.model.entity.PluginHandleDO;
+import org.apache.shenyu.admin.model.enums.EventTypeEnum;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * test case for {@link PluginHandleChangedEvent}.
+ */
+public class PluginHandleChangedEventTest {
+
+    private PluginHandleDO pluginHandleDO;
+
+    private PluginHandleDO withoutChangePluginHandleDO;
+
+    private PluginHandleDO changePluginHandleDO;
+
+    @BeforeEach
+    public void setUp() {
+        pluginHandleDO = PluginHandleDO.builder()
+                .id("1")
+                .pluginId("1")
+                .field("testField")
+                .label("testLabel")
+                .dataType(1)
+                .type(1)
+                .sort(1)
+                .build();
+        withoutChangePluginHandleDO = PluginHandleDO.builder()
+                .id("1")
+                .pluginId("1")
+                .field("testField")
+                .label("testLabel")
+                .dataType(1)
+                .type(1)
+                .sort(1)
+                .build();
+        changePluginHandleDO = PluginHandleDO.builder()
+                .id("1")
+                .pluginId("1")
+                .field("testField-change")
+                .label("testLabel-change")
+                .dataType(2)
+                .type(2)
+                .sort(2)
+                .build();
+    }
+
+    @Test
+    public void deletePluginHandleBuildContextTest() {
+        PluginHandleChangedEvent pluginChangedEvent = new 
PluginHandleChangedEvent(pluginHandleDO, null,
+                EventTypeEnum.PLUGIN_HANDLE_DELETE, "test-operator");
+        String context = String.format("the plugin-handle [%s] is %s", 
pluginHandleDO.getField(),
+                
StringUtils.lowerCase(EventTypeEnum.PLUGIN_HANDLE_DELETE.getType().toString()));
+        assertEquals(context, pluginChangedEvent.buildContext());
+    }
+
+    @Test
+    public void createPluginHandleBuildContextTest() {
+        PluginHandleChangedEvent pluginChangedEvent = new 
PluginHandleChangedEvent(pluginHandleDO, null,
+                EventTypeEnum.PLUGIN_HANDLE_CREATE, "test-operator");
+        String context = String.format("the plugin-handle [%s] is %s", 
pluginHandleDO.getField(),
+                
StringUtils.lowerCase(EventTypeEnum.PLUGIN_HANDLE_CREATE.getType().toString()));
+        assertEquals(context, pluginChangedEvent.buildContext());
+    }
+
+    @Test
+    public void updatePluginHandleBuildContextTest() {
+        String eventTypeStr = 
StringUtils.lowerCase(EventTypeEnum.PLUGIN_HANDLE_UPDATE.getType().toString());
+        PluginHandleChangedEvent pluginHandleUpdateEventWithoutChange =
+                new PluginHandleChangedEvent(pluginHandleDO, pluginHandleDO, 
EventTypeEnum.PLUGIN_HANDLE_UPDATE, "test-operator");
+        String withoutChangeContrast = "it no change";
+        String context =
+                String.format("the plugin-handle [%s] is %s : %s", 
pluginHandleDO.getField(), eventTypeStr, withoutChangeContrast);
+        assertEquals(context, 
pluginHandleUpdateEventWithoutChange.buildContext());
+
+        PluginHandleChangedEvent pluginHandleUpdateEventNotSameDO =
+                new PluginHandleChangedEvent(withoutChangePluginHandleDO, 
pluginHandleDO, EventTypeEnum.PLUGIN_HANDLE_UPDATE, "test-operator");
+        assertEquals(context, pluginHandleUpdateEventNotSameDO.buildContext());
+
+        final StringBuilder contrast = new StringBuilder();
+        contrast.append(String.format("field[%s => %s] ", 
pluginHandleDO.getField(), changePluginHandleDO.getField()));
+        contrast.append(String.format("label[%s => %s] ", 
pluginHandleDO.getLabel(), changePluginHandleDO.getLabel()));
+        contrast.append(String.format("type[%s => %s] ", 
pluginHandleDO.getType(), changePluginHandleDO.getType()));
+        contrast.append(String.format("dataType[%s => %s] ", 
pluginHandleDO.getDataType(), changePluginHandleDO.getDataType()));
+        contrast.append(String.format("sort[%s => %s] ", 
pluginHandleDO.getSort(), changePluginHandleDO.getSort()));
+        String changeContext = String.format("the plugin-handle [%s] is %s : 
%s", changePluginHandleDO.getField(), eventTypeStr, contrast);
+
+        PluginHandleChangedEvent pluginHandleUpdateEventChange =
+                new PluginHandleChangedEvent(changePluginHandleDO, 
pluginHandleDO, EventTypeEnum.PLUGIN_HANDLE_UPDATE, "test-operator");
+        assertEquals(changeContext, 
pluginHandleUpdateEventChange.buildContext());
+    }
+
+}
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/BatchPluginChangedEventTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/BatchPluginChangedEventTest.java
new file mode 100644
index 0000000000..23131458ac
--- /dev/null
+++ 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/BatchPluginChangedEventTest.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.model.event.plugin;
+
+import java.sql.Timestamp;
+import java.util.Arrays;
+import org.apache.shenyu.admin.model.entity.PluginDO;
+import org.apache.shenyu.admin.model.enums.EventTypeEnum;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * test cast for {@link BatchPluginChangedEvent}.
+ */
+public class BatchPluginChangedEventTest {
+
+    private PluginDO one;
+
+    private PluginDO two;
+
+    private BatchPluginChangedEvent changedEvent;
+
+    @BeforeEach
+    public void setUp() {
+        Timestamp now = new Timestamp(System.currentTimeMillis());
+        one = PluginDO.builder()
+                .id("1")
+                .name("test-plugin")
+                .config("{\"config\":\"test\"}")
+                .enabled(false)
+                .role("Test")
+                .sort(1)
+                .dateUpdated(now)
+                .dateCreated(now)
+                .build();
+        two = PluginDO.builder()
+                .id("2")
+                .name("test-plugin-two")
+                .config("{\"config\":\"test\"}")
+                .enabled(false)
+                .role("Test")
+                .sort(2)
+                .dateUpdated(now)
+                .dateCreated(now)
+                .build();
+
+        changedEvent = new BatchPluginChangedEvent(Arrays.asList(one, two), 
null, EventTypeEnum.PLUGIN_UPDATE, "test-operator");
+    }
+
+    @Test
+    public void batchChangePluginBuildContextTest() {
+        String context = String.format("the plugins[%s] is %s", 
"test-plugin,test-plugin-two", 
EventTypeEnum.PLUGIN_UPDATE.getType().toString().toLowerCase());
+        assertEquals(context, changedEvent.buildContext());
+    }
+}
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/BatchPluginDeletedEventTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/BatchPluginDeletedEventTest.java
new file mode 100644
index 0000000000..f2def452e9
--- /dev/null
+++ 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/BatchPluginDeletedEventTest.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.model.event.plugin;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import org.apache.shenyu.admin.model.entity.PluginDO;
+import org.apache.shenyu.admin.model.enums.EventTypeEnum;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+/**
+ *  test cast for {@link BatchPluginDeletedEvent}.
+ */
+public class BatchPluginDeletedEventTest {
+
+    private PluginDO one;
+
+    private PluginDO two;
+
+    private BatchPluginDeletedEvent deletedEvent;
+
+    @BeforeEach
+    public void setUp() {
+        Timestamp now = new Timestamp(System.currentTimeMillis());
+        one = PluginDO.builder()
+                .id("1")
+                .name("test-plugin")
+                .config("{\"config\":\"test\"}")
+                .enabled(false)
+                .role("Test")
+                .sort(1)
+                .dateUpdated(now)
+                .dateCreated(now)
+                .build();
+        two = PluginDO.builder()
+                .id("2")
+                .name("test-plugin-two")
+                .config("{\"config\":\"test\"}")
+                .enabled(false)
+                .role("Test")
+                .sort(2)
+                .dateUpdated(now)
+                .dateCreated(now)
+                .build();
+
+        deletedEvent = new BatchPluginDeletedEvent(Arrays.asList(one, two), 
"test-operator");
+    }
+
+    @Test
+    public void batchChangePluginBuildContextTest() {
+        String context = String.format("the plugins[%s] is %s", 
"test-plugin,test-plugin-two", 
EventTypeEnum.PLUGIN_DELETE.getType().toString().toLowerCase());
+        assertEquals(context, deletedEvent.buildContext());
+    }
+}
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/PluginChangedEventTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/PluginChangedEventTest.java
new file mode 100644
index 0000000000..1dbda70337
--- /dev/null
+++ 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/PluginChangedEventTest.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.model.event.plugin;
+
+import java.sql.Timestamp;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.model.entity.PluginDO;
+import org.apache.shenyu.admin.model.enums.EventTypeEnum;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * test cast for {@link PluginChangedEvent}.
+ */
+public class PluginChangedEventTest {
+
+    private PluginDO pluginDO;
+
+    private PluginDO withoutChangePluginDO;
+
+    private PluginDO changePluginDO;
+
+    @BeforeEach
+    public void setUp() {
+        Timestamp now = new Timestamp(System.currentTimeMillis());
+        pluginDO = PluginDO.builder()
+                .id("1")
+                .name("test-plugin")
+                .config("{\"config\":\"test\"}")
+                .enabled(false)
+                .role("Test")
+                .sort(1)
+                .dateUpdated(now)
+                .dateCreated(now)
+                .build();
+        withoutChangePluginDO = PluginDO.builder()
+                .id("1")
+                .name("test-plugin")
+                .config("{\"config\":\"test\"}")
+                .enabled(false)
+                .role("Test")
+                .sort(1)
+                .dateUpdated(now)
+                .dateCreated(now)
+                .build();
+        changePluginDO = PluginDO.builder()
+                .id("1")
+                .name("test-plugin-change")
+                .config("{\"config\":\"test-change\"}")
+                .enabled(true)
+                .role("TestChange")
+                .sort(2)
+                .dateUpdated(now)
+                .dateCreated(now)
+                .build();
+    }
+
+    @Test
+    public void deletePluginBuildContextTest() {
+        PluginChangedEvent pluginDeleteEvent = new 
PluginChangedEvent(pluginDO, null, EventTypeEnum.PLUGIN_DELETE, 
"test-operator");
+        String context =
+                String.format("the plugin [%s] is %s", pluginDO.getName(), 
StringUtils.lowerCase(EventTypeEnum.PLUGIN_DELETE.getType().toString()));
+        assertEquals(context, pluginDeleteEvent.buildContext());
+    }
+
+    @Test
+    public void updatePluginBuildContextTest() {
+        String eventTypeStr = 
StringUtils.lowerCase(EventTypeEnum.PLUGIN_UPDATE.getType().toString());
+        PluginChangedEvent pluginUpdateEventWithoutChange = new 
PluginChangedEvent(pluginDO, pluginDO, EventTypeEnum.PLUGIN_UPDATE, 
"test-operator");
+        String withoutChangeContrast = "it no change";
+        String context =
+                String.format("the plugin [%s] is %s : %s", 
pluginDO.getName(), eventTypeStr, withoutChangeContrast);
+        assertEquals(context, pluginUpdateEventWithoutChange.buildContext());
+
+        PluginChangedEvent pluginUpdateEventNotSameDO = new 
PluginChangedEvent(withoutChangePluginDO, pluginDO, 
EventTypeEnum.PLUGIN_UPDATE, "test-operator");
+        assertEquals(context, pluginUpdateEventNotSameDO.buildContext());
+
+        final StringBuilder contrast = new StringBuilder();
+        contrast.append(String.format("name[%s => %s] ", pluginDO.getName(), 
changePluginDO.getName()));
+        contrast.append(String.format("config[%s => %s] ", 
pluginDO.getConfig(), changePluginDO.getConfig()));
+        contrast.append(String.format("role[%s => %s] ", pluginDO.getRole(), 
changePluginDO.getRole()));
+        contrast.append(String.format("enable[%s => %s] ", 
pluginDO.getEnabled(), changePluginDO.getEnabled()));
+        contrast.append(String.format("sort[%s => %s] ", pluginDO.getSort(), 
changePluginDO.getSort()));
+        String changeContext = String.format("the plugin [%s] is %s : %s", 
changePluginDO.getName(), eventTypeStr, contrast);
+
+        PluginChangedEvent pluginUpdateEventChange = new 
PluginChangedEvent(changePluginDO, pluginDO, EventTypeEnum.PLUGIN_UPDATE, 
"test-operator");
+        assertEquals(changeContext, pluginUpdateEventChange.buildContext());
+    }
+}
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/PluginCreatedEventTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/PluginCreatedEventTest.java
new file mode 100644
index 0000000000..5456035832
--- /dev/null
+++ 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/plugin/PluginCreatedEventTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.model.event.plugin;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.model.entity.PluginDO;
+import org.apache.shenyu.admin.model.enums.EventTypeEnum;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * test cast for {@link PluginCreatedEvent}.
+ */
+public class PluginCreatedEventTest {
+
+    private PluginDO pluginDO;
+
+    private PluginCreatedEvent pluginCreateEvent;
+
+    @BeforeEach
+    public void setUp() {
+        pluginDO = PluginDO.builder()
+                .id("1")
+                .name("test-plugin")
+                .config("{\"config\":\"test\"}")
+                .enabled(false)
+                .role("Test")
+                .sort(1)
+                .build();
+        pluginCreateEvent = new PluginCreatedEvent(pluginDO, "test-operator");
+    }
+
+    @Test
+    public void createPluginBuildContextTest() {
+        String context =
+                String.format("the plugin [%s] is %s", pluginDO.getName(), 
StringUtils.lowerCase(EventTypeEnum.PLUGIN_CREATE.getType().toString()));
+        assertEquals(context, pluginCreateEvent.buildContext());
+    }
+
+    @Test
+    public void getSourceTest() {
+        assertEquals(pluginDO, pluginCreateEvent.getSource());
+    }
+}

Reply via email to