-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nbauma109
committed
May 12, 2023
1 parent
0891365
commit d0a88fe
Showing
3 changed files
with
186 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...java/org/jd/core/v1/service/converter/classfiletojavasyntax/util/SignatureReaderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.jd.core.v1.service.converter.classfiletojavasyntax.util; | ||
|
||
import org.jd.core.v1.service.converter.classfiletojavasyntax.util.TypeMaker.SignatureReader; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class SignatureReaderTest { | ||
private SignatureReader signatureReader; | ||
|
||
@Before | ||
public void setUp() { | ||
signatureReader = new SignatureReader("Ljava/lang/String;", 0); | ||
} | ||
|
||
@Test | ||
public void testRead() { | ||
Assert.assertEquals('L', signatureReader.read()); | ||
Assert.assertEquals('j', signatureReader.read()); | ||
} | ||
|
||
@Test | ||
public void testNextEqualsTo() { | ||
Assert.assertTrue(signatureReader.nextEqualsTo('L')); | ||
Assert.assertFalse(signatureReader.nextEqualsTo('j')); | ||
} | ||
|
||
@Test | ||
public void testSearch() { | ||
Assert.assertTrue(signatureReader.search(';')); | ||
Assert.assertEquals("Ljava/lang/String;".indexOf(';'), signatureReader.index); | ||
Assert.assertFalse(signatureReader.search('Z')); | ||
} | ||
|
||
@Test | ||
public void testAvailable() { | ||
Assert.assertTrue(signatureReader.available()); | ||
signatureReader = new SignatureReader("", 0); | ||
Assert.assertFalse(signatureReader.available()); | ||
} | ||
|
||
@Test | ||
public void testSubstring() { | ||
signatureReader.read(); // Move index | ||
Assert.assertEquals("Ljava", signatureReader.substring(1)); | ||
signatureReader.read(); // Move index | ||
Assert.assertEquals("va", signatureReader.substring(2)); | ||
} | ||
|
||
@Test | ||
public void testToString() { | ||
Assert.assertEquals("SignatureReader{index=0, nextChars=Ljava/lang/String;}", signatureReader.toString()); | ||
signatureReader.read(); // Move index | ||
Assert.assertEquals("SignatureReader{index=1, nextChars=java/lang/String;}", signatureReader.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters