Best MockBukkit code snippet using be.seeseemelk.mockbukkit.inventory.meta.BannerMetaMock
Source:ItemFactoryMock.java
1package be.seeseemelk.mockbukkit.inventory;2import be.seeseemelk.mockbukkit.UnimplementedOperationException;3import be.seeseemelk.mockbukkit.inventory.meta.ArmorStandMetaMock;4import be.seeseemelk.mockbukkit.inventory.meta.AxolotlBucketMetaMock;5import be.seeseemelk.mockbukkit.inventory.meta.BannerMetaMock;6import be.seeseemelk.mockbukkit.inventory.meta.BookMetaMock;7import be.seeseemelk.mockbukkit.inventory.meta.BundleMetaMock;8import be.seeseemelk.mockbukkit.inventory.meta.CompassMetaMock;9import be.seeseemelk.mockbukkit.inventory.meta.CrossbowMetaMock;10import be.seeseemelk.mockbukkit.inventory.meta.EnchantedBookMetaMock;11import be.seeseemelk.mockbukkit.inventory.meta.FireworkEffectMetaMock;12import be.seeseemelk.mockbukkit.inventory.meta.FireworkMetaMock;13import be.seeseemelk.mockbukkit.inventory.meta.ItemMetaMock;14import be.seeseemelk.mockbukkit.inventory.meta.KnowledgeBookMetaMock;15import be.seeseemelk.mockbukkit.inventory.meta.LeatherArmorMetaMock;16import be.seeseemelk.mockbukkit.inventory.meta.MapMetaMock;17import be.seeseemelk.mockbukkit.inventory.meta.PotionMetaMock;18import be.seeseemelk.mockbukkit.inventory.meta.SkullMetaMock;19import be.seeseemelk.mockbukkit.inventory.meta.SpawnEggMetaMock;20import be.seeseemelk.mockbukkit.inventory.meta.SuspiciousStewMetaMock;21import be.seeseemelk.mockbukkit.inventory.meta.TropicalFishBucketMetaMock;22import com.destroystokyo.paper.MaterialTags;23import com.google.common.base.Preconditions;24import net.kyori.adventure.text.Component;25import net.kyori.adventure.text.event.HoverEvent;26import net.md_5.bungee.api.chat.BaseComponent;27import net.md_5.bungee.api.chat.hover.content.Content;28import org.bukkit.Color;29import org.bukkit.Material;30import org.bukkit.Tag;31import org.bukkit.entity.Entity;32import org.bukkit.entity.EntityType;33import org.bukkit.inventory.ItemFactory;34import org.bukkit.inventory.ItemStack;35import org.bukkit.inventory.meta.ItemMeta;36import org.jetbrains.annotations.NotNull;37import org.jetbrains.annotations.Nullable;38import org.jetbrains.annotations.Range;39import java.lang.reflect.Constructor;40import java.lang.reflect.InvocationTargetException;41import java.util.Objects;42import java.util.Random;43import java.util.function.UnaryOperator;44public class ItemFactoryMock implements ItemFactory45{46 private final Color defaultLeatherColor = Color.fromRGB(10511680);47 private @NotNull Class<? extends ItemMeta> getItemMetaClass(@NotNull Material material)48 {49 // Special cases50 if (Tag.ITEMS_BANNERS.isTagged(material))51 {52 return BannerMetaMock.class;53 }54 else if (MaterialTags.SPAWN_EGGS.isTagged(material))55 {56 return SpawnEggMetaMock.class;57 }58 return switch (material)59 {60 case ARMOR_STAND -> ArmorStandMetaMock.class;61 case WRITABLE_BOOK, WRITTEN_BOOK -> BookMetaMock.class;62 case ENCHANTED_BOOK -> EnchantedBookMetaMock.class;63 case KNOWLEDGE_BOOK -> KnowledgeBookMetaMock.class;64 case LEATHER_BOOTS, LEATHER_CHESTPLATE, LEATHER_HELMET, LEATHER_LEGGINGS ->65 LeatherArmorMetaMock.class;66 case FILLED_MAP -> MapMetaMock.class;...
Source:ItemFactoryMockTest.java
1package be.seeseemelk.mockbukkit.inventory;2import be.seeseemelk.mockbukkit.MockBukkit;3import be.seeseemelk.mockbukkit.inventory.meta.ArmorStandMetaMock;4import be.seeseemelk.mockbukkit.inventory.meta.AxolotlBucketMetaMock;5import be.seeseemelk.mockbukkit.inventory.meta.BannerMetaMock;6import be.seeseemelk.mockbukkit.inventory.meta.BookMetaMock;7import be.seeseemelk.mockbukkit.inventory.meta.BundleMetaMock;8import be.seeseemelk.mockbukkit.inventory.meta.CompassMetaMock;9import be.seeseemelk.mockbukkit.inventory.meta.CrossbowMetaMock;10import be.seeseemelk.mockbukkit.inventory.meta.EnchantedBookMetaMock;11import be.seeseemelk.mockbukkit.inventory.meta.FireworkEffectMetaMock;12import be.seeseemelk.mockbukkit.inventory.meta.FireworkMetaMock;13import be.seeseemelk.mockbukkit.inventory.meta.ItemMetaMock;14import be.seeseemelk.mockbukkit.inventory.meta.KnowledgeBookMetaMock;15import be.seeseemelk.mockbukkit.inventory.meta.LeatherArmorMetaMock;16import be.seeseemelk.mockbukkit.inventory.meta.MapMetaMock;17import be.seeseemelk.mockbukkit.inventory.meta.PotionMetaMock;18import be.seeseemelk.mockbukkit.inventory.meta.SkullMetaMock;19import be.seeseemelk.mockbukkit.inventory.meta.SpawnEggMetaMock;20import be.seeseemelk.mockbukkit.inventory.meta.SuspiciousStewMetaMock;21import be.seeseemelk.mockbukkit.inventory.meta.TropicalFishBucketMetaMock;22import com.destroystokyo.paper.MaterialTags;23import org.bukkit.Material;24import org.bukkit.Tag;25import org.bukkit.inventory.ItemStack;26import org.bukkit.inventory.meta.ItemMeta;27import org.junit.jupiter.api.AfterEach;28import org.junit.jupiter.api.BeforeEach;29import org.junit.jupiter.api.Test;30import static org.junit.jupiter.api.Assertions.assertEquals;31import static org.junit.jupiter.api.Assertions.assertFalse;32import static org.junit.jupiter.api.Assertions.assertTrue;33class ItemFactoryMockTest34{35 private ItemFactoryMock factory;36 @BeforeEach37 void setUp()38 {39 MockBukkit.mock();40 factory = new ItemFactoryMock();41 }42 @AfterEach43 void tearDown()44 {45 MockBukkit.unmock();46 }47 /*48 * These tests are still very incomplete.49 */50 @Test51 void testGetItemMetaCorrectClass()52 {53 assertTrue(factory.getItemMeta(Material.DIRT) instanceof ItemMetaMock);54 assertTrue(factory.getItemMeta(Material.PLAYER_HEAD) instanceof SkullMetaMock);55 assertTrue(factory.getItemMeta(Material.WRITABLE_BOOK) instanceof BookMetaMock);56 assertTrue(factory.getItemMeta(Material.WRITTEN_BOOK) instanceof BookMetaMock);57 assertTrue(factory.getItemMeta(Material.ENCHANTED_BOOK) instanceof EnchantedBookMetaMock);58 assertTrue(factory.getItemMeta(Material.KNOWLEDGE_BOOK) instanceof KnowledgeBookMetaMock);59 assertTrue(factory.getItemMeta(Material.FIREWORK_STAR) instanceof FireworkEffectMetaMock);60 assertTrue(factory.getItemMeta(Material.FIREWORK_ROCKET) instanceof FireworkMetaMock);61 assertTrue(factory.getItemMeta(Material.SUSPICIOUS_STEW) instanceof SuspiciousStewMetaMock);62 assertTrue(factory.getItemMeta(Material.POTION) instanceof PotionMetaMock);63 assertTrue(factory.getItemMeta(Material.LEATHER_CHESTPLATE) instanceof LeatherArmorMetaMock);64 assertTrue(factory.getItemMeta(Material.AXOLOTL_BUCKET) instanceof AxolotlBucketMetaMock);65 assertTrue(factory.getItemMeta(Material.BUNDLE) instanceof BundleMetaMock);66 assertTrue(factory.getItemMeta(Material.FILLED_MAP) instanceof MapMetaMock);67 assertTrue(factory.getItemMeta(Material.COMPASS) instanceof CompassMetaMock);68 assertTrue(factory.getItemMeta(Material.CROSSBOW) instanceof CrossbowMetaMock);69 assertTrue(factory.getItemMeta(Material.ARMOR_STAND) instanceof ArmorStandMetaMock);70 assertTrue(factory.getItemMeta(Material.TROPICAL_FISH_BUCKET) instanceof TropicalFishBucketMetaMock);71 for (Material egg : MaterialTags.SPAWN_EGGS.getValues())72 {73 assertTrue(factory.getItemMeta(egg) instanceof SpawnEggMetaMock);74 }75 for (Material m : Tag.ITEMS_BANNERS.getValues())76 {77 assertTrue(factory.getItemMeta(m) instanceof BannerMetaMock);78 }79 }80 @Test81 void isApplicable_StandardItemMetaOnDirtMaterial_True()82 {83 ItemMeta meta = factory.getItemMeta(Material.DIRT);84 assertTrue(factory.isApplicable(meta, Material.DIRT));85 }86 @Test87 void isApplicable_StandardItemMetaOnDirtItemStack_True()88 {89 ItemStack stack = new ItemStack(Material.DIRT);90 ItemMeta meta = factory.getItemMeta(Material.DIRT);91 assertTrue(factory.isApplicable(meta, stack));...
Source:BannerMetaMockTest.java
...11import static org.junit.jupiter.api.Assertions.assertEquals;12import static org.junit.jupiter.api.Assertions.assertNotEquals;13import static org.junit.jupiter.api.Assertions.assertNull;14import static org.junit.jupiter.api.Assertions.assertTrue;15class BannerMetaMockTest16{17 private BannerMetaMock meta;18 @BeforeEach19 void setUp()20 {21 MockBukkit.mock();22 meta = new BannerMetaMock();23 }24 @AfterEach25 void tearDown()26 {27 MockBukkit.unmock();28 }29 @Test30 void constructor_DefaultValues()31 {32 assertNull(meta.getBaseColor());33 assertTrue(meta.getPatterns().isEmpty());34 }35 @Test36 void constructor_Clone_CopiesValues()37 {38 meta.setBaseColor(DyeColor.CYAN);39 meta.setPatterns(List.of(new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM)));40 BannerMetaMock cloned = new BannerMetaMock(meta);41 assertEquals(DyeColor.CYAN, cloned.getBaseColor());42 assertEquals(1, cloned.getPatterns().size());43 assertEquals(DyeColor.BLUE, cloned.getPatterns().get(0).getColor());44 assertEquals(PatternType.STRIPE_BOTTOM, cloned.getPatterns().get(0).getPattern());45 }46 @Test47 void setBaseColor_Sets()48 {49 meta.setBaseColor(DyeColor.CYAN);50 assertEquals(DyeColor.CYAN, meta.getBaseColor());51 }52 @Test53 void setPatterns_Sets()54 {55 meta.setPatterns(List.of(new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM)));56 assertEquals(1, meta.getPatterns().size());57 assertEquals(DyeColor.BLUE, meta.getPatterns().get(0).getColor());58 assertEquals(PatternType.STRIPE_BOTTOM, meta.getPatterns().get(0).getPattern());59 }60 @Test61 void setPatterns_ClonesList()62 {63 List<Pattern> patterns = new ArrayList<>(List.of(new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM)));64 meta.setPatterns(patterns);65 assertEquals(1, meta.numberOfPatterns());66 patterns.clear();67 assertTrue(patterns.isEmpty());68 assertEquals(1, meta.numberOfPatterns());69 }70 @Test71 void addPattern_AddsPattern()72 {73 meta.addPattern(new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM));74 assertEquals(1, meta.numberOfPatterns());75 meta.addPattern(new Pattern(DyeColor.CYAN, PatternType.CIRCLE_MIDDLE));76 assertEquals(2, meta.numberOfPatterns());77 assertEquals(DyeColor.BLUE, meta.getPattern(0).getColor());78 assertEquals(DyeColor.CYAN, meta.getPattern(1).getColor());79 }80 @Test81 void getPattern_ReturnsCorrectPattern()82 {83 meta.addPattern(new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM));84 meta.addPattern(new Pattern(DyeColor.CYAN, PatternType.CIRCLE_MIDDLE));85 assertEquals(DyeColor.BLUE, meta.getPattern(0).getColor());86 assertEquals(DyeColor.CYAN, meta.getPattern(1).getColor());87 }88 @Test89 void removePattern_RemovesCorrectPattern()90 {91 meta.addPattern(new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM));92 meta.addPattern(new Pattern(DyeColor.CYAN, PatternType.CIRCLE_MIDDLE));93 meta.removePattern(0);94 assertEquals(DyeColor.CYAN, meta.getPattern(0).getColor());95 }96 @Test97 void setPattern_SetsCorrectPattern()98 {99 meta.addPattern(new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM));100 meta.addPattern(new Pattern(DyeColor.CYAN, PatternType.CIRCLE_MIDDLE));101 meta.setPattern(0, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP));102 assertEquals(DyeColor.RED, meta.getPattern(0).getColor());103 assertEquals(DyeColor.CYAN, meta.getPattern(1).getColor());104 }105 @Test106 void numberOfPatterns_CorrectNumber()107 {108 meta.addPattern(new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM));109 meta.addPattern(new Pattern(DyeColor.CYAN, PatternType.CIRCLE_MIDDLE));110 assertEquals(2, meta.numberOfPatterns());111 }112 @Test113 void equals_SameInstance_ReturnsTrue()114 {115 assertEquals(meta, meta);116 }117 @Test118 void equals_DifferentInstance_SameValues_True()119 {120 BannerMetaMock clone = meta.clone();121 assertEquals(meta, clone);122 }123 @Test124 void equals_DifferentInstance_DifferentValues_False()125 {126 BannerMetaMock clone = meta.clone();127 clone.addPattern(new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM));128 assertNotEquals(meta, clone);129 }130 @Test131 void clone_CopiesValues()132 {133 meta.setBaseColor(DyeColor.CYAN);134 meta.setPatterns(List.of(new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM)));135 BannerMetaMock cloned = meta.clone();136 assertEquals(DyeColor.CYAN, cloned.getBaseColor());137 assertEquals(1, cloned.getPatterns().size());138 assertEquals(DyeColor.BLUE, cloned.getPatterns().get(0).getColor());139 assertEquals(PatternType.STRIPE_BOTTOM, cloned.getPatterns().get(0).getPattern());140 }141}...
BannerMetaMock
Using AI Code Generation
1import be.seeseemelk.mockbukkit.inventory.meta.BannerMetaMock;2import org.bukkit.DyeColor;3import org.bukkit.block.banner.Pattern;4import org.bukkit.block.banner.PatternType;5public class BannerMetaMockTest {6 public static void main(String[] args) {7 BannerMetaMock bannerMetaMock = new BannerMetaMock();8 bannerMetaMock.setBaseColor(DyeColor.BLACK);9 bannerMetaMock.addPattern(new Pattern(DyeColor.BLUE, PatternType.CIRCLE_MIDDLE));10 bannerMetaMock.addPattern(new Pattern(DyeColor.GREEN, PatternType.BORDER));11 bannerMetaMock.addPattern(new Pattern(DyeColor.WHITE, PatternType.BORDER));12 bannerMetaMock.addPattern(new Pattern(DyeColor.RED, PatternType.BORDER));13 bannerMetaMock.addPattern(new Pattern(DyeColor.YELLOW, PatternType.BORDER));14 bannerMetaMock.addPattern(new Pattern(DyeColor.BROWN, PatternType.BORDER));15 bannerMetaMock.addPattern(new Pattern(DyeColor.PURPLE, PatternType.BORDER));16 bannerMetaMock.addPattern(new Pattern(DyeColor.CYAN, PatternType.BORDER));17 bannerMetaMock.addPattern(new Pattern(DyeColor.LIGHT_GRAY, PatternType.BORDER));18 bannerMetaMock.addPattern(new Pattern(DyeColor.GRAY, PatternType.BORDER));19 bannerMetaMock.addPattern(new Pattern(DyeColor.PINK, PatternType.BORDER));20 bannerMetaMock.addPattern(new Pattern(DyeColor.LIME, PatternType.BORDER));21 bannerMetaMock.addPattern(new Pattern(DyeColor.LIGHT_BLUE, PatternType.BORDER));22 bannerMetaMock.addPattern(new Pattern(DyeColor.MAGENTA, PatternType.BORDER));23 bannerMetaMock.addPattern(new Pattern(DyeColor.ORANGE, PatternType.BORDER));24 bannerMetaMock.addPattern(new Pattern(DyeColor.WHITE, PatternType.BORDER));25 bannerMetaMock.addPattern(new Pattern(DyeColor.BLACK, PatternType.BORDER));26 bannerMetaMock.addPattern(new Pattern(DyeColor.WHITE, PatternType.BORDER));27 bannerMetaMock.addPattern(new Pattern(DyeColor.BLACK, PatternType.BORDER));28 bannerMetaMock.addPattern(new Pattern(DyeColor.WHITE, PatternType.BORDER));29 bannerMetaMock.addPattern(new Pattern(DyeColor.BLACK, PatternType.BORDER));30 bannerMetaMock.addPattern(new Pattern(DyeColor.WHITE, PatternType.BORDER));
BannerMetaMock
Using AI Code Generation
1import be.seeseemelk.mockbukkit.inventory.meta.BannerMetaMock;2import be.seeseemelk.mockbukkit.inventory.meta.ItemMetaMock;3import be.seeseemelk.mockbukkit.inventory.meta.PotionMetaMock;4import be.seeseemelk.mockbukkit.inventory.meta.SkullMetaMock;5import org.bukkit.Material;6import org.bukkit.inventory.ItemStack;7import org.bukkit.inventory.meta.BannerMeta;8import org.bukkit.inventory.meta.ItemMeta;9import org.bukkit.inventory.meta.PotionMeta;10import org.bukkit.inventory.meta.SkullMeta;11import org.junit.jupiter.api.Test;12import org.junit.jupiter.api.AfterEach;13import org.junit.jupiter.api.BeforeEach;14import org.junit.jupiter.api.DisplayName;15import org.junit.jupiter.api.Assertions;16import org.junit.jupiter.api.BeforeAll;17import org.junit.jupiter.api.AfterAll;18import org.junit.jupiter.api.BeforeEach;19import org.junit.jupiter.api.AfterEach;20import org.junit.jupiter.api.Test;21import org.junit.jupiter.api.DisplayName;22import org.junit.jupiter.api.Assertions;23import org.junit.jupiter.api.BeforeAll;24import org.junit.jupiter.api.AfterAll;25import org.junit.jupiter.api.BeforeEach;26import org.junit.jupiter.api.AfterEach;27import org.junit.jupiter.api.Test;28import org.junit.jupiter.api.DisplayName;29import org.junit.jupiter.api.Assertions;30import org.junit.jupiter.api.BeforeAll;31import org.junit.jupiter.api.AfterAll;32import org.junit.jupiter.api.BeforeEach;33import org.junit.jupiter.api.AfterEach;34import org.junit.jupiter.api.Test;35import org.junit.jupiter.api.DisplayName;36import org.junit.jupiter.api.Assertions;37import org.junit.jupiter.api.BeforeAll;38import org.junit.jupiter.api.AfterAll;39import org.junit.jupiter.api.BeforeEach;40import org.junit.jupiter.api.AfterEach;41import org.junit.jupiter.api.Test;42import org.junit.jupiter.api.DisplayName;43import org.junit.jupiter.api.Assertions;44import org.junit.jupiter.api.BeforeAll;45import org.junit.jupiter.api.AfterAll;46import org.junit.jupiter.api.BeforeEach;47import org.junit.jupiter.api.AfterEach;48import org.junit.jupiter.api.Test;49import org.junit.jupiter.api.DisplayName;50import org.junit.jupiter.api.Assertions;51import org.junit.jupiter.api.BeforeAll;52import org.junit.jupiter.api.AfterAll;53import org.junit.jupiter.api.BeforeEach;54import org.junit.jupiter.api.AfterEach;55import org.junit.jupiter.api.Test;56import org.junit.jupiter.api.DisplayName;57import org.junit.jupiter.api.Assertions;58import org.junit.jupiter.api.Before
BannerMetaMock
Using AI Code Generation
1import be.seeseemelk.mockbukkit.inventory.meta.BannerMetaMock;2import org.bukkit.DyeColor;3import org.bukkit.block.banner.Pattern;4import org.bukkit.block.banner.PatternType;5import org.junit.Test;6import static org.junit.Assert.*;7public class BannerMetaMockTest {8 public void testBannerMetaMock() {9 BannerMetaMock meta = new BannerMetaMock();10 meta.setBaseColor(DyeColor.BLUE);11 assertEquals(DyeColor.BLUE, meta.getBaseColor());12 meta.addPattern(new Pattern(DyeColor.YELLOW, PatternType.BORDER));13 meta.addPattern(new Pattern(DyeColor.GREEN, PatternType.BORDER));14 meta.addPattern(new Pattern(DyeColor.RED, PatternType.BORDER));15 assertEquals(3, meta.numberOfPatterns());16 assertEquals(new Pattern(DyeColor.YELLOW, PatternType.BORDER), meta.getPattern(0));17 assertEquals(new Pattern(DyeColor.GREEN, PatternType.BORDER), meta.getPattern(1));18 assertEquals(new Pattern(DyeColor.RED, PatternType.BORDER), meta.getPattern(2));19 meta.clearPatterns();20 assertEquals(0, meta.numberOfPatterns());21 assertNull(meta.getPattern(0));22 }23}
BannerMetaMock
Using AI Code Generation
1package be.seeseemelk.mockbukkit.inventory.meta;2import org.bukkit.DyeColor;3import org.bukkit.block.banner.Pattern;4import org.bukkit.block.banner.PatternType;5import org.bukkit.inventory.meta.BannerMeta;6import org.bukkit.inventory.meta.ItemMeta;7import org.jetbrains.annotations.NotNull;8import java.util.ArrayList;9import java.util.Arrays;10import java.util.List;11public class BannerMetaMock extends ItemMetaMock implements BannerMeta {12 private List<Pattern> patterns = new ArrayList<>();13 public boolean hasPatterns() {14 return !patterns.isEmpty();15 }16 public @NotNull List<Pattern> getPatterns() {17 return patterns;18 }19 public @NotNull List<Pattern> getPatterns(int i) {20 return patterns.subList(0, i);21 }22 public int numberOfPatterns() {23 return patterns.size();24 }25 public void setPatterns(@NotNull List<Pattern> list) {26 patterns = list;27 }28 public void addPattern(@NotNull Pattern pattern) {29 patterns.add(pattern);30 }31 public void addPattern(int i, @NotNull Pattern pattern) {32 patterns.add(i, pattern);33 }34 public @NotNull Pattern getPattern(int i) {35 return patterns.get(i);36 }37 public void setPattern(int i, @NotNull Pattern pattern) {38 patterns.set(i, pattern);39 }40 public void removePattern(int i) {41 patterns.remove(i);42 }43 public void removePattern(@NotNull PatternType patternType) {44 patterns.removeIf(pattern -> pattern.getPattern() == patternType);45 }46 public boolean hasBaseColor() {47 return false;48 }49 public @NotNull DyeColor getBaseColor() {50 return null;51 }52 public void setBaseColor(@NotNull DyeColor dyeColor) {53 }54 public @NotNull BannerMeta clone() {55 BannerMetaMock clone = (BannerMetaMock) super.clone();56 clone.patterns = new ArrayList<>(patterns);57 return clone;58 }59 public boolean equals(Object obj) {60 if (!super.equals(obj)) {61 return false;62 }
BannerMetaMock
Using AI Code Generation
1import org.bukkit.DyeColor;2import org.bukkit.block.banner.Pattern;3import org.bukkit.block.banner.PatternType;4import org.bukkit.inventory.meta.BannerMeta;5import java.util.ArrayList;6import java.util.List;7{8 private DyeColor baseColor;9 private List<Pattern> patterns;10 public BannerMetaMock()11 {12 patterns = new ArrayList<>();13 }14 public BannerMetaMock(BannerMeta meta)15 {16 this();17 if (meta.hasBaseColor())18 baseColor = meta.getBaseColor();19 if (meta.hasPatterns())20 patterns.addAll(meta.getPatterns());21 }22 public boolean hasBaseColor()23 {24 return baseColor != null;25 }26 public DyeColor getBaseColor()27 {28 return baseColor;29 }30 public void setBaseColor(DyeColor color)31 {32 this.baseColor = color;33 }34 public boolean hasPatterns()35 {36 return patterns.size() > 0;37 }38 public List<Pattern> getPatterns()39 {40 return patterns;41 }42 public void setPatterns(List<Pattern> patterns)43 {44 this.patterns = new ArrayList<>(patterns);45 }46 public void addPattern(Pattern pattern)47 {48 patterns.add(pattern);49 }50 public void removePattern(int i)51 {52 patterns.remove(i);53 }54 public void setPattern(int i, Pattern pattern)55 {56 patterns.set(i, pattern);57 }58 public int numberOfPatterns()59 {60 return patterns.size();61 }62 public boolean hasPattern(PatternType pattern)63 {64 for (Pattern p : patterns)65 {66 if (p.getPattern() == pattern)67 return true;68 }69 return false;70 }71 public Pattern getPattern(int i)72 {73 return patterns.get(i);74 }75 public void setPattern(int i, DyeColor color, PatternType pattern)76 {77 patterns.set(i, new Pattern(color, pattern));78 }
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!