-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpom_test.go
38 lines (31 loc) · 975 Bytes
/
pom_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
// Copyright 2015 MediaMath <http://www.mediamath.com>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
import (
"encoding/xml"
"testing"
)
func TestPomCreation(t *testing.T) {
expected := `
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apace.org/POM/4.0.0 http://mave.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mediamath</groupId>
<artifactId>part</artifactId>
<version>12-SNAPSHOT</version>
</project>`
var parsed pom
xml.Unmarshal([]byte(expected), &parsed)
loc := &location{
host: "https://example.com",
repo: "fake",
group: "com.mediamath",
artifact: "part",
version: "12-SNAPSHOT",
file: "foo.zip",
}
created := newPom(loc)
if parsed != *created {
t.Errorf("\n%v\n%v", parsed, *created)
}
}