Skip to content

Commit defd624

Browse files
jeanbzapongad
authored andcommitted
---
yaml --- r: 9237 b: refs/heads/spanner-gapic-migration c: 4fbe331 h: refs/heads/master i: 9235: d8b8b5e
1 parent ac0ca8a commit defd624

3 files changed

Lines changed: 62 additions & 1 deletion

File tree

  • branches/spanner-gapic-migration/google-cloud-dlp/src

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ refs/tags/v0.35.0: c28951c5f4cc97a1be07900d19df6984115a4bd6
8181
refs/tags/v0.36.0: 6b75c61f73e6827b3ca379bd54f88f750290162f
8282
refs/tags/v0.37.0: db2e142f92601709fdd48db159776f905742e30f
8383
refs/heads/mrschmidt-sizefix: 627a3bfa30bb6f4f76af47b228c38b208dd921e0
84-
refs/heads/spanner-gapic-migration: 606bbc259ecf5875f531f4524e76eddfcf75c49e
84+
refs/heads/spanner-gapic-migration: 4fbe33177071a06f7a5c204a41172f8097ea2de9
8585
refs/tags/v0.38.0: c235ee4df5e1248e1769dae3f86a0d7ab7fd8301
8686
refs/tags/v0.39.0: ab231c9d22475242a43d6d9554aa4a3f736dab01
8787
refs/tags/v0.40.0: a1d5b05206cce7734365f1b910396a2c9d6605ec
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.cloud.dlp.v2beta1;
17+
18+
import com.google.privacy.dlp.v2beta1.Color;
19+
20+
public class Colors {
21+
22+
private Colors() {}
23+
24+
public static final Color asDlpColor(java.awt.Color c) {
25+
return Color.newBuilder()
26+
.setBlue(c.getBlue())
27+
.setGreen(c.getGreen())
28+
.setRed(c.getRed())
29+
.build();
30+
}
31+
32+
public static final java.awt.Color asAwtColor(Color c) {
33+
return new java.awt.Color(c.getRed() / 255, c.getGreen() / 255, c.getBlue() / 255);
34+
}
35+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.google.cloud.dlp.v2beta1;
2+
3+
import com.google.privacy.dlp.v2beta1.Color;
4+
import org.junit.Assert;
5+
import org.junit.Test;
6+
7+
public class ColorTest {
8+
9+
@Test
10+
public void asDlpColorTest() {
11+
Color got = Colors.asDlpColor(new java.awt.Color(1, 2, 3));
12+
Assert.assertEquals(got.getBlue(), 3, 0);
13+
Assert.assertEquals(got.getGreen(), 2, 0);
14+
Assert.assertEquals(got.getRed(), 1, 0);
15+
}
16+
17+
@Test
18+
public void asAwtColorTest() {
19+
java.awt.Color got =
20+
Colors.asAwtColor(Color.newBuilder().setRed(1).setGreen(2).setBlue(3).build());
21+
22+
Assert.assertEquals(got.getBlue(), 3, 0);
23+
Assert.assertEquals(got.getGreen(), 2, 0);
24+
Assert.assertEquals(got.getRed(), 1, 0);
25+
}
26+
}

0 commit comments

Comments
 (0)