@@ -0,0 +1,2833 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more contributor license%0A * agreements. See the NOTICE file distributed with this work for additional information regarding%0A * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance with the License. You may obtain a%0A * copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software distributed under the License%0A * is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express%0A * or implied. See the License for the specific language governing permissions and limitations under%0A * the License.%0A */%0A%0Apackage org.apache.geode.management.internal.cli.result;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0A%0Aimport org.junit.Test;%0Aimport org.junit.experimental.categories.Category;%0A%0Aimport org.apache.geode.management.cli.Result;%0Aimport org.apache.geode.test.junit.categories.UnitTest;%0A%0A@Category(UnitTest.class)%0Apublic class ErrorResultDataTest %7B%0A%0A  @Test%0A  public void emptyError() %7B%0A    ErrorResultData result = new ErrorResultData();%0A    assertThat(result.getGfJsonObject().getString(%22content%22)).isEqualTo(%22%7B%7D%22);%0A    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);%0A    assertThat(result.getType()).isEqualTo(%22error%22);%0A  %7D%0A%0A  @Test%0A  public void errorWithMessage() %7B%0A    ErrorResultData result = new ErrorResultData(%22This is an error%22);%0A    assertThat(result.getGfJsonObject().getJSONObject(%22content%22).getString(%22message%22))%0A        .isEqualTo(%22%5B%5C%22This is an error%5C%22%5D%22);%0A  %7D%0A%0A  @Test%0A  public void errorWithErrorCode() %7B%0A    ErrorResultData result = new ErrorResultData(%22This is an error%22);%0A    result.setErrorCode(77);%0A%0A    assertThat(result.getGfJsonObject().getJSONObject(%22content%22).getString(%22message%22))%0A        .isEqualTo(%22%5B%5C%22This is an error%5C%22%5D%22);%0A    assertThat(result.getGfJsonObject().getJSONObject(%22content%22).getString(%22errorCode%22))%0A        .isEqualTo(%2277%22);%0A  %7D%0A%0A  @Test%0A  public void errorWithMultipleMessages() %7B%0A    ErrorResultData result = new ErrorResultData(%22This is an error%22);%0A    result.addLine(%22This is another error%22);%0A%0A    assertThat(result.getGfJsonObject().getJSONObject(%22content%22).getString(%22message%22))%0A        .isEqualTo(%22%5B%5C%22This is an error%5C%22,%5C%22This is another error%5C%22%5D%22);%0A  %7D%0A%0A  @Test%0A  public void withHeaderAndFooter() %7B%0A    ErrorResultData result = new ErrorResultData();%0A%0A    String headerFooter = %22it was a dark and stormy night%22;%0A    result.setHeader(headerFooter);%0A    result.setFooter(headerFooter);%0A%0A    assertThat(result.getGfJsonObject().getString(%22header%22)).isEqualTo(headerFooter);%0A    assertThat(result.getGfJsonObject().getString(%22footer%22)).isEqualTo(headerFooter);%0A  %7D%0A%7D%0A

Add unit tests for ErrorResultData (#1744)