package org.wesome.dsalgo;
public class ConvertUppercaseToLowercase {
public static final char SPACE = ' ';
public static int a = 97;
public static char convertUppercaseToLowercase(char ch) {
System.out.println("character is = " + ch + ", its ascii value is " + Integer.valueOf(ch) + ", ASCII value of space is " + Integer.valueOf(SPACE));
return (char) (ch | SPACE);
}
}
package org.wesome.dsalgo;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.stream.IntStream;
import static org.wesome.dsalgo.ConvertUppercaseToLowercase.a;
import static org.wesome.dsalgo.ConvertUppercaseToLowercase.convertUppercaseToLowercase;
public class ConvertUppercaseToLowercaseTest {
@Test
void UppercaseToLowercaseTest1() {
Assertions.assertEquals('a', convertUppercaseToLowercase('A'));
}
@Test
void UppercaseToLowercaseTest2() {
Assertions.assertEquals('z', convertUppercaseToLowercase('Z'));
}
@Test
void UppercaseToLowercaseTest3() {
IntStream.rangeClosed(65, 90).forEach(i -> {
Assertions.assertEquals(a, convertUppercaseToLowercase((char) i));
a++;
});
}
}
plugins {
id 'java'
id "io.freefair.lombok" version "6.4.1"
}
group = 'org.wesome'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = JavaVersion.VERSION_1_8
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.2'
}
test {
useJUnitPlatform()
}