/** * Creates a score component with a name and objective. * * @param name the score name * @param objective the score objective * @return the score component */ public static ScoreComponent of(final @NonNull String name, final @NonNull String objective) { return of(name, objective, null); }
/** * Creates a score component with a name and objective. * * @param name the score name * @param objective the score objective * @return the score component */ public static ScoreComponent of(final @NonNull String name, final @NonNull String objective) { return of(name, objective, null); }
/** * Creates a score component with a name and objective. * * @param name the score name * @param objective the score objective * @return the score component */ public static ScoreComponent of(final @NonNull String name, final @NonNull String objective) { return of(name, objective, null); }
@Test void testDeserializeScore() { assertEquals(ScoreComponent.of("abc", "def"), GsonComponentSerializer.INSTANCE.deserialize("{\"score\":{\"name\":\"abc\",\"objective\":\"def\"}}")); }
@Test void testRebuildWithNoChanges() { final ScoreComponent component = ScoreComponent.of("test", "test"); assertEquals(component, component.toBuilder().build()); } }
@Test void testName() { final ScoreComponent c0 = ScoreComponent.of("abc", "def"); final ScoreComponent c1 = c0.name("ghi"); assertEquals("abc", c0.name()); assertEquals("ghi", c1.name()); assertEquals("def", c1.objective()); }
@Test void testObjective() { final ScoreComponent c0 = ScoreComponent.of("abc", "def"); final ScoreComponent c1 = c0.objective("ghi"); assertEquals("def", c0.objective()); assertEquals("ghi", c1.objective()); assertEquals("abc", c1.name()); }
@Test void testOf() { final ScoreComponent component = ScoreComponent.of("abc", "def"); assertEquals("abc", component.name()); assertEquals("def", component.objective()); assertNull(component.color()); for(final TextDecoration decoration : TextDecoration.values()) { assertEquals(TextDecoration.State.NOT_SET, component.decoration(decoration)); } }