Home | History | Annotate | Download | only in result
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package com.android.tradefed.result;
     17 
     18 import com.android.tradefed.result.TestSummary.TypedString;
     19 
     20 import junit.framework.TestCase;
     21 
     22 import java.util.Map;
     23 
     24 /**
     25  * Unit tests for {@link TestSummary}
     26  * A class to represent a test summary.  Provides a single field for a summary, in addition to a
     27  * key-value store for more detailed summary.  Also provides a place for the summary source to be
     28  * identified.
     29  */
     30 public class TestSummaryTest extends TestCase {
     31     public void testSimpleCreate() {
     32         final TypedString sumText = new TypedString("file:///path/to/summary.txt");
     33         final TypedString httpText = new TypedString("http://summary.com/also/a/summary.html");
     34         final String className = this.getClass().getName();
     35 
     36         TestSummary summary = new TestSummary(sumText);
     37         summary.addKvEntry("httpText", httpText);
     38         summary.setSource(className);
     39 
     40         assertEquals(summary.getSummary(), sumText);
     41         assertEquals(summary.getSource(), className);
     42         Map<String, TypedString> kv = summary.getKvEntries();
     43         assertEquals(kv.size(), 1);
     44         assertEquals(kv.get("httpText"), httpText);
     45     }
     46 }
     47