Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
a1b28ea1
Unverified
Commit
a1b28ea1
authored
Aug 30, 2021
by
Gautier de Saint Martin Lacaze
Browse files
Migrate from JUnit 4 to JUnit 5
parent
73817d15
Changes
67
Hide whitespace changes
Inline
Side-by-side
src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java
View file @
a1b28ea1
...
@@ -28,7 +28,7 @@ import static org.gitlab4j.api.JsonUtils.readTreeFromResource;
...
@@ -28,7 +28,7 @@ import static org.gitlab4j.api.JsonUtils.readTreeFromResource;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
unmarshalResource
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
unmarshalResource
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
unmarshalResourceList
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
unmarshalResourceList
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
unmarshalResourceMap
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
unmarshalResourceMap
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -112,7 +112,7 @@ import org.gitlab4j.api.models.User;
...
@@ -112,7 +112,7 @@ import org.gitlab4j.api.models.User;
import
org.gitlab4j.api.models.Variable
;
import
org.gitlab4j.api.models.Variable
;
import
org.gitlab4j.api.services.JiraService
;
import
org.gitlab4j.api.services.JiraService
;
import
org.gitlab4j.api.services.SlackService
;
import
org.gitlab4j.api.services.SlackService
;
import
org.junit.Test
;
import
org.junit.
jupiter.api.
Test
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
src/test/java/org/gitlab4j/api/TestGitLabApiEvents.java
View file @
a1b28ea1
...
@@ -4,11 +4,11 @@ package org.gitlab4j.api;
...
@@ -4,11 +4,11 @@ package org.gitlab4j.api;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
compareJson
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
compareJson
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
readTreeFromResource
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
readTreeFromResource
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
unmarshalResource
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
unmarshalResource
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
...
@@ -25,7 +25,8 @@ import org.gitlab4j.api.systemhooks.SystemHookListener;
...
@@ -25,7 +25,8 @@ import org.gitlab4j.api.systemhooks.SystemHookListener;
import
org.gitlab4j.api.systemhooks.SystemHookManager
;
import
org.gitlab4j.api.systemhooks.SystemHookManager
;
import
org.gitlab4j.api.systemhooks.TeamMemberSystemHookEvent
;
import
org.gitlab4j.api.systemhooks.TeamMemberSystemHookEvent
;
import
org.gitlab4j.api.utils.JacksonJson
;
import
org.gitlab4j.api.utils.JacksonJson
;
import
org.gitlab4j.api.webhook.*
;
import
org.gitlab4j.api.webhook.BuildEvent
;
import
org.gitlab4j.api.webhook.ChangeContainer
;
import
org.gitlab4j.api.webhook.Event
;
import
org.gitlab4j.api.webhook.Event
;
import
org.gitlab4j.api.webhook.IssueEvent
;
import
org.gitlab4j.api.webhook.IssueEvent
;
import
org.gitlab4j.api.webhook.JobEvent
;
import
org.gitlab4j.api.webhook.JobEvent
;
...
@@ -35,9 +36,9 @@ import org.gitlab4j.api.webhook.PipelineEvent;
...
@@ -35,9 +36,9 @@ import org.gitlab4j.api.webhook.PipelineEvent;
import
org.gitlab4j.api.webhook.PushEvent
;
import
org.gitlab4j.api.webhook.PushEvent
;
import
org.gitlab4j.api.webhook.TagPushEvent
;
import
org.gitlab4j.api.webhook.TagPushEvent
;
import
org.gitlab4j.api.webhook.WikiPageEvent
;
import
org.gitlab4j.api.webhook.WikiPageEvent
;
import
org.junit.
AfterClass
;
import
org.junit.
jupiter.api.AfterAll
;
import
org.junit.Before
Class
;
import
org.junit.
jupiter.api.
Before
All
;
import
org.junit.Test
;
import
org.junit.
jupiter.api.
Test
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
...
@@ -52,14 +53,14 @@ public class TestGitLabApiEvents {
...
@@ -52,14 +53,14 @@ public class TestGitLabApiEvents {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
throws
Exception
{
public
static
void
setup
()
throws
Exception
{
jacksonJson
=
new
JacksonJson
();
jacksonJson
=
new
JacksonJson
();
jacksonJson
.
getObjectMapper
().
configure
(
SerializationFeature
.
ORDER_MAP_ENTRIES_BY_KEYS
,
true
);
jacksonJson
.
getObjectMapper
().
configure
(
SerializationFeature
.
ORDER_MAP_ENTRIES_BY_KEYS
,
true
);
savedLevel
=
GitLabApi
.
getLogger
().
getLevel
();
savedLevel
=
GitLabApi
.
getLogger
().
getLevel
();
}
}
@After
Class
@After
All
public
static
void
teardown
()
{
public
static
void
teardown
()
{
GitLabApi
.
getLogger
().
setLevel
(
savedLevel
);
GitLabApi
.
getLogger
().
setLevel
(
savedLevel
);
}
}
...
...
src/test/java/org/gitlab4j/api/TestGitLabApiException.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
fail
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -14,11 +14,12 @@ import javax.ws.rs.core.Response.Status;
...
@@ -14,11 +14,12 @@ import javax.ws.rs.core.Response.Status;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Visibility
;
import
org.gitlab4j.api.models.Visibility
;
import
org.junit.AfterClass
;
import
org.junit.jupiter.api.AfterAll
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
...
@@ -29,7 +30,8 @@ import org.junit.experimental.categories.Category;
...
@@ -29,7 +30,8 @@ import org.junit.experimental.categories.Category;
*
*
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
public
class
TestGitLabApiException
extends
AbstractIntegrationTest
{
public
class
TestGitLabApiException
extends
AbstractIntegrationTest
{
private
static
final
String
TEST_PROJECT_NAME_DUPLICATE
=
"test-gitlab4j-create-project-duplicate"
;
private
static
final
String
TEST_PROJECT_NAME_DUPLICATE
=
"test-gitlab4j-create-project-duplicate"
;
...
@@ -45,7 +47,7 @@ public class TestGitLabApiException extends AbstractIntegrationTest {
...
@@ -45,7 +47,7 @@ public class TestGitLabApiException extends AbstractIntegrationTest {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
// Must setup the connection to the GitLab test server
// Must setup the connection to the GitLab test server
gitLabApi
=
baseTestSetup
();
gitLabApi
=
baseTestSetup
();
...
@@ -53,7 +55,7 @@ public class TestGitLabApiException extends AbstractIntegrationTest {
...
@@ -53,7 +55,7 @@ public class TestGitLabApiException extends AbstractIntegrationTest {
deleteAllTestProjects
();
deleteAllTestProjects
();
}
}
@After
Class
@After
All
public
static
void
teardown
()
throws
GitLabApiException
{
public
static
void
teardown
()
throws
GitLabApiException
{
deleteAllTestProjects
();
deleteAllTestProjects
();
}
}
...
@@ -67,9 +69,9 @@ public class TestGitLabApiException extends AbstractIntegrationTest {
...
@@ -67,9 +69,9 @@ public class TestGitLabApiException extends AbstractIntegrationTest {
}
}
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assume
NotNull
(
gitLabApi
);
assume
True
(
gitLabApi
!=
null
);
}
}
@Test
@Test
...
...
src/test/java/org/gitlab4j/api/TestGitLabLogin.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
org.gitlab4j.api.models.Version
;
import
org.gitlab4j.api.models.Version
;
import
org.gitlab4j.api.utils.SecretString
;
import
org.gitlab4j.api.utils.SecretString
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
*
*
* TEST_HOST_URL
* TEST_HOST_URL
* TEST_LOGIN_USERNAME
* TEST_LOGIN_USERNAME
* TEST_LOGIN_PASSWORD
* TEST_LOGIN_PASSWORD
* TEST_PRIVATE_TOKEN
* TEST_PRIVATE_TOKEN
*
*
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
public
class
TestGitLabLogin
implements
PropertyConstants
{
public
class
TestGitLabLogin
implements
PropertyConstants
{
// The following needs to be set to your test repository
// The following needs to be set to your test repository
...
@@ -35,7 +37,7 @@ public class TestGitLabLogin implements PropertyConstants {
...
@@ -35,7 +37,7 @@ public class TestGitLabLogin implements PropertyConstants {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
problems
=
""
;
problems
=
""
;
...
@@ -61,7 +63,7 @@ public class TestGitLabLogin implements PropertyConstants {
...
@@ -61,7 +63,7 @@ public class TestGitLabLogin implements PropertyConstants {
}
}
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assumeTrue
(
problems
!=
null
&&
problems
.
isEmpty
());
assumeTrue
(
problems
!=
null
&&
problems
.
isEmpty
());
}
}
...
...
src/test/java/org/gitlab4j/api/TestGroupApi.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
...
@@ -19,11 +18,12 @@ import org.gitlab4j.api.models.Group;
...
@@ -19,11 +18,12 @@ import org.gitlab4j.api.models.Group;
import
org.gitlab4j.api.models.GroupParams
;
import
org.gitlab4j.api.models.GroupParams
;
import
org.gitlab4j.api.models.Member
;
import
org.gitlab4j.api.models.Member
;
import
org.gitlab4j.api.models.User
;
import
org.gitlab4j.api.models.User
;
import
org.junit.AfterClass
;
import
org.junit.jupiter.api.AfterAll
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
...
@@ -37,7 +37,8 @@ import org.junit.experimental.categories.Category;
...
@@ -37,7 +37,8 @@ import org.junit.experimental.categories.Category;
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*
*
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
public
class
TestGroupApi
extends
AbstractIntegrationTest
{
public
class
TestGroupApi
extends
AbstractIntegrationTest
{
// The following needs to be set to your test repository
// The following needs to be set to your test repository
...
@@ -53,7 +54,7 @@ public class TestGroupApi extends AbstractIntegrationTest {
...
@@ -53,7 +54,7 @@ public class TestGroupApi extends AbstractIntegrationTest {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
// Must setup the connection to the GitLab test server
// Must setup the connection to the GitLab test server
...
@@ -84,7 +85,7 @@ public class TestGroupApi extends AbstractIntegrationTest {
...
@@ -84,7 +85,7 @@ public class TestGroupApi extends AbstractIntegrationTest {
removeGroupMembers
();
removeGroupMembers
();
}
}
@After
Class
@After
All
public
static
void
teardown
()
{
public
static
void
teardown
()
{
removeGroupMembers
();
removeGroupMembers
();
}
}
...
@@ -113,11 +114,11 @@ public class TestGroupApi extends AbstractIntegrationTest {
...
@@ -113,11 +114,11 @@ public class TestGroupApi extends AbstractIntegrationTest {
}
}
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assume
NotNull
(
gitLabApi
);
assume
True
(
gitLabApi
!=
null
);
assume
NotNull
(
testGroup
);
assume
True
(
testGroup
!=
null
);
assume
NotNull
(
testUser
);
assume
True
(
testUser
!=
null
);
}
}
@Test
@Test
...
...
src/test/java/org/gitlab4j/api/TestGroupCustomAttributes.java
View file @
a1b28ea1
...
@@ -23,11 +23,11 @@
...
@@ -23,11 +23,11 @@
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
...
@@ -35,11 +35,12 @@ import java.util.stream.Stream;
...
@@ -35,11 +35,12 @@ import java.util.stream.Stream;
import
org.gitlab4j.api.models.CustomAttribute
;
import
org.gitlab4j.api.models.CustomAttribute
;
import
org.gitlab4j.api.models.Group
;
import
org.gitlab4j.api.models.Group
;
import
org.junit.AfterClass
;
import
org.junit.jupiter.api.AfterAll
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
...
@@ -51,7 +52,8 @@ import org.junit.experimental.categories.Category;
...
@@ -51,7 +52,8 @@ import org.junit.experimental.categories.Category;
*
*
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
public
class
TestGroupCustomAttributes
extends
AbstractIntegrationTest
{
public
class
TestGroupCustomAttributes
extends
AbstractIntegrationTest
{
private
static
final
String
TEST_CUSTOM_ATTRIBUTE_KEY
=
"GitLab4JCustomAttributeTestKey"
;
private
static
final
String
TEST_CUSTOM_ATTRIBUTE_KEY
=
"GitLab4JCustomAttributeTestKey"
;
...
@@ -64,7 +66,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
...
@@ -64,7 +66,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
// Must setup the connection to the GitLab test server and get the test Group instance
// Must setup the connection to the GitLab test server and get the test Group instance
...
@@ -74,7 +76,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
...
@@ -74,7 +76,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
deleteAllTestCustomAttributes
();
deleteAllTestCustomAttributes
();
}
}
@After
Class
@After
All
public
static
void
teardown
()
throws
GitLabApiException
{
public
static
void
teardown
()
throws
GitLabApiException
{
deleteAllTestCustomAttributes
();
deleteAllTestCustomAttributes
();
}
}
...
@@ -95,9 +97,9 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
...
@@ -95,9 +97,9 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
}
}
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assume
NotNull
(
gitLabApi
);
assume
True
(
gitLabApi
!=
null
);
}
}
private
CustomAttribute
createCustomAttribute
(
String
key
,
String
value
)
throws
GitLabApiException
{
private
CustomAttribute
createCustomAttribute
(
String
key
,
String
value
)
throws
GitLabApiException
{
...
@@ -116,7 +118,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
...
@@ -116,7 +118,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
@Test
@Test
public
void
testUpdate
()
throws
GitLabApiException
{
public
void
testUpdate
()
throws
GitLabApiException
{
assume
NotNull
(
testGroup
);
assume
True
(
testGroup
!=
null
);
String
key
=
TEST_CUSTOM_ATTRIBUTE_KEY
+
"TestUpdate"
;
String
key
=
TEST_CUSTOM_ATTRIBUTE_KEY
+
"TestUpdate"
;
String
value
=
TEST_CUSTOM_ATTRIBUTE_VALUE
;
String
value
=
TEST_CUSTOM_ATTRIBUTE_VALUE
;
...
@@ -134,7 +136,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
...
@@ -134,7 +136,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
@Test
@Test
public
void
testGetCustomAttribute
()
throws
GitLabApiException
{
public
void
testGetCustomAttribute
()
throws
GitLabApiException
{
assume
NotNull
(
testGroup
);
assume
True
(
testGroup
!=
null
);
String
key
=
TEST_CUSTOM_ATTRIBUTE_KEY
+
"TestGet"
;
String
key
=
TEST_CUSTOM_ATTRIBUTE_KEY
+
"TestGet"
;
String
value
=
TEST_CUSTOM_ATTRIBUTE_VALUE
+
" (test get)"
;
String
value
=
TEST_CUSTOM_ATTRIBUTE_VALUE
+
" (test get)"
;
...
@@ -151,7 +153,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
...
@@ -151,7 +153,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
@Test
@Test
public
void
testListCustomAttributes
()
throws
GitLabApiException
{
public
void
testListCustomAttributes
()
throws
GitLabApiException
{
assume
NotNull
(
testGroup
);
assume
True
(
testGroup
!=
null
);
String
key
=
TEST_CUSTOM_ATTRIBUTE_KEY
+
"TestList"
;
String
key
=
TEST_CUSTOM_ATTRIBUTE_KEY
+
"TestList"
;
String
value
=
TEST_CUSTOM_ATTRIBUTE_VALUE
+
" (test list)"
;
String
value
=
TEST_CUSTOM_ATTRIBUTE_VALUE
+
" (test list)"
;
...
@@ -171,7 +173,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
...
@@ -171,7 +173,7 @@ public class TestGroupCustomAttributes extends AbstractIntegrationTest {
@Test
@Test
public
void
testDeleteCustomAttribute
()
throws
GitLabApiException
{
public
void
testDeleteCustomAttribute
()
throws
GitLabApiException
{
assume
NotNull
(
testGroup
);
assume
True
(
testGroup
!=
null
);
String
key
=
TEST_CUSTOM_ATTRIBUTE_KEY
+
"TestDelete"
;
String
key
=
TEST_CUSTOM_ATTRIBUTE_KEY
+
"TestDelete"
;
String
value
=
TEST_CUSTOM_ATTRIBUTE_VALUE
+
" (test delete)"
;
String
value
=
TEST_CUSTOM_ATTRIBUTE_VALUE
+
" (test delete)"
;
...
...
src/test/java/org/gitlab4j/api/TestHealthCheckApi.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
org.gitlab4j.api.models.HealthCheckInfo
;
import
org.gitlab4j.api.models.HealthCheckInfo
;
import
org.gitlab4j.api.utils.AccessTokenUtils
;
import
org.gitlab4j.api.utils.AccessTokenUtils
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
...
@@ -19,7 +20,8 @@ import org.junit.experimental.categories.Category;
...
@@ -19,7 +20,8 @@ import org.junit.experimental.categories.Category;
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*
*
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
public
class
TestHealthCheckApi
implements
PropertyConstants
{
public
class
TestHealthCheckApi
implements
PropertyConstants
{
// The following needs to be set to your test repository
// The following needs to be set to your test repository
...
@@ -33,7 +35,7 @@ public class TestHealthCheckApi implements PropertyConstants {
...
@@ -33,7 +35,7 @@ public class TestHealthCheckApi implements PropertyConstants {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
throws
GitLabApiException
{
public
static
void
setup
()
throws
GitLabApiException
{
String
problems
=
""
;
String
problems
=
""
;
...
@@ -59,7 +61,7 @@ public class TestHealthCheckApi implements PropertyConstants {
...
@@ -59,7 +61,7 @@ public class TestHealthCheckApi implements PropertyConstants {
}
}
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assumeTrue
(
gitLabApi
!=
null
);
assumeTrue
(
gitLabApi
!=
null
);
}
}
...
...
src/test/java/org/gitlab4j/api/TestISO8601.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertEquals
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.Date
;
import
org.gitlab4j.api.utils.ISO8601
;
import
org.gitlab4j.api.utils.ISO8601
;
import
org.junit.Test
;
import
org.junit.
jupiter.api.
Test
;
public
class
TestISO8601
{
public
class
TestISO8601
{
...
...
src/test/java/org/gitlab4j/api/TestIgnoreCertificateErrors.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.models.Version
;
import
org.gitlab4j.api.models.Version
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
...
@@ -21,7 +22,8 @@ import org.junit.experimental.categories.Category;
...
@@ -21,7 +22,8 @@ import org.junit.experimental.categories.Category;
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*
*
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
public
class
TestIgnoreCertificateErrors
implements
PropertyConstants
{
public
class
TestIgnoreCertificateErrors
implements
PropertyConstants
{
// The following needs to be set to your test repository
// The following needs to be set to your test repository
...
@@ -34,7 +36,7 @@ public class TestIgnoreCertificateErrors implements PropertyConstants {
...
@@ -34,7 +36,7 @@ public class TestIgnoreCertificateErrors implements PropertyConstants {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
String
problems
=
""
;
String
problems
=
""
;
...
@@ -54,7 +56,7 @@ public class TestIgnoreCertificateErrors implements PropertyConstants {
...
@@ -54,7 +56,7 @@ public class TestIgnoreCertificateErrors implements PropertyConstants {
}
}
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assumeTrue
(
setupOk
);
assumeTrue
(
setupOk
);
}
}
...
...
src/test/java/org/gitlab4j/api/TestImportExportApi.java
View file @
a1b28ea1
...
@@ -23,11 +23,11 @@
...
@@ -23,11 +23,11 @@
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
fail
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
java.io.File
;
import
java.io.File
;
import
java.util.Optional
;
import
java.util.Optional
;
...
@@ -35,13 +35,14 @@ import java.util.Optional;
...
@@ -35,13 +35,14 @@ import java.util.Optional;
import
org.gitlab4j.api.models.ExportStatus
;
import
org.gitlab4j.api.models.ExportStatus
;
import
org.gitlab4j.api.models.ImportStatus
;
import
org.gitlab4j.api.models.ImportStatus
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.junit.AfterClass
;
import
org.junit.jupiter.api.AfterAll
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.FixMethodOrder
;
import
org.junit.jupiter.api.MethodOrderer
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.runners.MethodSorters
;
import
org.junit.jupiter.api.TestMethodOrder
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
...
@@ -53,8 +54,9 @@ import org.junit.runners.MethodSorters;
...
@@ -53,8 +54,9 @@ import org.junit.runners.MethodSorters;
*
*
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
@TestMethodOrder
(
MethodOrderer
.
MethodName
.
class
)
public
class
TestImportExportApi
extends
AbstractIntegrationTest
{
public
class
TestImportExportApi
extends
AbstractIntegrationTest
{
private
static
final
String
TEST_IMPORT_PROJECT_NAME
=
"test-import-project"
;
private
static
final
String
TEST_IMPORT_PROJECT_NAME
=
"test-import-project"
;
...
@@ -65,7 +67,7 @@ public class TestImportExportApi extends AbstractIntegrationTest {
...
@@ -65,7 +67,7 @@ public class TestImportExportApi extends AbstractIntegrationTest {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
// Must setup the connection to the GitLab test server
// Must setup the connection to the GitLab test server
...
@@ -75,7 +77,7 @@ public class TestImportExportApi extends AbstractIntegrationTest {
...
@@ -75,7 +77,7 @@ public class TestImportExportApi extends AbstractIntegrationTest {
deleteAllTestProjects
();
deleteAllTestProjects
();
}
}
@After
Class
@After
All
public
static
void
teardown
()
throws
GitLabApiException
{
public
static
void
teardown
()
throws
GitLabApiException
{
deleteAllTestProjects
();
deleteAllTestProjects
();
}
}
...
@@ -91,16 +93,16 @@ public class TestImportExportApi extends AbstractIntegrationTest {
...
@@ -91,16 +93,16 @@ public class TestImportExportApi extends AbstractIntegrationTest {
}
catch
(
GitLabApiException
ignore
)
{}
}
catch
(
GitLabApiException
ignore
)
{}
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assume
NotNull
(
gitLabApi
);
assume
True
(
gitLabApi
!=
null
);
}
}
@Test
@Test
public
void
testExportDownloadAndImport
()
throws
GitLabApiException
{
public
void
testExportDownloadAndImport
()
throws
GitLabApiException
{
// Arrange
// Arrange
assume
NotNull
(
testProject
);
assume
True
(
testProject
!=
null
);
// Act
// Act
gitLabApi
.
getImportExportApi
().
scheduleExport
(
testProject
);
gitLabApi
.
getImportExportApi
().
scheduleExport
(
testProject
);
...
...
src/test/java/org/gitlab4j/api/TestIssueDiscussionsApi.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
compareJson
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
compareJson
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
mockito
.
MockitoAnnotations
.
init
Mocks
;
import
static
org
.
mockito
.
MockitoAnnotations
.
open
Mocks
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -14,8 +14,8 @@ import java.util.stream.Stream;
...
@@ -14,8 +14,8 @@ import java.util.stream.Stream;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.ws.rs.core.MultivaluedMap
;
import
org.gitlab4j.api.models.Discussion
;
import
org.gitlab4j.api.models.Discussion
;
import
org.junit.Before
;
import
org.junit.
jupiter.api.
Before
Each
;
import
org.junit.Test
;
import
org.junit.
jupiter.api.
Test
;
import
org.mockito.ArgumentCaptor
;
import
org.mockito.ArgumentCaptor
;
import
org.mockito.Captor
;
import
org.mockito.Captor
;
import
org.mockito.Mock
;
import
org.mockito.Mock
;
...
@@ -28,9 +28,9 @@ public class TestIssueDiscussionsApi implements Constants {
...
@@ -28,9 +28,9 @@ public class TestIssueDiscussionsApi implements Constants {
@Captor
private
ArgumentCaptor
<
MultivaluedMap
<
String
,
String
>>
attributeCaptor
;
@Captor
private
ArgumentCaptor
<
MultivaluedMap
<
String
,
String
>>
attributeCaptor
;
private
MockResponse
response
;
private
MockResponse
response
;
@Before
@Before
Each
public
void
setUp
()
throws
Exception
{
public
void
setUp
()
throws
Exception
{
init
Mocks
(
this
);
open
Mocks
(
this
);
response
=
new
MockResponse
(
Discussion
.
class
,
null
,
"issue-discussions.json"
);
response
=
new
MockResponse
(
Discussion
.
class
,
null
,
"issue-discussions.json"
);
when
(
gitLabApi
.
getApiClient
()).
thenReturn
(
gitLabApiClient
);
when
(
gitLabApi
.
getApiClient
()).
thenReturn
(
gitLabApiClient
);
when
(
gitLabApiClient
.
validateSecretToken
(
any
())).
thenReturn
(
true
);
when
(
gitLabApiClient
.
validateSecretToken
(
any
())).
thenReturn
(
true
);
...
...
src/test/java/org/gitlab4j/api/TestIssuesApi.java
View file @
a1b28ea1
...
@@ -23,11 +23,11 @@
...
@@ -23,11 +23,11 @@
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -44,11 +44,12 @@ import org.gitlab4j.api.models.Issue;
...
@@ -44,11 +44,12 @@ import org.gitlab4j.api.models.Issue;
import
org.gitlab4j.api.models.IssueFilter
;
import
org.gitlab4j.api.models.IssueFilter
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.TimeStats
;
import
org.gitlab4j.api.models.TimeStats
;
import
org.junit.AfterClass
;
import
org.junit.jupiter.api.AfterAll
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
...
@@ -60,7 +61,8 @@ import org.junit.experimental.categories.Category;
...
@@ -60,7 +61,8 @@ import org.junit.experimental.categories.Category;
*
*
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
public
class
TestIssuesApi
extends
AbstractIntegrationTest
{
public
class
TestIssuesApi
extends
AbstractIntegrationTest
{
private
static
GitLabApi
gitLabApi
;
private
static
GitLabApi
gitLabApi
;
...
@@ -76,7 +78,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
...
@@ -76,7 +78,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
// Must setup the connection to the GitLab test server and get the test Project instance
// Must setup the connection to the GitLab test server and get the test Project instance
...
@@ -91,12 +93,12 @@ public class TestIssuesApi extends AbstractIntegrationTest {
...
@@ -91,12 +93,12 @@ public class TestIssuesApi extends AbstractIntegrationTest {
deleteAllTestIssues
();
deleteAllTestIssues
();
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assume
NotNull
(
gitLabApi
);
assume
True
(
gitLabApi
!=
null
);
}
}
@After
Class
@After
All
public
static
void
teardown
()
throws
GitLabApiException
{
public
static
void
teardown
()
throws
GitLabApiException
{
deleteAllTestIssues
();
deleteAllTestIssues
();
}
}
...
@@ -157,7 +159,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
...
@@ -157,7 +159,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
@Test
@Test
public
void
testGetGroupIssues
()
throws
GitLabApiException
{
public
void
testGetGroupIssues
()
throws
GitLabApiException
{
assume
NotNull
(
testGroup
);
assume
True
(
testGroup
!=
null
);
List
<
Issue
>
issues
=
gitLabApi
.
getIssuesApi
().
getGroupIssues
(
testGroup
);
List
<
Issue
>
issues
=
gitLabApi
.
getIssuesApi
().
getGroupIssues
(
testGroup
);
assertNotNull
(
issues
);
assertNotNull
(
issues
);
}
}
...
...
src/test/java/org/gitlab4j/api/TestJobApi.java
View file @
a1b28ea1
...
@@ -23,18 +23,19 @@
...
@@ -23,18 +23,19 @@
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
java.util.List
;
import
java.util.List
;
import
org.gitlab4j.api.models.Job
;
import
org.gitlab4j.api.models.Job
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.junit.AfterClass
;
import
org.junit.jupiter.api.AfterAll
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
...
@@ -46,7 +47,8 @@ import org.junit.experimental.categories.Category;
...
@@ -46,7 +47,8 @@ import org.junit.experimental.categories.Category;
* <p>
* <p>
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
public
class
TestJobApi
extends
AbstractIntegrationTest
{
public
class
TestJobApi
extends
AbstractIntegrationTest
{
private
static
GitLabApi
gitLabApi
;
private
static
GitLabApi
gitLabApi
;
...
@@ -56,20 +58,20 @@ public class TestJobApi extends AbstractIntegrationTest {
...
@@ -56,20 +58,20 @@ public class TestJobApi extends AbstractIntegrationTest {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
// Must setup the connection to the GitLab test server and get the test Project instance
// Must setup the connection to the GitLab test server and get the test Project instance
gitLabApi
=
baseTestSetup
();
gitLabApi
=
baseTestSetup
();
testProject
=
getTestProject
();
testProject
=
getTestProject
();
}
}
@After
Class
@After
All
public
static
void
teardown
()
throws
GitLabApiException
{
public
static
void
teardown
()
throws
GitLabApiException
{
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assume
NotNull
(
testProject
);
assume
True
(
testProject
!=
null
);
}
}
@Test
@Test
...
...
src/test/java/org/gitlab4j/api/TestLabelsApi.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
...
@@ -13,13 +13,15 @@ import java.util.stream.Stream;
...
@@ -13,13 +13,15 @@ import java.util.stream.Stream;
import
org.gitlab4j.api.models.Group
;
import
org.gitlab4j.api.models.Group
;
import
org.gitlab4j.api.models.Label
;
import
org.gitlab4j.api.models.Label
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.junit.AfterClass
;
import
org.junit.jupiter.api.AfterAll
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
public
class
TestLabelsApi
extends
AbstractIntegrationTest
{
public
class
TestLabelsApi
extends
AbstractIntegrationTest
{
private
static
final
String
TEST_GROUP
=
HelperUtils
.
getProperty
(
GROUP_KEY
);
private
static
final
String
TEST_GROUP
=
HelperUtils
.
getProperty
(
GROUP_KEY
);
...
@@ -36,7 +38,7 @@ public class TestLabelsApi extends AbstractIntegrationTest {
...
@@ -36,7 +38,7 @@ public class TestLabelsApi extends AbstractIntegrationTest {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
testSetup
()
{
public
static
void
testSetup
()
{
// Must setup the connection to the GitLab test server and get the test Project instance
// Must setup the connection to the GitLab test server and get the test Project instance
...
@@ -60,7 +62,7 @@ public class TestLabelsApi extends AbstractIntegrationTest {
...
@@ -60,7 +62,7 @@ public class TestLabelsApi extends AbstractIntegrationTest {
deleteTestLabels
();
deleteTestLabels
();
}
}
@After
Class
@After
All
public
static
void
tearDown
()
{
public
static
void
tearDown
()
{
deleteTestLabels
();
deleteTestLabels
();
}
}
...
@@ -86,7 +88,7 @@ public class TestLabelsApi extends AbstractIntegrationTest {
...
@@ -86,7 +88,7 @@ public class TestLabelsApi extends AbstractIntegrationTest {
}
}
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assumeTrue
(
testProject
!=
null
);
assumeTrue
(
testProject
!=
null
);
}
}
...
...
src/test/java/org/gitlab4j/api/TestMarkdownApi.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
org.gitlab4j.api.models.Markdown
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
org.junit.Before
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.junit.experimental.categories.Category
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
@Category
(
IntegrationTest
.
class
)
import
org.gitlab4j.api.models.Markdown
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
@Tag
(
"integration"
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
public
class
TestMarkdownApi
extends
AbstractIntegrationTest
{
public
class
TestMarkdownApi
extends
AbstractIntegrationTest
{
private
static
final
String
EXPECTED_HTML_FOR_SPECIAL
=
"<p data-sourcepos=\"1:1-1:104\" dir=\"auto\">Hello world! <gl-emoji title=\"party popper\" data-name=\"tada\" data-unicode-version=\"6.0\">🎉</gl-emoji> <code>xml <profiles> <version>${maven-surefire-plugin.version}</version> </profiles></code></p>"
;
private
static
final
String
EXPECTED_HTML_FOR_SPECIAL
=
"<p data-sourcepos=\"1:1-1:104\" dir=\"auto\">Hello world! <gl-emoji title=\"party popper\" data-name=\"tada\" data-unicode-version=\"6.0\">🎉</gl-emoji> <code>xml <profiles> <version>${maven-surefire-plugin.version}</version> </profiles></code></p>"
;
...
@@ -30,12 +32,12 @@ public class TestMarkdownApi extends AbstractIntegrationTest {
...
@@ -30,12 +32,12 @@ public class TestMarkdownApi extends AbstractIntegrationTest {
private
static
GitLabApi
gitLabApi
;
private
static
GitLabApi
gitLabApi
;
@Before
Class
@Before
All
public
static
void
setUp
()
throws
Exception
{
public
static
void
setUp
()
throws
Exception
{
gitLabApi
=
baseTestSetup
();
gitLabApi
=
baseTestSetup
();
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assumeTrue
(
gitLabApi
!=
null
);
assumeTrue
(
gitLabApi
!=
null
);
}
}
...
...
src/test/java/org/gitlab4j/api/TestMergeRequestApi.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
fail
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
...
@@ -21,13 +21,14 @@ import org.gitlab4j.api.models.Pipeline;
...
@@ -21,13 +21,14 @@ import org.gitlab4j.api.models.Pipeline;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.RepositoryFile
;
import
org.gitlab4j.api.models.RepositoryFile
;
import
org.gitlab4j.api.models.User
;
import
org.gitlab4j.api.models.User
;
import
org.junit.AfterClass
;
import
org.junit.jupiter.api.AfterAll
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.FixMethodOrder
;
import
org.junit.jupiter.api.MethodOrderer
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.runners.MethodSorters
;
import
org.junit.jupiter.api.TestMethodOrder
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
...
@@ -41,8 +42,9 @@ import org.junit.runners.MethodSorters;
...
@@ -41,8 +42,9 @@ import org.junit.runners.MethodSorters;
*
*
* NOTE: &FixMethodOrder(MethodSorters.NAME_ASCENDING) is very important to insure that testCreate() is executed first.
* NOTE: &FixMethodOrder(MethodSorters.NAME_ASCENDING) is very important to insure that testCreate() is executed first.
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
@TestMethodOrder
(
MethodOrderer
.
MethodName
.
class
)
public
class
TestMergeRequestApi
extends
AbstractIntegrationTest
{
public
class
TestMergeRequestApi
extends
AbstractIntegrationTest
{
private
static
final
String
TEST_BRANCH_NAME
=
"feature/gitlab4j-merge-request-test"
;
private
static
final
String
TEST_BRANCH_NAME
=
"feature/gitlab4j-merge-request-test"
;
...
@@ -59,7 +61,7 @@ public class TestMergeRequestApi extends AbstractIntegrationTest {
...
@@ -59,7 +61,7 @@ public class TestMergeRequestApi extends AbstractIntegrationTest {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
// Must setup the connection to the GitLab test server
// Must setup the connection to the GitLab test server
...
@@ -70,7 +72,7 @@ public class TestMergeRequestApi extends AbstractIntegrationTest {
...
@@ -70,7 +72,7 @@ public class TestMergeRequestApi extends AbstractIntegrationTest {
teardown
();
teardown
();
}
}
@After
Class
@After
All
public
static
void
teardown
()
{
public
static
void
teardown
()
{
if
(
testProject
==
null
)
{
if
(
testProject
==
null
)
{
...
@@ -101,9 +103,9 @@ public class TestMergeRequestApi extends AbstractIntegrationTest {
...
@@ -101,9 +103,9 @@ public class TestMergeRequestApi extends AbstractIntegrationTest {
}
}
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assume
NotNull
(
testProject
);
assume
True
(
testProject
!=
null
);
}
}
@Test
@Test
...
...
src/test/java/org/gitlab4j/api/TestMergeRequestDiscussionsApi.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
compareJson
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
compareJson
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
mockito
.
MockitoAnnotations
.
init
Mocks
;
import
static
org
.
mockito
.
MockitoAnnotations
.
open
Mocks
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -14,8 +14,8 @@ import java.util.stream.Stream;
...
@@ -14,8 +14,8 @@ import java.util.stream.Stream;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.ws.rs.core.MultivaluedMap
;
import
org.gitlab4j.api.models.Discussion
;
import
org.gitlab4j.api.models.Discussion
;
import
org.junit.Before
;
import
org.junit.
jupiter.api.
Before
Each
;
import
org.junit.Test
;
import
org.junit.
jupiter.api.
Test
;
import
org.mockito.ArgumentCaptor
;
import
org.mockito.ArgumentCaptor
;
import
org.mockito.Captor
;
import
org.mockito.Captor
;
import
org.mockito.Mock
;
import
org.mockito.Mock
;
...
@@ -28,9 +28,9 @@ public class TestMergeRequestDiscussionsApi implements Constants {
...
@@ -28,9 +28,9 @@ public class TestMergeRequestDiscussionsApi implements Constants {
@Captor
private
ArgumentCaptor
<
MultivaluedMap
<
String
,
String
>>
attributeCaptor
;
@Captor
private
ArgumentCaptor
<
MultivaluedMap
<
String
,
String
>>
attributeCaptor
;
private
MockResponse
response
;
private
MockResponse
response
;
@Before
@Before
Each
public
void
setUp
()
throws
Exception
{
public
void
setUp
()
throws
Exception
{
init
Mocks
(
this
);
open
Mocks
(
this
);
response
=
new
MockResponse
(
Discussion
.
class
,
null
,
"merge-request-discussions.json"
);
response
=
new
MockResponse
(
Discussion
.
class
,
null
,
"merge-request-discussions.json"
);
when
(
gitLabApi
.
getApiClient
()).
thenReturn
(
gitLabApiClient
);
when
(
gitLabApi
.
getApiClient
()).
thenReturn
(
gitLabApiClient
);
when
(
gitLabApiClient
.
validateSecretToken
(
any
())).
thenReturn
(
true
);
when
(
gitLabApiClient
.
validateSecretToken
(
any
())).
thenReturn
(
true
);
...
...
src/test/java/org/gitlab4j/api/TestNamespaceApi.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
fail
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
import
org.gitlab4j.api.models.Namespace
;
import
org.gitlab4j.api.models.Namespace
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
*
*
* TEST_NAMESPACE
* TEST_NAMESPACE
* TEST_HOST_URL
* TEST_HOST_URL
* TEST_PRIVATE_TOKEN
* TEST_PRIVATE_TOKEN
*
*
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*
*
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
public
class
TestNamespaceApi
extends
AbstractIntegrationTest
{
public
class
TestNamespaceApi
extends
AbstractIntegrationTest
{
private
static
GitLabApi
gitLabApi
;
private
static
GitLabApi
gitLabApi
;
...
@@ -34,15 +36,15 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
...
@@ -34,15 +36,15 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
// Must setup the connection to the GitLab test server
// Must setup the connection to the GitLab test server
gitLabApi
=
baseTestSetup
();
gitLabApi
=
baseTestSetup
();
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assume
NotNull
(
gitLabApi
);
assume
True
(
gitLabApi
!=
null
);
}
}
@Test
@Test
...
@@ -51,7 +53,7 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
...
@@ -51,7 +53,7 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
assertNotNull
(
namespaces
);
assertNotNull
(
namespaces
);
Optional
<
Namespace
>
matchingNamespace
=
namespaces
.
stream
().
Optional
<
Namespace
>
matchingNamespace
=
namespaces
.
stream
().
filter
(
n
->
n
.
getPath
().
equals
(
TEST_NAMESPACE
)).
findFirst
();
filter
(
n
->
n
.
getPath
().
equals
(
TEST_NAMESPACE
)).
findFirst
();
assertTrue
(
TEST_NAMESPACE
+
" not found!"
,
matchingNamespace
.
isPresent
()
);
assertTrue
(
matchingNamespace
.
isPresent
(),
TEST_NAMESPACE
+
" not found!"
);
}
}
@Test
@Test
...
@@ -76,7 +78,7 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
...
@@ -76,7 +78,7 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
assertNotNull
(
namespaces
);
assertNotNull
(
namespaces
);
Optional
<
Namespace
>
matchingNamespace
=
namespaces
.
stream
().
Optional
<
Namespace
>
matchingNamespace
=
namespaces
.
stream
().
filter
(
n
->
n
.
getPath
().
equals
(
TEST_NAMESPACE
)).
findFirst
();
filter
(
n
->
n
.
getPath
().
equals
(
TEST_NAMESPACE
)).
findFirst
();
assertTrue
(
TEST_NAMESPACE
+
" not found!"
,
matchingNamespace
.
isPresent
()
);
assertTrue
(
matchingNamespace
.
isPresent
(),
TEST_NAMESPACE
+
" not found!"
);
}
}
@Test
@Test
...
...
src/test/java/org/gitlab4j/api/TestNotesApi.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
java.util.List
;
import
java.util.List
;
...
@@ -10,12 +10,13 @@ import org.gitlab4j.api.models.Issue;
...
@@ -10,12 +10,13 @@ import org.gitlab4j.api.models.Issue;
import
org.gitlab4j.api.models.MergeRequest
;
import
org.gitlab4j.api.models.MergeRequest
;
import
org.gitlab4j.api.models.Note
;
import
org.gitlab4j.api.models.Note
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.FixMethodOrder
;
import
org.junit.jupiter.api.MethodOrderer
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.runners.MethodSorters
;
import
org.junit.jupiter.api.TestMethodOrder
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
...
@@ -27,8 +28,9 @@ import org.junit.runners.MethodSorters;
...
@@ -27,8 +28,9 @@ import org.junit.runners.MethodSorters;
*
*
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
@TestMethodOrder
(
MethodOrderer
.
MethodName
.
class
)
public
class
TestNotesApi
extends
AbstractIntegrationTest
{
public
class
TestNotesApi
extends
AbstractIntegrationTest
{
private
static
GitLabApi
gitLabApi
;
private
static
GitLabApi
gitLabApi
;
...
@@ -37,15 +39,15 @@ public class TestNotesApi extends AbstractIntegrationTest {
...
@@ -37,15 +39,15 @@ public class TestNotesApi extends AbstractIntegrationTest {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
// Must setup the connection to the GitLab test server
// Must setup the connection to the GitLab test server
gitLabApi
=
baseTestSetup
();
gitLabApi
=
baseTestSetup
();
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assume
NotNull
(
gitLabApi
);
assume
True
(
gitLabApi
!=
null
);
}
}
@Test
@Test
...
...
src/test/java/org/gitlab4j/api/TestNotificationSettingsApi.java
View file @
a1b28ea1
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assert
ions
.
assertNotNull
;
import
static
org
.
junit
.
Assume
.
assumeFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeFalse
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.
assumeTrue
;
import
java.util.List
;
import
java.util.List
;
import
org.gitlab4j.api.models.Group
;
import
org.gitlab4j.api.models.Group
;
import
org.gitlab4j.api.models.NotificationSettings
;
import
org.gitlab4j.api.models.NotificationSettings
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.junit.Before
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.BeforeClass
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.FixMethodOrder
;
import
org.junit.jupiter.api.MethodOrderer
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.experimental.categories.Category
;
import
org.junit.jupiter.api.Test
;
import
org.junit.runners.MethodSorters
;
import
org.junit.jupiter.api.TestMethodOrder
;
import
org.junit.jupiter.api.extension.ExtendWith
;
/**
/**
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
...
@@ -29,8 +30,9 @@ import org.junit.runners.MethodSorters;
...
@@ -29,8 +30,9 @@ import org.junit.runners.MethodSorters;
*
*
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*/
*/
@Category
(
IntegrationTest
.
class
)
@Tag
(
"integration"
)
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
@ExtendWith
(
SetupIntegrationTestExtension
.
class
)
@TestMethodOrder
(
MethodOrderer
.
MethodName
.
class
)
public
class
TestNotificationSettingsApi
extends
AbstractIntegrationTest
{
public
class
TestNotificationSettingsApi
extends
AbstractIntegrationTest
{
// The following needs to be set to your test repository
// The following needs to be set to your test repository
...
@@ -42,15 +44,15 @@ public class TestNotificationSettingsApi extends AbstractIntegrationTest {
...
@@ -42,15 +44,15 @@ public class TestNotificationSettingsApi extends AbstractIntegrationTest {
super
();
super
();
}
}
@Before
Class
@Before
All
public
static
void
setup
()
{
public
static
void
setup
()
{
// Must setup the connection to the GitLab test server
// Must setup the connection to the GitLab test server
gitLabApi
=
baseTestSetup
();
gitLabApi
=
baseTestSetup
();
}
}
@Before
@Before
Each
public
void
beforeMethod
()
{
public
void
beforeMethod
()
{
assume
NotNull
(
gitLabApi
);
assume
True
(
gitLabApi
!=
null
);
}
}
@Test
@Test
...
...
Prev
1
2
3
4
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment