Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
android_20250623
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
android_20250623
Commits
90e549a7
Commit
90e549a7
authored
Jun 23, 2025
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Testy JUnit
parent
f77ec959
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
0 deletions
+65
-0
build.gradle
Projekt2/czysta_java/build.gradle
+4
-0
Funkcje.java
...va/src/main/java/alx/czysta_java/p04_funkcje/Funkcje.java
+33
-0
FunkcjeTest.java
...rc/test/java/alx/czysta_java/p04_funkcje/FunkcjeTest.java
+26
-0
libs.versions.toml
Projekt2/gradle/libs.versions.toml
+2
-0
No files found.
Projekt2/czysta_java/build.gradle
View file @
90e549a7
...
...
@@ -5,3 +5,6 @@ java {
sourceCompatibility
JavaVersion
.
VERSION_11
targetCompatibility
JavaVersion
.
VERSION_11
}
dependencies
{
testImplementation
libs
.
junit
.
junit
}
\ No newline at end of file
Projekt2/czysta_java/src/main/java/alx/czysta_java/p04_funkcje/Funkcje.java
0 → 100644
View file @
90e549a7
package
alx
.
czysta_java
.
p04_funkcje
;
public
class
Funkcje
{
static
void
witaj
(
String
imie
)
{
System
.
out
.
println
(
"Witaj "
+
imie
+
"!"
);
}
static
double
poleProstokata
(
double
a
,
double
b
)
{
return
a
*
b
;
}
static
String
pozdrowienie
(
String
imie
)
{
if
(
imie
==
null
)
{
imie
=
"nieznana osobo"
;
}
return
"Witaj "
+
imie
;
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"Początek programu"
);
// wywołanie metody statycznyj, gdy jesteśmy w tej samej klasie - jak funkcja w innych językach progr
witaj
(
"Ala"
);
// wywołanie poprzez nazwę klasy, gdybyśmy byli w innym miejscu:
Funkcje
.
witaj
(
"Ola"
);
// samo wywołaniew operacji, która posiada return nie odczytuje / wypisuje tego wyniku
poleProstokata
(
3
,
4
);
var
wynik
=
poleProstokata
(
5.5
,
13
);
System
.
out
.
println
(
"pole wynosi "
+
wynik
);
System
.
out
.
println
(
poleProstokata
(
2
,
3
));
}
}
Projekt2/czysta_java/src/test/java/alx/czysta_java/p04_funkcje/FunkcjeTest.java
0 → 100644
View file @
90e549a7
package
alx
.
czysta_java
.
p04_funkcje
;
import
static
org
.
junit
.
Assert
.*;
import
org.junit.Test
;
public
class
FunkcjeTest
{
@Test
public
void
poleProstokata
()
{
assertEquals
(
14.0
,
Funkcje
.
poleProstokata
(
3.5
,
4
),
0.001
);
}
@Test
public
void
pozdrowienie
()
{
String
wynik
=
Funkcje
.
pozdrowienie
(
"Ala"
);
assertEquals
(
"Witaj Ala"
,
wynik
);
}
@Test
public
void
pozdrowienieNull
()
{
String
wynik
=
Funkcje
.
pozdrowienie
(
null
);
assertEquals
(
"Witaj nieznana osobo"
,
wynik
);
}
}
\ No newline at end of file
Projekt2/gradle/libs.versions.toml
View file @
90e549a7
...
...
@@ -5,6 +5,7 @@ junitVersion = "1.1.5"
espressoCore
=
"3.5.1"
appcompat
=
"1.6.1"
material
=
"1.10.0"
junitJunit
=
"4.12"
[libraries]
junit
=
{
group
=
"junit"
,
name
=
"junit"
,
version.ref
=
"junit"
}
...
...
@@ -12,6 +13,7 @@ ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitV
espresso-core
=
{
group
=
"androidx.test.espresso"
,
name
=
"espresso-core"
,
version.ref
=
"espressoCore"
}
appcompat
=
{
group
=
"androidx.appcompat"
,
name
=
"appcompat"
,
version.ref
=
"appcompat"
}
material
=
{
group
=
"com.google.android.material"
,
name
=
"material"
,
version.ref
=
"material"
}
junit-junit
=
{
group
=
"junit"
,
name
=
"junit"
,
version.ref
=
"junitJunit"
}
[plugins]
android-application
=
{
id
=
"com.android.application"
,
version.ref
=
"agp"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment