-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a781498
commit 4e908d5
Showing
5 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...ub/src/test/java/net/nemerosa/ontrack/extension/github/model/GitHubConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package net.nemerosa.ontrack.extension.github.model; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import org.junit.Test; | ||
|
||
import static net.nemerosa.ontrack.json.JsonUtils.object; | ||
import static net.nemerosa.ontrack.test.TestUtils.assertJsonRead; | ||
import static net.nemerosa.ontrack.test.TestUtils.assertJsonWrite; | ||
|
||
public class GitHubConfigurationTest { | ||
|
||
@Test | ||
public void toJson() throws JsonProcessingException { | ||
assertJsonWrite( | ||
object() | ||
.with("name", "ontrack") | ||
.with("repository", "nemerosa/ontrack") | ||
.withNull("user") | ||
.withNull("password") | ||
.with("oauth2Token", "1234567890abcdef") | ||
.with("indexationInterval", 60) | ||
.end(), | ||
new GitHubConfiguration( | ||
"ontrack", | ||
"nemerosa/ontrack", | ||
null, | ||
null, | ||
"1234567890abcdef", | ||
60 | ||
) | ||
); | ||
} | ||
|
||
@Test | ||
public void fromJson() throws JsonProcessingException { | ||
assertJsonRead( | ||
new GitHubConfiguration( | ||
"ontrack", | ||
"nemerosa/ontrack", | ||
null, | ||
null, | ||
"1234567890abcdef", | ||
60 | ||
), | ||
object() | ||
.with("name", "ontrack") | ||
.with("repository", "nemerosa/ontrack") | ||
.withNull("user") | ||
.withNull("password") | ||
.with("indexationInterval", 60) | ||
.with("oauth2Token", "1234567890abcdef") | ||
.with("serviceId", "ontrack") // This field is ignored | ||
.end(), | ||
GitHubConfiguration.class | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters