BottomAppBarHandler extends ViewHandler { @Override @Language("XML") @NotNull public String getXml(@NotNull String tagName, @NotNull XmlType xmlType) { return new XmlBuilder() .startTag(tagName) .androidAttribute(ATTR_LAYOUT_WIDTH, VALUE_MATCH_PARENT) .androidAttribute(ATTR_LAYOUT_HEIGHT, VALUE_WRAP_CONTENT) .attribute(ATTR_STYLE, "@style/Widget.MaterialComponents.BottomAppBar.Colored") .androidAttribute(ATTR_LAYOUT_GRAVITY, GRAVITY_VALUE_BOTTOM) .endTag(tagName) .toString(); }  @Override @NotNull List<String> getInspectorProperties(); @Override @Language("XML") @NotNull String getXml(@NotNull String tagName, @NotNull XmlType xmlType);  }
@Test public void testGetXml() { String expected = "<com.google.android.material.bottomappbar.BottomAppBar\n" + " android:layout_width=\"match_parent\"\n" + " android:layout_height=\"wrap_content\"\n" + " style=\"@style/Widget.MaterialComponents.BottomAppBar.Colored\"\n" + " android:layout_gravity=\"bottom\" />\n"; ViewHandler handler = new BottomAppBarHandler(); assertThat(handler.getXml(SdkConstants.BOTTOM_APP_BAR, XmlType.COMPONENT_CREATION)).isEqualTo(expected); assertThat(handler.getXml(SdkConstants.BOTTOM_APP_BAR, XmlType.DRAG_PREVIEW)).isEqualTo(expected); }