Search in sources :

Example 1 with TypedValue

use of jetbrains.buildServer.server.rest.model.problem.TypedValue in project teamcity-rest by JetBrains.

the class TestOccurrenceFinderTest method testTestOccurrenceEntity_Metadata.

@Test
public void testTestOccurrenceEntity_Metadata() throws Exception {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final RunningBuildEx build = startBuild(buildType);
    myFixture.doTestPassed(build, "testName");
    myFixture.doTestMetadata(build, new TestMetadata("testName", "some key", "link", "value"));
    myFixture.doTestMetadata(build, new TestMetadata("testName", "some key3", "number", new BigDecimal("44")));
    STestRun testRun = finishBuild().getFullStatistics().getAllTests().get(0);
    TestOccurrence testOccurrence = new TestOccurrence(testRun, getBeanContext(myServer), new Fields("metadata"));
    assertEquals(Integer.valueOf(2), testOccurrence.getMetadata().count);
    final List<TypedValue> items = testOccurrence.getMetadata().typedValues;
    assertEquals(items.size(), 2);
    System.out.println("items = " + StringUtil.join("\n", items));
    assertTrue(items.contains(new TypedValue("some key", "link", "value", Fields.LONG)));
    assertTrue(items.contains(new TypedValue("some key3", "number", String.valueOf(44f), Fields.LONG)));
}
Also used : TestOccurrence(jetbrains.buildServer.server.rest.model.problem.TestOccurrence) Fields(jetbrains.buildServer.server.rest.model.Fields) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) TestMetadata(jetbrains.buildServer.messages.TestMetadata) BigDecimal(java.math.BigDecimal) TypedValue(jetbrains.buildServer.server.rest.model.problem.TypedValue) Test(org.testng.annotations.Test)

Aggregations

BigDecimal (java.math.BigDecimal)1 TestMetadata (jetbrains.buildServer.messages.TestMetadata)1 Fields (jetbrains.buildServer.server.rest.model.Fields)1 TestOccurrence (jetbrains.buildServer.server.rest.model.problem.TestOccurrence)1 TypedValue (jetbrains.buildServer.server.rest.model.problem.TypedValue)1 BuildTypeImpl (jetbrains.buildServer.serverSide.impl.BuildTypeImpl)1 Test (org.testng.annotations.Test)1