### Question:
AddMemoryBlockCmd implements Command { @Override public String getName() { return "Add Memory Block"; } AddMemoryBlockCmd(String name, String comment, String source, Address start, int length,
			boolean read, boolean write, boolean execute, boolean isVolatile, byte initialValue,
			MemoryBlockType blockType, Address baseAddr, boolean isInitialized); @Override boolean applyTo(DomainObject obj); @Override String getName(); @Override String getStatusMsg();  }### Answer:
@Test public void testAddBlock() throws Exception { command = new AddMemoryBlockCmd(".test", "A Test", "new block", getNotepadAddr(0x100), 100, true, true, true, false, (byte) 0xa, MemoryBlockType.DEFAULT, null, true); assertTrue(applyCmd(notepad, command)); MemoryBlock block = notepad.getMemory().getBlock(getNotepadAddr(0x100)); assertNotNull(block); byte b = block.getByte(getNotepadAddr(0x100)); assertEquals((byte) 0xa, b); Listing listing = notepad.getListing(); String[] treeNames = listing.getTreeNames(); ProgramFragment f = listing.getFragment(treeNames[0], getNotepadAddr(0x100)); assertNotNull(f); assertEquals(block.getName(), f.getName()); }
@Test public void testAddOverlayBlock() throws Exception { Address addr = getX08Addr(0x3000); command = new AddMemoryBlockCmd(".overlay", "A Test", "new block", addr, 100, true, true, true, false, (byte) 0xa, MemoryBlockType.OVERLAY, getX08Addr(0), true); assertTrue(applyCmd(x08, command)); MemoryBlock block = null; MemoryBlock[] blocks = x08.getMemory().getBlocks(); for (MemoryBlock block2 : blocks) { if (block2.getName().equals(".overlay")) { block = block2; break; } } assertNotNull(block); assertEquals(MemoryBlockType.OVERLAY, block.getType()); byte b = block.getByte(block.getStart().getNewAddress(0x3000)); assertEquals((byte) 0xa, b); }