/*
 * Copyright 1999-2015 dangdang.com.
 * <p>
 * Licensed 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.
 * </p>
 */

package io.shardingjdbc.core.rule;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class DataNodeTest {
    
    @Test
    public void assertNewValidDataNode() {
        DataNode dataNode = new DataNode("ds_0.tbl_0");
        assertThat(dataNode.getDataSourceName(), is("ds_0"));
        assertThat(dataNode.getTableName(), is("tbl_0"));
    }
    
    @Test(expected = ShardingRuleException.class)
    public void assertNewInValidDataNodeWithoutDelimiter() {
        new DataNode("ds_0tbl_0");
    }
    
    @Test(expected = ShardingRuleException.class)
    public void assertNewInValidDataNodeWithTwoDelimiters() {
        new DataNode("ds_0.tbl_0.tbl_1");
    }
}

@@ -734,31 +734,123 @@
 org.
-junit.Assert.assertThat
+hamcrest.core.IsEqual.equalTo;%0Aimport static org.junit.Assert.assertThat;%0Aimport static org.junit.Assert.assertTrue
 ;%0A%0Ap
@@ -1386,24 +1386,24 @@
 imiters() %7B%0A
-
         new 
@@ -1438,10 +1438,668 @@
 ;%0A    %7D%0A
+    %0A    @Test(expected = ShardingRuleException.class)%0A    public void assertNewValidDataNodeWithInvalidDelimiter() %7B%0A        new DataNode(%22ds_0,tbl_0%22);%0A    %7D%0A    %0A    @Test%0A    public void assertNewValidDataNodeString() %7B%0A        assertThat(new DataNode(%22ds_0.tbl_0%22).toString(),is(new DataNode(%22ds_0.tbl_0%22).toString()));%0A    %7D%0A    %0A    @Test%0A    public void assertNewValidDataNodeHashCode() %7B%0A        assertThat(new DataNode(%22ds_0.tbl_0%22).hashCode(), is(new DataNode(%22ds_0.tbl_0%22).hashCode()));%0A    %7D%0A    %0A    @Test%0A    public void assertNewValidDataNodeEquals() %7B%0A        assertTrue(new DataNode(%22ds_0.tbl_0%22).equals(new DataNode(%22ds_0.tbl_0%22)));%0A    %7D%0A
 %7D%0A

add test case