Skip to content

Commit

Permalink
Use two different classes in our test to prevent a LinkageError on de…
Browse files Browse the repository at this point in the history
…bian (close #49)
  • Loading branch information
henri-tremblay committed Jan 17, 2017
1 parent 9761595 commit 0bfbbf7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
30 changes: 30 additions & 0 deletions main/src/test/java/org/objenesis/EmptyClassBis.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright 2006-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.objenesis;

import java.util.Date;

/**
* Just used for testing. To see the bytecode of a really simple class
*
* @author Henri Tremblay
*/
public class EmptyClassBis extends Date {

public EmptyClassBis() {
throw new RuntimeException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
public class ClassDefinitionUtilsTest {

String className = "org.objenesis.EmptyClass";
String className = "org.objenesis.EmptyClassBis";

@Test
public void testDefineClass() throws Exception {
Expand All @@ -36,13 +36,13 @@ public void testDefineClass() throws Exception {
@Test
public void testClassNameToInternalClassName() {
String actual = ClassDefinitionUtils.classNameToInternalClassName(className);
assertEquals("org/objenesis/EmptyClass", actual);
assertEquals("org/objenesis/EmptyClassBis", actual);
}

@Test
public void testClassNameToResource() {
String actual = ClassDefinitionUtils.classNameToResource(className);
assertEquals("org/objenesis/EmptyClass.class", actual);
assertEquals("org/objenesis/EmptyClassBis.class", actual);
}

@Test
Expand Down

0 comments on commit 0bfbbf7

Please sign in to comment.