Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
mreyes committed Jul 1, 2024
1 parent d878c8b commit e945302
Show file tree
Hide file tree
Showing 24 changed files with 300 additions and 257 deletions.
29 changes: 15 additions & 14 deletions source/Hyperspace-Model-Tests/AbstractCURIETest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
An AbstractCURIETest is a test class for testing the behavior of AbstractCURIE
"
Class {
#name : #AbstractCURIETest,
#superclass : #TestCase,
#category : 'Hyperspace-Model-Tests'
#name : 'AbstractCURIETest',
#superclass : 'TestCase',
#category : 'Hyperspace-Model-Tests',
#package : 'Hyperspace-Model-Tests'
}

{ #category : #testing }
{ #category : 'testing' }
AbstractCURIETest class >> isAbstract [

^ self = AbstractCURIETest
]

{ #category : #private }
{ #category : 'private' }
AbstractCURIETest >> curieClass [

^ self subclassResponsibility
]

{ #category : #tests }
{ #category : 'tests' }
AbstractCURIETest >> testAccessing [

| curie |
Expand All @@ -37,15 +38,15 @@ AbstractCURIETest >> testAccessing [
assertUrl: curie relativeReference equals: 'Person#legal' asUrl
]

{ #category : #tests }
{ #category : 'tests' }
AbstractCURIETest >> testAsWebLink [

| curie |
curie := self curieClass prefixedBy: 'users' referencing: 'octocat' asUrl.
self assert: curie asWebLink equals: ( WebLink to: curie )
]

{ #category : #tests }
{ #category : 'tests' }
AbstractCURIETest >> testCantCreateWithAbsoluteReference [

self
Expand All @@ -54,7 +55,7 @@ AbstractCURIETest >> testCantCreateWithAbsoluteReference [
withMessageText: 'https://google.com/ must be a relative reference'
]

{ #category : #tests }
{ #category : 'tests' }
AbstractCURIETest >> testCantCreateWithEmptyPrefix [

self
Expand All @@ -63,7 +64,7 @@ AbstractCURIETest >> testCantCreateWithEmptyPrefix [
withMessageText: 'A CURIE prefix cannot be empty'
]

{ #category : #tests }
{ #category : 'tests' }
AbstractCURIETest >> testCantExpandToURIInContext [

| curie |
Expand All @@ -75,7 +76,7 @@ AbstractCURIETest >> testCantExpandToURIInContext [
withMessageText: 'Missing namespace "users"'
]

{ #category : #tests }
{ #category : 'tests' }
AbstractCURIETest >> testCantExpandToURIInContextRecursiverly [

| userCurie usersCurie context |
Expand All @@ -90,7 +91,7 @@ AbstractCURIETest >> testCantExpandToURIInContextRecursiverly [
withMessageText: 'Missing namespace "api"'
]

{ #category : #tests }
{ #category : 'tests' }
AbstractCURIETest >> testComparing [

| curie |
Expand All @@ -106,7 +107,7 @@ AbstractCURIETest >> testComparing [
deny: curie equals: ( self curieClass prefixedBy: 'orgs' referencing: 'octocat' asUrl )
]

{ #category : #tests }
{ #category : 'tests' }
AbstractCURIETest >> testExpandToURIInContext [

| curie context |
Expand All @@ -119,7 +120,7 @@ AbstractCURIETest >> testExpandToURIInContext [
equals: 'https://api.github.com/users/octocat' asUrl
]

{ #category : #tests }
{ #category : 'tests' }
AbstractCURIETest >> testExpandToURIInContextRecursively [

| usersCurie userCurie context |
Expand Down
17 changes: 9 additions & 8 deletions source/Hyperspace-Model-Tests/CURIETest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@
A CompactURITest is a test class for testing the behavior of CompactURI
"
Class {
#name : #CURIETest,
#superclass : #AbstractCURIETest,
#category : 'Hyperspace-Model-Tests'
#name : 'CURIETest',
#superclass : 'AbstractCURIETest',
#category : 'Hyperspace-Model-Tests',
#package : 'Hyperspace-Model-Tests'
}

{ #category : #private }
{ #category : 'private' }
CURIETest >> curieClass [

^ CURIE
]

{ #category : #tests }
{ #category : 'tests' }
CURIETest >> testAsSafeCURIE [

self
assert: ( self curieClass fromString: 'users:octocat' ) asSafeCURIE printString
equals: '[users:octocat]'
]

{ #category : #tests }
{ #category : 'tests' }
CURIETest >> testFromString [

| curie |
Expand All @@ -32,7 +33,7 @@ CURIETest >> testFromString [
assertUrl: curie relativeReference equals: 'octocat' asUrl / 'tokens'
]

{ #category : #tests }
{ #category : 'tests' }
CURIETest >> testParsingErrors [

self
Expand All @@ -50,7 +51,7 @@ CURIETest >> testParsingErrors [
withMessageText: 'Cannot create a CURIE from "users"'
]

{ #category : #tests }
{ #category : 'tests' }
CURIETest >> testPrinting [

| curie curieWithPath curieWithFragment |
Expand Down
20 changes: 11 additions & 9 deletions source/Hyperspace-Model-Tests/EntityTagTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@
I'm a test case for EntityTag
"
Class {
#name : #EntityTagTest,
#superclass : #TestCase,
#category : 'Hyperspace-Model-Tests-IETF'
#name : 'EntityTagTest',
#superclass : 'TestCase',
#category : 'Hyperspace-Model-Tests-IETF',
#package : 'Hyperspace-Model-Tests',
#tag : 'IETF'
}

{ #category : #tests }
{ #category : 'tests' }
EntityTagTest >> testAsEntityTag [

self
assert: '"12345"' asEntityTag equals: (EntityTag fromString: '"12345"');
assert: (EntityTag fromString: '"12345"') asEntityTag equals: (EntityTag fromString: '"12345"')
]

{ #category : #tests }
{ #category : 'tests' }
EntityTagTest >> testAsString [

self assert: (EntityTag with: '12345') asString equals: '"12345"'.
self assert: (EntityTag weakWith: '12345') asString equals: 'W/"12345"'.
]

{ #category : #tests }
{ #category : 'tests' }
EntityTagTest >> testCaseSensitiveWeakEntityTagCreation [

self
Expand All @@ -31,7 +33,7 @@ EntityTagTest >> testCaseSensitiveWeakEntityTagCreation [
raise: InstanceCreationFailed
]

{ #category : #tests }
{ #category : 'tests' }
EntityTagTest >> testFromString [

self
Expand All @@ -49,7 +51,7 @@ EntityTagTest >> testFromString [
should: [ EntityTag fromString: 'w/"1"' ] raise: InstanceCreationFailed
]

{ #category : #tests }
{ #category : 'tests' }
EntityTagTest >> testHash [

self
Expand All @@ -60,7 +62,7 @@ EntityTagTest >> testHash [
equals: (EntityTag fromString: 'W/"12345"') hash
]

{ #category : #tests }
{ #category : 'tests' }
EntityTagTest >> testPrinting [

self assert: (EntityTag with: '12345') printString equals: '"12345"'.
Expand Down
32 changes: 17 additions & 15 deletions source/Hyperspace-Model-Tests/HTTPClientErrorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
A HTTPClientErrorTest is a test class for testing the behavior of HTTPClientError
"
Class {
#name : #HTTPClientErrorTest,
#superclass : #TestCase,
#category : 'Hyperspace-Model-Tests-Exceptions'
#name : 'HTTPClientErrorTest',
#superclass : 'TestCase',
#category : 'Hyperspace-Model-Tests-Exceptions',
#package : 'Hyperspace-Model-Tests',
#tag : 'Exceptions'
}

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testBadRequest [

self
Expand All @@ -21,7 +23,7 @@ HTTPClientErrorTest >> testBadRequest [
]
]

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testConflict [

self
Expand All @@ -35,7 +37,7 @@ HTTPClientErrorTest >> testConflict [
]
]

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testConvenienceHandler [

self
Expand All @@ -48,7 +50,7 @@ HTTPClientErrorTest >> testConvenienceHandler [
]
]

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testConvenienceHandlerUsingAnotherSignal [

self
Expand All @@ -64,7 +66,7 @@ HTTPClientErrorTest >> testConvenienceHandlerUsingAnotherSignal [
]
]

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testConvenienceHandlerWithOnExceptDo [

self
Expand All @@ -81,7 +83,7 @@ HTTPClientErrorTest >> testConvenienceHandlerWithOnExceptDo [
]
]

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testNotFound [

self
Expand All @@ -104,7 +106,7 @@ HTTPClientErrorTest >> testNotFound [
]
]

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testPreconditionFailed [

self
Expand All @@ -118,7 +120,7 @@ HTTPClientErrorTest >> testPreconditionFailed [
]
]

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testPreconditionRequired [

self
Expand All @@ -132,7 +134,7 @@ HTTPClientErrorTest >> testPreconditionRequired [
]
]

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testSignalingCustomCode [

self
Expand All @@ -151,7 +153,7 @@ HTTPClientErrorTest >> testSignalingCustomCode [
]
]

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testTooManyRequests [

self
Expand All @@ -165,7 +167,7 @@ HTTPClientErrorTest >> testTooManyRequests [
]
]

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testUnprocessableEntity [

self
Expand All @@ -179,7 +181,7 @@ HTTPClientErrorTest >> testUnprocessableEntity [
]
]

{ #category : #tests }
{ #category : 'tests' }
HTTPClientErrorTest >> testUnsupportedMediaType [

self
Expand Down
14 changes: 8 additions & 6 deletions source/Hyperspace-Model-Tests/HTTPErrorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
A HTTPErrorTest is a test class for testing the behavior of HTTPError
"
Class {
#name : #HTTPErrorTest,
#superclass : #TestCase,
#category : 'Hyperspace-Model-Tests-Exceptions'
#name : 'HTTPErrorTest',
#superclass : 'TestCase',
#category : 'Hyperspace-Model-Tests-Exceptions',
#package : 'Hyperspace-Model-Tests',
#tag : 'Exceptions'
}

{ #category : #tests }
{ #category : 'tests' }
HTTPErrorTest >> testHandlingExceptionSelectorSets [

self
Expand All @@ -24,13 +26,13 @@ HTTPErrorTest >> testHandlingExceptionSelectorSets [
raise: HTTPServerError serviceUnavailable
]

{ #category : #tests }
{ #category : 'tests' }
HTTPErrorTest >> testHandlingHTTPClientError [

self should: [ HTTPClientError notFound signal ] raise: HTTPError
]

{ #category : #tests }
{ #category : 'tests' }
HTTPErrorTest >> testHandlingHTTPServerError [

self should: [ HTTPServerError internalServerError signal ] raise: HTTPError
Expand Down
10 changes: 6 additions & 4 deletions source/Hyperspace-Model-Tests/HTTPNotAcceptableTest.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Class {
#name : #HTTPNotAcceptableTest,
#superclass : #TestCase,
#category : 'Hyperspace-Model-Tests-Exceptions'
#name : 'HTTPNotAcceptableTest',
#superclass : 'TestCase',
#category : 'Hyperspace-Model-Tests-Exceptions',
#package : 'Hyperspace-Model-Tests',
#tag : 'Exceptions'
}

{ #category : #tests }
{ #category : 'tests' }
HTTPNotAcceptableTest >> testSignaling [

self
Expand Down
Loading

0 comments on commit e945302

Please sign in to comment.