Skip to content

Commit

Permalink
Added unit test for map omission
Browse files Browse the repository at this point in the history
  • Loading branch information
sauldhernandez committed Jun 11, 2019
1 parent ccf5c55 commit ae509f7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ subprojects{ subproject ->
apply plugin: 'kotlin'

group = 'com.github.marcoferrer.krotoplus'
version = '0.3.0'
version = '0.3.0-fixed'

compileKotlin {
kotlinOptions.jvmTarget = "1.8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import io.grpc.examples.helloworld.HelloWorldProtoDslBuilder
import io.grpc.examples.helloworld.orDefault
import org.junit.Test
import test.message.*
import test.message.multi.MappedMessage
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals

Expand Down Expand Up @@ -102,4 +103,16 @@ class ProtoBuildersGeneratorTests {
assertNotEquals(message1.nestedMessage, result.nestedMessage)
assertEquals(message2.nestedMessage.field, result.nestedMessage.field)
}

@Test
fun `Test message map omission`() {
val key = "test"
val value = "value"

val message = MappedMessage {
putTheField(key, value)
}

assertEquals(message.theFieldMap[key], value)
}
}
14 changes: 14 additions & 0 deletions test-api/src/main/proto/message/test_messages_multi.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";

package validate.test;

option java_package = "test.message.multi";
option java_multiple_files = true;

message MappedMessage {
map<string, string> the_field = 1;
}

message RegularMessage {
int32 the_field = 1;
}

0 comments on commit ae509f7

Please sign in to comment.