Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

8 changes: 4 additions & 4 deletions src/main/java/org/example/P21_StringIntoInteger.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.example;

public class P21_StringIntoInteger {
public static void main(String[] args) {
String text = "1234";
int numar = Integer.valueOf(text);

System.out.println("The value of the integer is : " + numar);

public static int stringToInteger(String text) {
int number = Integer.valueOf(text);
return number;
}
}
22 changes: 0 additions & 22 deletions src/test/java/org/example/C01_10_MultiplicationOfIntegersTest.java

This file was deleted.

15 changes: 15 additions & 0 deletions src/test/java/org/example/P21_StringIntoIntegerTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.example;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class P21_StringIntoIntegerTest {
@Test
void getNumber() {
String number = "1234";
int text = P21_StringIntoInteger.stringToInteger(number);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming text an integer number is not good naming. Give variables proper names.

assertEquals(1234, text);

}
}