osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] brooklyn-server pull request #969: Add registered types test


Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/969#discussion_r194323280
  
    --- Diff: core/src/test/java/org/apache/brooklyn/core/typereg/RegisteredTypesTest.java ---
    @@ -0,0 +1,123 @@
    +package org.apache.brooklyn.core.typereg;
    +
    +import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
    +import org.apache.brooklyn.api.typereg.RegisteredType;
    +import org.testng.annotations.Test;
    +
    +import javax.annotation.Nullable;
    +
    +import static org.testng.Assert.*;
    +
    +public class RegisteredTypesTest {
    +
    +    public static final String DRBD_YAML = "brooklyn.catalog:\n" +
    --- End diff --
    
    happy to merge as is but i like @geomacy 's suggestion readability could be improved.  maybe an  inner static class `EquivalentPlanGenerator` that has fields `usesQuotes1` and `includeComments` so code is like:
    
        plan +=
          "    drbdIconUrl: "+quoteIfTrue(usesQuotes1, "https://s3.eu-central-1.amazonaws.com/misc-csft/drbd.jpg";);
    
    then each test might be rewritten
    
        assertTrue(RegisteredTypes.arePlansEquivalent(
            new EquivalentPlanGenerator().usesQuotes1(true).build(),
            new EquivalentPlanGenerator().includesComments1(true).build() ));
    
    (but as i said not at all necessary -- nice job adding the tests!)


---