@Test
    public void checkTest() {
        tableInfo.setAddress("address");
        tableInfo.setIndex("index");
        tableInfo.setEsType("estype");
        tableInfo.setClusterName("clustername");
        try {
            tableInfo.check();
        } catch (NullPointerException e) {
            assertThat(e.getMessage(), containsString("is required"));
        }

        try {
            tableInfo.setId("d");
            tableInfo.check();
            fail("id must be a numeric type");
        } catch (IllegalArgumentException e) {
            assertThat(e.getMessage(), containsString("id must be a numeric type"));
        }
        tableInfo.setId("1");
        try {
            tableInfo.setAuthMesh(true);
            tableInfo.check();
        } catch (NullPointerException e) {
            assertThat(e.getMessage(), containsString("is required"));
        }
        tableInfo.setUserName("name");
        tableInfo.setPassword("password");
        assertTrue(tableInfo.check());
    }
Company: www.dtstack.com

@author zhufeng
@date 2020-06-17
elasticsearch5/elasticsearch5-sink/src/test/java/com/dtstack/flink/sql/sink/elasticsearch/table/ElasticsearchTableInfoTest.java