From 5003afc85c81ea851cfbf8783b81547a630875a6 Mon Sep 17 00:00:00 2001
From: Darien Raymond <admin@v2ray.com>
Date: Wed, 2 Dec 2015 21:30:15 +0000
Subject: [PATCH] test case for vmess outbound config

---
 proxy/vmess/config/json/outbound_test.go | 33 ++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 proxy/vmess/config/json/outbound_test.go

diff --git a/proxy/vmess/config/json/outbound_test.go b/proxy/vmess/config/json/outbound_test.go
new file mode 100644
index 00000000..b35a4adb
--- /dev/null
+++ b/proxy/vmess/config/json/outbound_test.go
@@ -0,0 +1,33 @@
+package json_test
+
+import (
+	"encoding/json"
+	"testing"
+
+	jsonconfig "github.com/v2ray/v2ray-core/proxy/vmess/config/json"
+	v2testing "github.com/v2ray/v2ray-core/testing"
+	"github.com/v2ray/v2ray-core/testing/assert"
+)
+
+func TestConfigTargetParsing(t *testing.T) {
+	v2testing.Current(t)
+
+	rawJson := `{
+    "address": "127.0.0.1",
+    "port": 80,
+    "users": [
+      {
+        "id": "e641f5ad-9397-41e3-bf1a-e8740dfed019",
+        "email": "love@v2ray.com",
+        "level": 999
+      }
+    ]
+  }`
+
+	var target *jsonconfig.ConfigTarget
+	err := json.Unmarshal([]byte(rawJson), &target)
+	assert.Error(err).IsNil()
+	assert.String(target.Address).Equals("127.0.0.1:80")
+	assert.Int(len(target.Users)).Equals(1)
+	assert.StringLiteral(target.Users[0].ID().String).Equals("e641f5ad-9397-41e3-bf1a-e8740dfed019")
+}