Github user kevdoran commented on a diff in the pull request:
https://github.com/apache/nifi-minifi/pull/120#discussion_r177852495
--- Diff:
minifi-c2/minifi-c2-framework/src/test/groovy/org/apache/nifi/minifi/c2/core/service/StandardC2ProtocolServiceSpec.groovy
---
@@ -0,0 +1,164 @@
+/*
+ * 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.nifi.minifi.c2.core.service
+
+import
org.apache.nifi.minifi.c2.api.provider.heartbeat.HeartbeatPersistenceProvider
+import org.apache.nifi.minifi.c2.model.*
+import spock.lang.Specification
+
+class StandardC2ProtocolServiceSpec extends Specification {
--- End diff --
Good question, @jzonthemtn. There is no technical/functional reason these
tests couldn't be written as Java junit tests. The groovy framework I'm using
here, [Spock](https://github.com/spockframework/spock), offers a few advantages:
- Detailed error messages for failed tests/assertions
- A reasonable terse/structured syntax that allows tests to serve as
feature/method requirements/specifications. This was really beneficial in
writing
[StandardC2ServiceSpec](https://github.com/apache/nifi-minifi/pull/120/files#diff-f485f870b41384487a26ff065fd25467),
which is extremely repetitive. I wanted the tests to be short and
self-descriptive so I could keep track of what combinations were covered.
- Powerful mocking capabilities (with some advantages over Java libs such
as Mockito)
- built-in test templating and data driven parameterization (although I did
not use that feature in this test cases).
---