Path: blob/master/test/jdk/java/lang/instrument/ASimpleInstrumentationTestCase.java
41152 views
/*1* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import java.lang.instrument.*;24import java.security.ProtectionDomain;25import java.util.*;26import java.io.*;27import java.net.*;28import java.lang.reflect.*;293031/*32* Copyright 2003 Wily Technology, Inc.33*/3435/**36* Simple tests for the Instrumentation37*38*/39public abstract class40ASimpleInstrumentationTestCase41extends AInstrumentationTestCase42{4344/**45* Constructor for ASimpleInstrumentationTestCase.46*/47public ASimpleInstrumentationTestCase(String name)48{49super(name);5051}5253protected void54assertClassArrayContainsClass(Class[] list, Class target)55{56boolean inList = false;57for ( int x = 0; x < list.length; x++ )58{59if ( list[x] == target )60{61inList = true;62}63}64assertTrue(inList);65}6667protected void68assertClassArrayDoesNotContainClassByName(Class[] list, String name)69{70boolean inList = false;71for ( int x = 0; x < list.length; x++ )72{73if ( list[x].getName().equals(name) )74{75fail();76}77}78}7980}818283