@Test void testCopy() { final C c0 = this.builder().build(); final C c1 = (C) c0.copy(); assertEquals(c0, c1); }
@Test void testDecoration() { final C c0 = this.builder().build(); assertDecorations(c0, ImmutableMap.of()); final C c1 = (C) c0.decoration(TextDecoration.BOLD, true); assertDecorations(c1, ImmutableMap.of(TextDecoration.BOLD, TextDecoration.State.TRUE)); assertEquals(c0, c1.decoration(TextDecoration.BOLD, TextDecoration.State.NOT_SET)); }
@Test void testMergeEvents() { final C c0 = this.builder().build(); assertNull(c0.color()); assertDecorations(c0, ImmutableMap.of()); assertNull(c0.clickEvent()); final C c1 = (C) c0.mergeEvents(TextComponent.of("xyz", TextColor.RED, ImmutableSet.of(TextDecoration.BOLD)).clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/foo"))); assertNull(c1.color()); assertDecorations(c1, ImmutableMap.of()); assertNotNull(c1.clickEvent()); }
@Test void testMergeColor() { final C c0 = this.builder().build(); assertNull(c0.color()); assertDecorations(c0, ImmutableMap.of()); assertNull(c0.clickEvent()); final C c1 = (C) c0.mergeColor(TextComponent.of("xyz", TextColor.RED, ImmutableSet.of(TextDecoration.BOLD)).clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/foo"))); assertEquals(TextColor.RED, c1.color()); assertDecorations(c1, ImmutableMap.of()); assertNull(c1.clickEvent()); assertEquals(c0, c1.color(null)); }
@Test void testMergeDecorations() { final C c0 = this.builder().build(); assertNull(c0.color()); assertDecorations(c0, ImmutableMap.of()); assertNull(c0.clickEvent()); final C c1 = (C) c0.mergeDecorations(TextComponent.of("xyz", TextColor.RED, ImmutableSet.of(TextDecoration.BOLD)).clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/foo"))); assertNull(c1.color()); assertDecorations(c1, ImmutableMap.of(TextDecoration.BOLD, TextDecoration.State.TRUE)); assertNull(c1.clickEvent()); assertEquals(c0, c1.decoration(TextDecoration.BOLD, TextDecoration.State.NOT_SET)); }
@Test void testMergeStyle() { final C c0 = this.builder().build(); assertNull(c0.color()); assertDecorations(c0, ImmutableMap.of()); assertNull(c0.clickEvent()); final C c1 = (C) c0.mergeStyle(TextComponent.of("xyz", TextColor.RED, ImmutableSet.of(TextDecoration.BOLD)).clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/foo"))); assertEquals(TextColor.RED, c1.color()); assertDecorations(c1, ImmutableMap.of(TextDecoration.BOLD, TextDecoration.State.TRUE)); assertNotNull(c1.clickEvent()); assertEquals(c0, c1.color(null).decoration(TextDecoration.BOLD, TextDecoration.State.NOT_SET).clickEvent(null)); }
@Test void testColor() { final C c0 = this.builder().build(); assertNull(c0.color()); final C c1 = (C) c0.color(TextColor.GREEN); assertEquals(TextColor.GREEN, c1.color()); assertEquals(c0, c1.color(null)); }
@Test void testInsertion() { final C c0 = this.builder().build(); assertNull(c0.insertion()); final C c1 = (C) c0.insertion("foo"); assertNotNull(c1.insertion()); assertEquals(c0, c1.insertion(null)); }
@Test void testClickEvent() { final C c0 = this.builder().build(); assertNull(c0.clickEvent()); final C c1 = (C) c0.clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "foo")); assertNotNull(c1.clickEvent()); assertEquals(c0, c1.clickEvent(null)); }
@Test void testHoverEvent() { final C c0 = this.builder().build(); assertNull(c0.hoverEvent()); final C c1 = (C) c0.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("hover"))); assertNotNull(c1.hoverEvent()); assertEquals(c0, c1.hoverEvent(null)); }
@Test void testResetStyle() { final C c0 = this.builder() .color(TextColor.RED) .decoration(TextDecoration.BOLD, true) .clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/foo")) .build(); final C c1 = (C) c0.resetStyle(); assertNull(c1.color()); assertDecorations(c1, ImmutableMap.of()); assertNull(c1.clickEvent()); assertEquals(c1, c0.color(null).decoration(TextDecoration.BOLD, TextDecoration.State.NOT_SET).clickEvent(null)); }